小编S.Y*_*ang的帖子

在SSH中运行Python Selenium Webdriver

我想在远程服务器上运行Selenium Webdriver。我只是尝试了一个非常简单的脚本:

from pyvirtualdisplay import Display
from selenium import webdriver
display = Display(visible=0, size=(800,600))
display.start()
driver = webdriver.Chrome()
driver.get("http://www.google.com")
print browser.title
browser.quit()
display.stop()
Run Code Online (Sandbox Code Playgroud)

错误是:

File "1.py", line 7, in <module>
driver = webdriver.Chrome()
File "/home/shunyang/.local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 61, in __init__
self.service.start()
File "/home/shunyang/.local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 85, in start
self.assert_process_still_running()
File "/home/shunyang/.local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 98, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException:
Message: Service chromedriver unexpectedly exited. 
Status code was: 1 
Run Code Online (Sandbox Code Playgroud)

我想知道我的设置有什么问题以及如何解决此问题。谢谢!

python ssh selenium

5
推荐指数
1
解决办法
3433
查看次数

标签 统计

python ×1

selenium ×1

ssh ×1