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 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机