-->

Need headless browser for Armv7 linux processor

2019-08-19 16:40发布

问题:

I need a headless browser for webscraping.Recently i tried 3 different headless browsers(PhantomJS,Firefox,Chrome).

When using phantomJS, it gives some error (i.e):Armv7 processor needs GUI.

then,am using Firefox with geckodriver, it shows errors in the path and connection refused.

so that i moved to chrome headless browser with chromedriver,but it also shows same errors as Firefox.

So,I need a correct headless browser for Armv7 processor. Can anyone suggest solution for that or any other way to proceed further.

回答1:

Installing lower version of selenium fixed my issue in a similar case.

pip install selenium==2.53.5


回答2:

Try the below procedure it worked for me.

geckodriver v0.19.0 the following versions are recommended:

Firefox 55.0 (and greater) Selenium 3.5 (and greater)

Download the geckodriver from https://github.com/mozilla/geckodriver/releases. After downloading, extract it and make it executable(in linux chmod +x path/to/geckdriver).

from selenium import webdriver

geckoPath = 'path/to/geckodriver'
browser = webdriver.Firefox(executable_path=geckoPath)
browser.get('http://stackoverflow.com')
body_html = driver.find_element_by_xpath("/html/body")
print body_html.text