相关疑难解决方法(0)

无法在AWS机器上的python中从selenium调用firefox

我试图使用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

28
推荐指数
1
解决办法
2万
查看次数

Linux上的Chromedriver错误

格式化Redhat服务器(亚马逊风格的Linux)并重新安装python,selenium,pyvirtualdisplay,Xvfb,Chrome和Chromedriver之后,我遇到了一个错误: selenium.common.exceptions.WebDriverException: Message: Service /usr/bin/chromedriver unexpectedly exited. Status code was: 127

初始化浏览器/驱动程序时出现此错误: driver = webdriver.Chrome(executable_path="/usr/bin/chromedriver")

我正在使用Richard Lloyd的Chrome和Chromedriver 2.9.我认为这个问题源于Chromedriver的依赖性问题.

任何帮助将不胜感激.现在已经挣扎了一段时间.

python linux selenium google-chrome selenium-chromedriver

7
推荐指数
1
解决办法
3408
查看次数

适用于GAE的Python Headless浏览器

我正在尝试将Angular.js客户端与Google Appengine上的webapp2一起使用。

为了解决SEO问题,该想法是使用无头浏览器运行javascript服务器端并将生成的html提供给搜寻器。

是否有在Google App Engine上运行的python无头浏览器?

python google-app-engine headless-browser

6
推荐指数
1
解决办法
1309
查看次数

如何修复WebDriverException:在我们连接之前,浏览器似乎已经退出了?

在我的Linux系统中,我使用Firefox,执行我的程序,我的错误是:

Traceback (most recent call last):

File "shenma_diff_main_v2.py", line 90, in <module>
    browser = webdriver.Firefox(profile)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
    self.binary, timeout),
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 66, in launch_browser
    self._wait_until_connectable()
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 100, in _wait_until_connectable
    raise WebDriverException("The browser appears to have exited "
selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.
Run Code Online (Sandbox Code Playgroud)

如果我使用root执行我的程序就可以了.

python selenium python-2.7

4
推荐指数
1
解决办法
2万
查看次数