Selenium Driver Python

Question:
I have the following code and I keep getting the following error message for line ‘‘driver = wedriver.Chrome(options = chrome_options)’’:

‘‘Traceback (most recent call last):
File “main.py”, line 8, in
driver = webdriver.Chrome(options=chrome_options)
’’

Repl link:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')

driver = webdriver.Chrome(options=chrome_options)
driver.get("https://google.com")
1 Like

Did you check if your replit.nix file have the packages installed? Check the deps session and see if pkgs.chromium & pkgs.chromedriver are installed.

Also, add chrome_options.add_argument('--headless') to your chrome_options too.

2 Likes

Thanks. It didn’t have those two pkgs in deps session.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.