【问题标题】:selenium causes windows error硒导致Windows错误
【发布时间】:2013-08-03 19:31:39
【问题描述】:

我对 selenium 很陌生,我正在使用它的 python 包。因此,当我复制并运行在其文档页面上找到的代码时:http://selenium.googlecode.com/svn/trunk/docs/api/py/index.html,我收到以下错误:

from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
browser = webdriver.Firefox()

Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
browser = webdriver.Firefox()
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 61, in __init__
self.binary, timeout),
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 47, in __init__
self.binary.launch_browser(self.profile)
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 50, in launch_browser
self._start_from_profile_path(self.profile.path)
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 73, in _start_from_profile_path
env=self._firefox_env).communicate()
File "C:\Python27\lib\subprocess.py", line 679, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 893, in _execute_child
startupinfo)
WindowsError: [Error 87] The parameter is incorrect

我按照其他文档:http://selenium-python.readthedocs.org/en/latest/installation.html#downloading-python-bindings-for-selenium 安装 selenium。

起初,当我运行 virtualenv.py 文件时,输出会说 setuptools*.tar.gz, pip.*.tar.gz not found,所以我下载了这两个 tar 文件并将它们放在 seltests 文件夹中,然后是终端没有抱怨了。所以安装应该是成功的。任何帮助表示赞赏!我正在使用 Windows 7、64 位。

【问题讨论】:

    标签: python windows selenium


    【解决方案1】:

    我今天早上遇到了这个问题,问题是 selenium 找不到 firefox.exe 的路径。

    尝试将其添加到您的系统 PATH 中,或者您可以在测试脚本中对路径进行硬编码。见

    Python selenium error when trying to launch firefox

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-24
      • 2021-01-18
      • 1970-01-01
      • 2014-01-04
      • 1970-01-01
      • 1970-01-01
      • 2012-07-09
      • 2016-08-24
      相关资源
      最近更新 更多