Selenium 在 ubuntu 上不能与 firefox 和 python webdriver 一起使用
Selenium is not working with firefox and python webdriver on ububtu
我正在尝试使用 selenium、firefox 和 python webdrivers 为我的 webapp 编写测试用例,而我的开发环境是在 ubuntu 16.04 LTS 上设置的,但我收到异常,
WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.
这是我的代码块
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("http://www.python.org")
assert "Python" in driver.title
driver.close()
这是完整的异常堆栈:
Traceback (most recent call last):
File "LoginLogout.py", line 4, in <module>
driver = webdriver.Firefox()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 80, in __init__
self.binary, timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 52, in __init__
self.binary.launch_browser(self.profile, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable(timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 99, in _wait_until_connectable
"The browser appears to have exited "
selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.
我有以下环境设置
Mozilla Firefox: 47.0
Selenium Version: 2.53.6
python version: 2.7.12
OS: Linux 4.4.0-31-generic #50-Ubuntu SMP x86_64
Selenium 正在放弃使用 FirefoxDriver,转而使用 Marionette。几周前我在迁移到 Firefox 47.0 时遇到了这个问题,当时我切换到了。
下面link更全面地讨论了这个问题。
我正在尝试使用 selenium、firefox 和 python webdrivers 为我的 webapp 编写测试用例,而我的开发环境是在 ubuntu 16.04 LTS 上设置的,但我收到异常,
WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.
这是我的代码块
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("http://www.python.org")
assert "Python" in driver.title
driver.close()
这是完整的异常堆栈:
Traceback (most recent call last):
File "LoginLogout.py", line 4, in <module>
driver = webdriver.Firefox()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 80, in __init__
self.binary, timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 52, in __init__
self.binary.launch_browser(self.profile, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable(timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 99, in _wait_until_connectable
"The browser appears to have exited "
selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.
我有以下环境设置
Mozilla Firefox: 47.0
Selenium Version: 2.53.6
python version: 2.7.12
OS: Linux 4.4.0-31-generic #50-Ubuntu SMP x86_64
Selenium 正在放弃使用 FirefoxDriver,转而使用 Marionette。几周前我在迁移到 Firefox 47.0 时遇到了这个问题,当时我切换到了。
下面link更全面地讨论了这个问题。