鱼C论坛

 找回密码
 立即注册
查看: 2536|回复: 3

python2.7+selenium3.5搭建环境时报错

[复制链接]
发表于 2017-8-27 19:34:45 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
求助!在MAC上安装了pycharm,也安装了selenium3.5 在执行
from selenium import webdriver
import time
dr = webdriver.Firefox()
dr.get('http://baidu.com')
time.sleep(5)
print 'Broswer will be closed'
dr.quit()
print 'Broswer is close'
这段代码的时候,连续碰雷

  1. /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/chewenting/PycharmProjects/test/test-pip.py
  2. Traceback (most recent call last):
  3.   File "/Users/chewenting/PycharmProjects/test/test-pip.py", line 3, in <module>
  4.     dr = webdriver.Firefox()
  5.   File "/Library/Python/2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 154, in __init__
  6.     keep_alive=True)
  7.   File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 140, in __init__
  8.     self.start_session(desired_capabilities, browser_profile)
  9.   File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 229, in start_session
  10.     response = self.execute(Command.NEW_SESSION, parameters)
  11.   File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 297, in execute
  12.     self.error_handler.check_response(response)
  13.   File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
  14.     raise exception_class(message, screen, stacktrace)
  15. selenium.common.exceptions.WebDriverException: Message: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line


  16. Process finished with exit code 1
复制代码


求大神解答,要哭了!
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2017-8-27 22:21:30 | 显示全部楼层
下载火狐驱动了吗,下了的话没把驱动加到环境变量里吧,需要制定路径
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-8-29 22:11:34 | 显示全部楼层
小锟 发表于 2017-8-27 22:21
下载火狐驱动了吗,下了的话没把驱动加到环境变量里吧,需要制定路径

我应该在哪里添加呢?MAC的环境变量在哪里添加呀?
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-8-29 23:02:24 | 显示全部楼层
不好意思啊,你这个是找不到火狐浏览器在哪,尴尬,我没用过mac
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-12-23 11:35

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表