首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >雪豹身上的硒和Python

雪豹身上的硒和Python
EN

Stack Overflow用户
提问于 2011-11-30 23:45:54
回答 2查看 2.4K关注 0票数 5

我正在尝试在Selenium雪豹上使用股票Python (2.6.1)。作为Python的新手,我对自己做错了什么感到有些不知所措,因为这个完全相同的过程在我的ubuntu盒上运行得很好:

selenium

  • Create
  1. sudo easy_install -U WebDriver是一个带有Firefox的简单测试,并将其导出为Python (作为mytest.py)
  2. $ pythonmytest.py(结果是:

)

此错误消息:

代码语言:javascript
运行
复制
E

======================================================================
ERROR: test_mytest_py (__main__.MytestPy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "mytest.py", line 8, in setUp
    self.driver = webdriver.Firefox()
  File "/Library/Python/2.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 45, in __init__
    self.binary, timeout),
  File "/Library/Python/2.6/site-packages/selenium/webdriver/firefox/extension_connection.py", line 46, in __init__
    self.binary.launch_browser(self.profile)
  File "/Library/Python/2.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 41, in launch_browser
    self._start_from_profile_path(self.profile.path)
  File "/Library/Python/2.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 66, in _start_from_profile_path
    Popen([self._start_cmd, "-silent"], stdout=PIPE, stderr=PIPE).wait()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 595, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1106, in _execute_child
OSError: [Errno 2] No such file or directory

----------------------------------------------------------------------
Ran 1 test in 0.302s

FAILED (errors=1)

值得注意的是,当我运行"sudo easy_install -U selenium“时,我确实收到了警告:

代码语言:javascript
运行
复制
$ sudo easy_install -U selenium
Searching for selenium
Reading http://pypi.python.org/simple/selenium/
Reading http://www.openqa.org/
Reading http://code.google.com/p/selenium/
Reading http://seleniumhq.org/
Best match: selenium 2.14.0
Downloading http://pypi.python.org/packages/source/s/selenium/selenium-2.14.0.tar.gz#md5=8de9ee26d699d699f846f14f9a184e60
Processing selenium-2.14.0.tar.gz
Running selenium-2.14.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-yQVlpa/selenium-2.14.0/egg-dist-tmp-svoAjf
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'src_root'
warning: no files found matching 'docs/api/py/index.rst'
Adding selenium 2.14.0 to easy-install.pth file

Installed /Library/Python/2.6/site-packages/selenium-2.14.0-py2.6.egg
Processing dependencies for selenium
Finished processing dependencies for selenium
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-12-01 12:57:20

首先检查Firefox二进制位置。它放在这里吗: /Applications/Firefox.app/Contents/MacOS/firefox?

有关更多信息,请查看以下页面:http://code.google.com/p/selenium/wiki/FirefoxDriver

票数 7
EN

Stack Overflow用户

发布于 2011-12-01 01:27:56

我对Selenium一无所知,但是跟踪显示它没有一个通往Firefox的可用路径。

您需要更改它的配置/配置文件,以便为它提供通往Firefox可执行版本的路径。

目前的配置文件可能在linux机器上有Firefox的默认位置(因此它在Ubuntu上工作)。但它不会在OSX上的这个位置。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8334706

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档