我是新來硒和我按照網站http://selenium-python.readthedocs.org/問題與火狐
我嘗試下面的代碼位,它是有網站
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()
,當我運行這個程序,Firefox實例將打開,但不會加載頁面。 check snapshot
這是我在輸出控制檯
C:\Users\Gauss\Desktop>python test.py
Traceback (most recent call last):
File "test.py", line 4, in <module>
driver = webdriver.Firefox()
File "D:\Python\Python35\lib\site-packages\selenium-2.50.0-py3.5.egg\selenium\webdriver\firefox\webdriver.py", line 78, in __init__
self.binary, timeout)
File "D:\Python\Python35\lib\site-packages\selenium-2.50.0-py3.5.egg\selenium\webdriver\firefox\extension_connection.py", line 49, in __init__
self.binary.launch_browser(self.profile)
File "D:\Python\Python35\lib\site-packages\selenium-2.50.0-py3.5.egg\selenium\webdriver\firefox\firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable()
File "D:\Python\Python35\lib\site-packages\selenium-2.50.0-py3.5.egg\selenium\webdriver\firefox\firefox_binary.py", line 106, in _wait_until_connectable
% (self.profile.path))
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: C:\Users\Gauss\AppData\Local\Temp\tmpkpjhnhpb If you specified a log_file in the FirefoxBinary constructor, check it for details.
可能有人請提出一個解決這個問題已收到?
注意:這個問題出現在我的辦公室電腦上,同樣的代碼在我的家用電腦上工作正常。所以Firefox的一些問題也許。
可能的重複:http://stackoverflow.com/q/6682009/954442 –
這篇文章提到,問題修復後的版本2.26,但我使用2.50仍然面臨這個問題,我正在使用Windows 10和Firefox版本是44.0 – Gauss