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