SJD_Dream 2015-12-11 04:26 采纳率: 0%
浏览 7259

python+selenium无法用firefox加载网页

最近在学习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

  • 写回答

4条回答 默认 最新

  • oyljerry 2015-12-11 04:58
    关注

    你的firefox的profile是否有问题。

    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记