python脚本无法在azure

时间:2017-05-19 11:54:20

标签: 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

1 个答案:

答案 0 :(得分:0)

根据您的错误信息,根据我的经验,我认为您正在使用Azure应用服务尝试驱动您通过webdriver上传的Chrome,以加载一些动态Web内容来提取内容。

但是,根据the restrictions of Azure Web App sandbox,您无法使用任何可在Azure WebApp上调用GDI系统的内容。关于Windows错误,您可以参考here了解更多详细信息。

作为一种解决方法,我的建议是您可以尝试在Azure VM上运行代码。或者根据我对线程标签的猜测,我想您可能想通过带有chromedriver的webdriver进行一些网络单元测试,请参阅here