有没有人遇到过这个错误?我刚刚开始在星期一收到这个错误.为什么连接有问题?
Selenium将打开浏览器,但不会插入网址.
C:\python34\python.exe "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydevd.py" --multiproc --client 127.0.0.1 --port 49660 --file //HAL1/FTP-Directories/Comal-County/comal.py
pydev debugger: process 5564 is connecting
Connected to pydev debugger (build 139.1547)
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydevd.py", line 2217, in <module>
globals = debugger.run(setup['file'], None, None)
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydevd.py", line 1643, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition4.0.5\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "//HAL1/FTP-Directories/Comal-County/comal.py", line 7, in <module>
driver = webdriver.Firefox();
File "C:\python34\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 59, in __init__
self.binary, timeout),
File "C:\python34\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 47, in __init__
self.binary.launch_browser(self.profile)
File "C:\python34\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 66, in launch_browser
self._wait_until_connectable()
File "C:\python34\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 105, 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 log_file in the FirefoxBinary constructor, check it for details.
码:
from selenium import webdriver
driver = webdriver.Firefox();
driver.get("http://www.google.com")
解决方法:
这是selenium和Firefox之间的兼容性问题.
将Firefox升级到最新版本(目前为36).
并将selenium升级到最新版本(目前为2.45):
pip install --upgrade selenium
原文地址:https://codeday.me/bug/20190612/1223222.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。