当我在 azure 上检查尝试调用 chrome 驱动程序的自动化脚本时,它给出了以下错误。脚本是用Python编写的。
[05/19/2017 11:36:19 > cbe7c6: INFO] step2
[05/19/2017 11:36:19 > cbe7c6: ERR ] File "seleniumtest.py", line 21, in <module>
[05/19/2017 11:36:19 > cbe7c6: ERR ] driver = webdriver.Chrome(executable_path="D:\\home\\site\\wwwroot\\env\\chromeinstaller\\Chrome\\Application\\chrome.exe")
[05/19/2017 11:36:19 > cbe7c6: ERR ] File "D:\home\site\wwwroot\env\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
[05/19/2017 11:36:19 > cbe7c6: ERR ] self.service.start()
[05/19/2017 11:36:19 > cbe7c6: ERR ] File "D:\home\site\wwwroot\env\Lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
[05/19/2017 11:36:19 > cbe7c6: ERR ] stdout=self.log_file, stderr=self.log_file)
[05/19/2017 11:36:19 > cbe7c6: ERR ] File "D:\Python27\lib\subprocess.py", line 710, in __init__
[05/19/2017 11:36:19 > cbe7c6: ERR ] errread, errwrite)
[05/19/2017 11:36:19 > cbe7c6: ERR ] File "D:\Python27\lib\subprocess.py", line 958, in _execute_child
[05/19/2017 11:36:19 > cbe7c6: ERR ] startupinfo)
[05/19/2017 11:36:19 > cbe7c6: ERR ] WindowsError: [Error 14001] The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail
[05/19/2017 11:36:19 > cbe7c6: SYS INFO] Status changed to Failed
[05/19/2017 11:36:19 > cbe7c6: SYS ERR ] Job failed due to exit code 1
最佳答案
根据您的错误信息,根据我的经验,我认为您正在使用 Azure 应用服务来尝试驱动通过 webdriver 上传的 chrome 来加载一些动态 Web 内容以提取某些内容。
但是,根据the restrictions of Azure Web App sandbox ,你不能在Azure WebApp上使用任何调用GDI系统的东西。关于Windows错误,您可以引用here了解更多详情。
作为一种解决方法,我的建议是您可以尝试在 Azure VM 上运行代码。或者根据我根据此线程标签的猜测,我认为您可能只是想通过带有 chromedriver 的 webdriver 进行一些 Web 单元测试,请参阅 here .
关于python 脚本无法调用 azure 上的 chrome 驱动程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44069467/