Grzyboo
Posts: 2
Joined: Tue Sep 12, 2017 10:33 pm

Selenium WebDriver

Wed Sep 13, 2017 1:21 am

Too long, didn't read: I want Selenium to work on my Raspberry Pi with Java(Trying on Python atm though, because it's more popular here). However, none of the drivers seem to work.

Hello,
First I tried using ChromeDriver, but I've read somewhere that it doesn't support ARM architecture. I was getting error:
/home/pi/Desktop/selenium/chomedriver: Syntax error: word unexpected (expecting ")")
Nothing seemed to work, so I gave up.

I tried using Firefox instead. Found some instructions for Python, so I wanted it to run with Python first and then I would try to make it work for Java. However, something is wrong as well. This is what I have done so far:
1. Used these commands:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install iceweasel
sudo apt-get install xvfb
sudo pip install selenium
sudo pip install PyVirtualDisplay
sudo pip install xvfbwrapper

2. Used this python script:
from pyvirtualdisplay import Display
from selenium import webdriver

display = Display(visible=0, size=(1024, 768))
display.start()

driver = webdriver.Firefox()
driver.get('http://raspberrypi.stackexchange.com/')
driver.quit()

display.stop()

3. I've downloaded geckodriver from here: https://github.com/mozilla/geckodriver/releases
File: geckodriver-v0.18.0-arm7hf.tar.gz
Extracted it into /usr/local/bin/geckodriver

However, when running the code above I get this:
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: Unable to find a matching set of capabilities

I googled it and found some answers about updating everything: Firefox, selenium, gecko

My versions are:
Python 2.7.9
Geckodriver 0.18.0
Firefox 45.9.0
Selenium - i don't know how to check it, but it should be fine when I just installed it, right?

Things seem to be up to date. Anything else you could suggest? I want Selenium to run so badly :(

Grzyboo
Posts: 2
Joined: Tue Sep 12, 2017 10:33 pm

Re: Selenium WebDriver

Thu Sep 14, 2017 3:54 pm

Solved. Had to update firefox. However, I couldn't find a way of updating iceweasel to version 53.

If anyone has the same problem:
I used this site: https://mozilla.debian.net/
selected: I am running Debian oldstable(Jessie) and I want to install Firefox version esr52
And followed the instructions

R98
Posts: 1
Joined: Tue Dec 26, 2017 12:04 am

Re: Selenium WebDriver

Tue Dec 26, 2017 12:10 am

I tried it with iceweasel and firefox-esr but I always get this error:

Code: Select all

Traceback (most recent call last):
  File "test.py", line 9, in <module>
    browser = webdriver.Firefox()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 158, in __init__
    keep_alive=True)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 311, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
after running this python script

Code: Select all

from selenium import webdriver
from pyvirtualdisplay import Display

#create virtual display
display = Display(visible=0, size=(800, 600))
display.start()

# make a firefox-instance
browser = webdriver.Firefox()

#open url
browser.get('https://www.facebook.de')

print (browser.title)
browser.close()
display.stop()
exit(0)

Does anybody has an idea how to solve it or what I could have wrong?

Return to “Python”

Who is online

Users browsing this forum: elParaguayo, tmratwork and 19 guests