Search code examples
pythonseleniumselenium-chromedriverundetected-chromedriver

Chromedriver not getting detected in python


I am Trying to run a selenium script but it is not able to detect the chromedriver can anyone please help me on this when i try to run it it gives me an error stating that chromedriver is not present in the specific path however i have downloaded and kept it on the specific path below is the snap and code for reference. enter image description here

booking.py

import booking.constants as const
from selenium import webdriver


class Booking(webdriver.Chrome):
    def __init__(self , driver_path = "C:\\chromedriver.exe"):
        self.driver_path = driver_path
        super(Booking, self).__init__()

    
    def land_first_page(self):
        self.get(const.BASE_URL)

run.py //running this pythonfile in my editor

from booking.booking import Booking

inst = Booking()
inst.land_first_page()

Solution

  • Copy your chromedriver.exe file to a folder in your current path, to display your current path you can use:

    import sys
    print(sys.path)
    

    Be sure to use the same chromedriver's version as your browser

    https://chromedriver.chromium.org/downloads