2016-02-01 180 views
-1
硒蟒蛇

我是新来硒和我按照网站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的一些问题也许。

+0

可能的重复:http://stackoverflow.com/q/6682009/954442 –

+0

这篇文章提到,问题修复后的版本2.26,但我使用2.50仍然面临这个问题,我正在使用Windows 10和Firefox版本是44.0 – Gauss

回答

0

根据你的意见,它看起来像你的Firefox的版本,由Python驱动程序is not yet supported。目前他们支持第38节,你有44.

+0

我的家用电脑也有Firefox版本44和Selenium 2.50,但它的工作正常。问题似乎在我的办公室电脑上。 – Gauss