我正在尝试通过查看here来安装python-selenium绑定
当我尝试导入以下命令时,它在下面显示错误
from selenium.firefox.webdriver import WebDriver
结果:
from selenium.firefox.webdriver import WebDriver
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named firefox.webdriver
我搜索了很多来解决这个问题,但我没有得到正确的例子来做到这一点,谁能给我一个方法和一个例子来说明如何安装 python selenium 绑定以及为什么返回上述错误。
提前致谢..........
编辑: 我根据以下答案编辑我的代码,并尝试了以下,我得到了以下
>>> from selenium import webdriver
>>> driver = webdriver.Firefox()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/selenium-2.21.3-py2.7.egg/selenium/webdriver/firefox/webdriver.py", line 51, in __init__
self.binary, timeout),
File "/usr/lib/python2.7/site-packages/selenium-2.21.3-py2.7.egg/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
self.binary.launch_browser(self.profile)
File "/usr/lib/python2.7/site-packages/selenium-2.21.3-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 44, in launch_browser
self._wait_until_connectable()
File "/usr/lib/python2.7/site-packages/selenium-2.21.3-py2.7.egg/selenium/webdriver/firefox/firefox_binary.py", line 81, in _wait_until_connectable
self._get_firefox_output())
selenium.common.exceptions.WebDriverException: Message: 'The browser appears to have exited before we could connect. The output was: *** LOG addons.xpi: startup\n*** LOG addons.xpi: checkForChanges\n*** LOG addons.xpi: Opening database\n*** LOG addons.xpi: No changes found\nFailed to dlopen /usr/lib/libX11.so.6\ndlerror says: /usr/lib/libX11.so.6: wrong ELF class: ELFCLASS32\n'
并且还说有some crash in firefox 1.0....