我正在测试一个网站,我正在使用selenium来自动化它。我的应用程序在启动浏览器后立即挂起。我的配置可能存在问题 - 这是我的设置:
python==3.6
selenium==2.53.6
firefox==58
logging.basicConfig(stream=sys.stderr, level=LEVEL)
driver = webdriver.Firefox()
if ATTACK_REDDIT:
driver.get("http://mywebsite.com")
....
有什么想法吗?这是控制台的输出:
Connected to pydev debugger (build 173.4127.16)
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1668, in <module>
main()
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1662, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1072, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/simon/PycharmProjects/uncaptcha/main.py", line 363, in <module>
main()
File "/Users/simon/PycharmProjects/uncaptcha/main.py", line 293, in main
driver = webdriver.Firefox()
File "/Users/simon/PycharmProjects/uncaptcha/venv/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 80, in __init__
self.binary, timeout)
File "/Users/simon/PycharmProjects/uncaptcha/venv/lib/python3.6/site-packages/selenium/webdriver/firefox/extension_connection.py", line 52, in __init__
self.binary.launch_browser(self.profile, timeout=timeout)
File "/Users/simon/PycharmProjects/uncaptcha/venv/lib/python3.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable(timeout=timeout)
File "/Users/simon/PycharmProjects/uncaptcha/venv/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/8r/rttp99k95xx4d6b2h_596jfr0000gn/T/tmpup78c87x If you specified a log_file in the FirefoxBinary constructor, check it for details.
答案 0 :(得分:0)
我相信您需要使用Firefox 47或更高版本的selenium 2.53。我使用selenium和Java有这个问题。尝试降级Firefox或升级selenium并切换到gecko驱动程序。