我对Selenium很新,突然之间没有任何错误导致我无法运行任何Selenium测试。
这是我运行Python脚本时遇到的错误:
ActionController::Base.helpers.image_tag("YOUR_IMAGE")
现在我通常可以调试这些问题。但是,geckodriver.log并没有给我太多帮助:
2018-05-14 12:07:52,766 [INFO ] Getting Selenium setup here.
Traceback (most recent call last):
File "test.py", line 308, in <module>
webcrawler.crawl()
File "test.py", line 177, in crawl
self.web_crawl.setup()
File "/test/src/webcrawlers/utils/webcrawl_lib.py", line 83, in setup
self.browser = webdriver.Firefox(firefox_profile=profile)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 162, in __init__
keep_alive=True)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1
环境:
我甚至尝试过使用Chrome,设置只会挂起并发出一个独特的错误。
附注是,这是在亚马逊AWS上,我不是该帐户的管理员。也许在这方面发生了一些变化。
答案 0 :(得分:2)
我遇到了与geckodriver 0.21.1,Selenium 3.12.0和Python 3.5.2相同的问题。它在Ubuntu 17.04上对我有用,用firefox-dev
删除Firefox和(sudo apt-get purge firefox, firefox-dev
)然后我手动安装Firefox版本50.0:
wget http://ftp.mozilla.org/pub/firefox/releases/50.0/linux-$(uname -m)/en-US/firefox-50.0.tar.bz2
tar -xjf firefox-50.0.tar.bz2
sudo mv firefox /opt/
sudo mv /usr/bin/firefox /usr/bin/firefox_old
sudo ln -s /opt/firefox/firefox /usr/bin/firefox
在这些步骤之后,它也适用于root。