码迷,mamicode.com
首页 > 编程语言 > 详细

Selenium + Python + Firefox

时间:2014-05-07 21:16:57      阅读:420      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   code   tar   ext   

按网上教程搭建好环境后,执行下面的代码出现了错误:

测试代码如下:

1
2
3
from selenium import webdriver
driver=webdriver.Firefox()
driver.get("http://www.baidu.com")

错误信息如下:

Traceback (most recent call last):
File "D:\pcode\24.py", line 2, in <module>
driver=webdriver.Firefox()
File "D:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py",
line 59, in __init__
self.binary, timeout),
File "D:\Python27\lib\site-packages\selenium\webdriver\firefox\extension_conne
ction.py", line 47, in __init__
self.binary.launch_browser(self.profile)
File "D:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.
py", line 61, in launch_browser
self._wait_until_connectable()
File "D:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.
py", line 105, in _wait_until_connectable
self.profile.path, self._get_firefox_output()))
selenium.common.exceptions.WebDriverException: Message: "Can‘t load the profile.
Profile Dir: c:\\users\\admin\\appdata\\local\\temp\\tmp5jpwrx Firefox output
: *** LOG addons.xpi: startup\r\n*** WARN addons.xpi: Ignoring missing add-on in

解决办法:卸载28版本的Firefox,安装24版本的

网上其他人推荐的办法:pip install -U selenium

Selenium + Python + Firefox,布布扣,bubuko.com

Selenium + Python + Firefox

标签:style   blog   class   code   tar   ext   

原文地址:http://www.cnblogs.com/xiaobaichuangtianxia/p/3714076.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!