简体   繁体   English

无法远程运行Selenium脚本

[英]Can't run selenium script remotely

I have a python selenium script. 我有一个python硒脚本。 I want to run the script on remotely connected(using ssh) PC. 我想在远程连接的PC上运行脚本。 when i run the script directly on that PC, it run. 当我直接在该PC上运行脚本时,它就会运行。 but, while i run the same script remotely, it throw error. 但是,尽管我远程运行相同的脚本,但会引发错误。

Traceback (most recent call last):
  File "crawling_script.py", line 14, in <module>
    driver = webdriver.Chrome(executable_path='/var/www/html/hariharan/health_grades/chromedriver')
  File "/var/www/html/hariharan/health_grades/env/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/var/www/html/hariharan/health_grades/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/var/www/html/hariharan/health_grades/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/var/www/html/hariharan/health_grades/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/var/www/html/hariharan/health_grades/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Linux 4.4.0-145-generic x86_64)

Please give me a solution to run the selenium python script remotely. 请给我一个远程运行Selenium python脚本的解决方案。 Thanks in advance. 提前致谢。

尝试ssh -X ,它将图形输出转发到本地计算机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM