I had similar problems on a Raspberry B+ with Stretch.
I could solve the issues by
- creating a symlink named 'google-chrome' pointing to '/usr/lib/chromium-browser/chromium-browser'
- replacing "driver." in the python-code with "browser." as example below:
from selenium import webdriver
from selenium.webdriver import Chrome
from selenium.webdriver.common.by import B
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
usernameStr = 'abcdef'
passwordStr = 'uvwzyx'
findStr1 = 'Welcome abcdef!'
findStr2 = 'Password'
driver = '/usr/lib/chromium-browser/chromedriver'
chrome_options = Options()
chrome_options.binary_location = "/usr/lib/chromium-browser/chromium-browser"
browser = webdriver.Chrome(chrome_options=chrome_options)
delay = 5
for element in browser.find_elements_by_xpath("//*[contains(text(), findStr1)]"):
et = element.text
if et == findStr1:
print ("already connected")
print ("not connected yet")
In case I would replace 'browser' with 'driver' I would get tons of errors. I was close to give up because elsewhere I found statements, that selenium dos not support raspberry resp chromium-browser anymore.
I am using a script to auto-connect after boot to the wifi network in my apartment. The lines above are the first commands.
In case of 'connection' (that happens sometimes) the script stops.
In case of 'no connection' the login-form is being filled and submitted by further code, which is not displayed here.
Not 100% your question but you might give this a try.