Here I like to give a simple run-down to install all requirements to make Selenium available on a Raspi. Basically, we install first Firefox, then Geckodriver and finally Selenium and we are ready to go.
Before start, better to note that ChromeDriver does not support ARM processors anymore, therefore it is not possible to use Chromium with Selenium on Raspberry.
First, install system requirements. Update the system, install Firefox and xvfb (display server implementing X11);
sudo apt-get update
sudo apt-get install iceweasel
sudo apt-get install xvfb
Then, install python requirements. Selenium, PyVirtualDisplay that you can use for running Selenium with hidden browser display and xvfbwrapper.
sudo pip install selenium
sudo pip install PyVirtualDisplay
sudo pip install xvfbwrapper
Hope everything run well and now you can test the installation.
from pyvirtualdisplay import Display
from selenium import webdriver
display = Display(visible=0, size=(1024, 768))
driver = webdriver.Firefox()