[英]Why is selenium not working properly on my mac?
I'm using python 3 and selenium 2.53.6 on mac and it does open firefox but not to the page I specified. 我在Mac上使用python 3和selenium 2.53.6,它确实打开了Firefox,但没有打开我指定的页面。 I try to open "inventwithpython.com" but all my program does is launch firefox and return this error.
我尝试打开“ inventwithpython.com”,但我的程序所做的只是启动firefox并返回此错误。
Below is my code: 下面是我的代码:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('http://inventwithpython.com')
I also getting below error: 我也得到以下错误:
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.
文件“ /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/firefox/firefox_binary.py”,第108行,位于_wait_until_connectable%(self.profile.path)中selenium.common.exceptions.WebDriverException:消息:无法加载配置文件。 Profile Dir: /var/folders/4c/gsw7v5b118j406zxj3lxctt40000gn/T/tmpv963_mt0 If you specified a log_file in the FirefoxBinary constructor, check it for details.
配置文件目录:/ var / folders / 4c / gsw7v5b118j406zxj3lxctt40000gn / T / tmpv963_mt0如果您在FirefoxBinary构造函数中指定了log_file,请对其进行详细检查。
can you try this? 你可以试试这个吗? and let me know what happenes?
让我知道发生了什么事?
#!/your/shebang/line/python3
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('/your/path/to/actual/firefox/binary')
driver = webdriver.Firefox(firefox_binary=binary)
driver.get('http://inventwithpython.com')
make sure the path to binary is the actual one you launch when you touch Firefox normally. 确保二进制路径是您正常触摸Firefox时启动的实际路径。
EDIT: 编辑:
oh and before i forget, make sure you do this as well. 哦,在我忘记之前,请确保您也执行此操作。 just to be sure.
只是要确定。
pip install -U selenium
because there was a fix for profiles a bit ago if i remember right. 因为如果我没记错的话,之前有一个配置文件修复程序。 so lets make sure that's not a thing.
因此,请确保这不是问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.