Skip to content
Sign upLog in
← Back to Community

Driver is unable to open chrome using selenium webdriver

Profile icon
RamnathSaigal

This is my code

import selenium
from selenium import webdriver
driver=webdriver.Chrome(executable_path=r"C:\Users\ramnath.kumar\Desktop\chromedriver")
driver.get("https://test.salesforce.com")

Voters
Profile icon
montresowy
Profile icon
RamnathSaigal
Comments
hotnewtop
Profile icon
paradox091201

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://test.salesforce.com")

Profile icon
jabooticaba

@paradox091201

Thank you, kind sir!

Profile icon
RamnathSaigal

I AM GETTING THIS AS ERROR:

Traceback (most recent call last):
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/local/lib/python3.7/subprocess.py", line 775, in init
restore_signals, start_new_session)
File "/usr/local/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\ramnath.kumar\Desktop\chromedriver': 'C:\Users\ramnath.kumar\Desktop\chromedriver'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/selenium/webdriver/common/s
ervice.py", line 76, in start
stdin=PIPE) File "/usr/local/lib/python3.7/subprocess.py", line 775, in init
restore_signals, start_new_session)
File "/usr/local/lib/python3.7/subprocess.py", line 1522, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\ramnath.kumar\Desktop\chromedriver': 'C
:\Users\ramnath.kumar\Desktop\chromedriver'
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 3, in
driver=webdriver.Chrome(executable_path=r"C:\Users\ramnath.kumar\Desktop\chromedriver")
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in init
self.service.start()
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'C:\Users\ramnath.kumar\Desktop\chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Profile icon
ttarabay
Profile icon
RITHIKKATHAIT

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://www.youtube.com/feed/trending")

Please can anybody provide me the solution to this.

Profile icon
RITHIKKATHAIT

image


Screenshot (2447)

Profile icon
eco27

well because repl is run on a vm (virtual machine) not your computer, the path to the driver isn't C:\Users\ramnath.kumar\Desktop\chromedriver. you can do some bash commands in a .replit file to figure out what the correct path is and install the driver.

Profile icon
lcardot

@MrEconomical
Hi, I know its been a while since your post. If your still alive, how would you go about doing this? I'm having an issue finding the correct path because of replit's nature. Thanks

Profile icon
eco27

@lcardot
you need to install chromedriver onto the repl

Profile icon
sethbowers97

@MrEconomical
how do you install the chromedriver onto the repl? I saved chromedriver.exe onto my desktop and uploaded it to my repl project. Is this not sufficient?

Profile icon
ttarabay

@sethbowers97
did u get an answer?

Profile icon
BishoyHany

@MrEconomical
how to install it?