python 脚本无法调用 azure 上的 chrome 驱动程序

标签 python azure selenium selenium-chromedriver

当我在 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/

相关文章:

azure - 如何在 Azure DevOps 发布管道中保存测试结果

没有服务器的 Selenium Golang 绑定(bind)

selenium - Jenkins 中的条件构建后步骤(理想情况下没有插件)

python - libcurl 在curl 和curl-config 中不匹配

分布式 Web 应用程序的 Azure DocumentDB 一致性

azure - 谁邀请了访客用户

java - 如何使用 selenium webDriver 列出 <tr> 标记内的所有 <td>

python - 有没有一种方法可以调整 NumPy 数组的大小/形状,从而保留每行的 sum()

python - 如何读取 "C source, ISO-8859 text"

python - 在 python 中将本地化字符串日期表示形式转换为 UTC