我在Mac上使用python 3和selenium 2.53.6,它确实打开firefox,但不是我指定的页面。我尝试打开“inventwithpython.com”,但我所有的程序都是启动firefox并返回此错误。为什么硒在我的Mac上无法正常工作?
下面是我的代码:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('http://inventwithpython.com')
我也越来越以下错误:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 108, in _wait_until_connectable % (self.profile.path)) selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: /var/folders/4c/gsw7v5b118j406zxj3lxctt40000gn/T/tmpv963_mt0 If you specified a log_file in the FirefoxBinary constructor, check it for details.
你没有使用最新版本的:firefox,selenium,geckodriver。升级这些,你的代码将按原样工作。 –