小编Tho*_*ler的帖子

Firefox Build不适用于Selenium

对于我的研究,我在firefox中做了一些源代码修改并自己构建.为了自动化测试,我选择使用Selenium但不幸的是,我新建的Firefox似乎不支持Selenium.

我做了以下事情:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

binary = FirefoxBinary("/path/to/firefox/binary")

d = webdriver.Firefox(firefox_binary=binary)

d.get("http://www.google.de")
Run Code Online (Sandbox Code Playgroud)

Firefox确实打开并且响应迅速(我可以在搜索栏中输入一个网站).但过了一会儿,python脚本崩溃并出现以下错误消息:

Traceback (most recent call last):
  File "firefox.py", line 7, in <module>
    d = webdriver.Firefox(firefox_binary=binary)
  File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
    self.binary, timeout),
  File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 66, in launch_browser
    self._wait_until_connectable()
  File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 109, in _wait_until_connectable
    raise WebDriverException("Can't load the profile. Profile "
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: %s If you specified a …
Run Code Online (Sandbox Code Playgroud)

python firefox selenium build

30
推荐指数
2
解决办法
3万
查看次数

标签 统计

build ×1

firefox ×1

python ×1

selenium ×1