无法在mac中使用python启动硒 [英] Unable to launch selenium with python in mac

查看:204
本文介绍了无法在mac中使用python启动硒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



$ b b

$ b p>我的示例代码

 从selenium import webdriver 
driver = webdriver.Firefox()
驱动程序。 get(https://www.formsite.com/)
driver.maximize_window()
driver.close()

使用PIP安装的硒

  pip install selenium 
下载/拆包selenium
下载selenium-2.44.0.tar.gz(2.6MB):2.6MB下载
运行setup.py(path:/ private / var / folders / qw / ctlmndfd5ts9w2p6v1qc382r0000gn / T / pip_build_bhanusaa / selenium /setup.py)egg_info for package selenium

安装收集的软件包:selenium
运行setup.py install for selenium

成功安装selenium

分配的 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site Python路径库$ b $中的packages b



获取以下错误

 追溯(最近最近通话):
文件/ Users / bhanusaa / Desktop /samp/src/scripts/new.py,第3行,位于< module>
driver = webdriver.Firefox()
文件/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py ,第59行,__init__
self.binary,timeout),
文件/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/ firefox / extension_connection.py,第47行,__init__
self.binary.launch_browser(self.profile)
文件/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/selenium/webdriver/firefox/firefox_binary.py,第65行,在launch_browser
self._start_from_profile_path(self.profile.path)
文件/Library/Frameworks/Python.framework/版本/ 2.7 / lib / python2.7 / site-packages / selenium / webdriver / firefox / firefox_binary.py,第88行,在_start_from_profile_path
env = self._firefox_env).communicate()
文件 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py,第711行,__in it__
errread,errwrite)
文件/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py,第1308行,在_execute_child
raise child_exception
OSError:[Errno 2]没有这样的文件或目录


解决方案

HI现在解决了问题,以前我在Mac中安装了Firefox 34.0,现在降级到30.0,现在它正常工作。


I'm facing an issue with selenium with python in Mac OS.. Python 2.7 pydev 3.0

My sample code

from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://www.formsite.com/")
driver.maximize_window()
driver.close()

Installed selenium using PIP

pip install selenium
Downloading/unpacking selenium
  Downloading selenium-2.44.0.tar.gz (2.6MB): 2.6MB downloaded
  Running setup.py (path:/private/var/folders/qw/ctlmndfd5ts9w2p6v1qc382r0000gn/T/pip_build_bhanusaa/selenium/setup.py) egg_info for package selenium

Installing collected packages: selenium
  Running setup.py install for selenium

Successfully installed selenium

Assigned /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages in Python Path library

getting below error

Traceback (most recent call last):
  File "/Users/bhanusaa/Desktop/samp/src/scripts/new.py", line 3, in <module>
    driver = webdriver.Firefox()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
    self.binary, timeout),
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 65, in launch_browser
    self._start_from_profile_path(self.profile.path)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 88, in _start_from_profile_path
    env=self._firefox_env).communicate()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

解决方案

HI the issue is resolved now, previously i had installed Firefox 34.0 in my Mac and now downgraded to 30.0, now it is working fine.

这篇关于无法在mac中使用python启动硒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆