我已经在我的centos6.4服务器上安装了firefox和Xvfb来使用selenium webdriver.
但是,当我运行代码时,我收到了一个错误.
from selenium import webdriver
browser = webdriver.Firefox()
Run Code Online (Sandbox Code Playgroud)
错误
selenium.common.exceptions.WebDriverException: Message:
'The browser appears to have exited before we could connect. The output was: None'
Run Code Online (Sandbox Code Playgroud)
我在stackoverflow上读了一些相关的页面,有人建议删除tmp文件夹中的所有文件,所以我做到了.但是,它仍然无效.
有人可以帮我一个忙吗?
先感谢您!
编辑
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
self.binary, timeout),
File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
self.binary.launch_browser(self.profile)
File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 64, in launch_browser
self._wait_until_connectable()
File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 103, in _wait_until_connectable
self._get_firefox_output())
selenium.common.exceptions.WebDriverException: Message: 'The browser appears to have exited before …Run Code Online (Sandbox Code Playgroud) 我试图使用python中的selenium用javascript抓取一些动态页面.但是,在我按照pypi页面上的selenium指令(http://pypi.python.org/pypi/selenium)后,我无法调用firefox.我在AWS ubuntu 12.04上安装了firefox.我得到的错误信息是:
In [1]: from selenium import webdriver
In [2]: br = webdriver.Firefox()
---------------------------------------------------------------------------
WebDriverException Traceback (most recent call last)
/home/ubuntu/<ipython-input-2-d6a5d754ea44> in <module>()
----> 1 br = webdriver.Firefox()
/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.pyc in __init__(self, firefox_profile, firefox_binary, timeout)
49 RemoteWebDriver.__init__(self,
50 command_executor=ExtensionConnection("127.0.0.1", self.profile,
---> 51 self.binary, timeout),
52 desired_capabilities=DesiredCapabilities.FIREFOX)
53
/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/extension_connection.pyc in __init__(self, host, firefox_profile, firefox_binary, timeout)
45 self.profile.add_extension()
46
---> 47 self.binary.launch_browser(self.profile)
48 _URL = "http://%s:%d/hub" % (HOST, PORT)
49 RemoteConnection.__init__(
/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.pyc in launch_browser(self, profile)
42
43 self._start_from_profile_path(self.profile.path)
---> 44 self._wait_until_connectable()
45 …Run Code Online (Sandbox Code Playgroud) python selenium screen-scraping amazon-web-services web-scraping
当我想使用时,我得到了这个例外 FireFox webdriver
引发WebDriverException"浏览器似乎已退出"WebDriverException:消息:在我们连接之前,浏览器似乎已退出.如果在FirefoxBinary构造函数中指定了log_file,请检查它是否有详细信息.
我的代码:
driver = webdriver.Firefox()
time.sleep(5)
driver.get('http://www.example.com')
Run Code Online (Sandbox Code Playgroud)
UPDATE
我读了这个问题
现在我有这个错误
OSError: [Errno 20] Not a directory
Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x407a690>> ignored
Run Code Online (Sandbox Code Playgroud)