最近在学习selenium遇到的这个问题,只能打开firefox,之后就没法加载url,公司的电脑我试下是可以的,网上搜了很多资料也没有解决,很纠结,请大家帮忙看看...
python代码:
from selenium import webdriver
from time import sleep
s = webdriver.Firefox()
s.get('https://www.baidu.com')
s.find_element_by_id('kw').send_keys('python')
sleep(3)
s.find_element_by_id('su').click()
sleep(5)
s.quit()
打印的报错信息:
Traceback (most recent call last):
File "D:/python/new.py", line 5, in
s = webdriver.Firefox()
File "C:\Python27\lib\site-packages\selenium-2.48.0-py2.7.egg\selenium\webdriver\firefox\webdriver.py", line 77, in init
self.binary, timeout),
File "C:\Python27\lib\site-packages\selenium-2.48.0-py2.7.egg\selenium\webdriver\firefox\extension_connection.py", line 49, in init
self.binary.launch_browser(self.profile)
File "C:\Python27\lib\site-packages\selenium-2.48.0-py2.7.egg\selenium\webdriver\firefox\firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable()
File "C:\Python27\lib\site-packages\selenium-2.48.0-py2.7.egg\selenium\webdriver\firefox\firefox_binary.py", line 103, 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.
我的环境是:
python2.7.11 selenium2.48 Firefox42