No code runs after defining webdriver in Selenium

Question:

Consider:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

options = Options()
options.add_argument("start-maximized")
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)

print("Hello, World!")

I am running Python 3.10 on Linux Ubuntu.

I was trying to play around with Selenium. However, any code that I write after defining the webdriver does not work.

It seems that the interpreter gets stuck after defining the webdriver. It opens the webdriver, but it only shows "data:," and nothing else and won’t respond to any code written after.

Asked By: Ilan Kayesar

||

Answers:

I figured out the problem. I only had Chromium installed on my computer and I assumed that the Chromium drivers and the Chrome drivers are the same thing (I still can’t find any reference to the Chromium drivers).

Answered By: Ilan Kayesar

Chromium support is limited on Selenium in my experience.

Please look at the replies to this Stack Overflow question which do mention chromium-driver and how to get it.

 sudo apt-get install chromium-chromedriver

Should get you the Chromium driver, and they have some example code there that doesn’t look too outdated.

Answered By: dot