Ask coding questions

← Back to all posts
Driver is unable to open chrome using selenium webdriver
RamnathSaigal (0)

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")

Comments
hotnewtop
paradox091201 (0)

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")

AdCharity (1322)

Interesting. Unless I stand corrected, selenium is still not supported by repl. https://repl.it/bugs/p/python-3-selenium is the bug forum, yet no one seems to address it...

MrEconomical (2296)

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.

lcardot (0)

@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

MrEconomical (2296)

@lcardot you need to install chromedriver onto the repl

RamnathSaigal (0)

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 <module>
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