Home > Software design >  Chromedriver not getting detected in python
Chromedriver not getting detected in python

Time:11-01

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

CodePudding user response:

Try to insert the whole direction path of where the chromedriver is located, also don't forget to use double slash, "C:\Users\desktop\..." the whole path.

EDIT go and look for the version you are using of google chrome, then check the version of your chromedriver, if they are not the same that's the error, try to install the same chromedriver version of your google chrome version

CodePudding user response:

Copy Chromedriver.exe file and Paste your CODE directory

Then

import booking.constants as const
from selenium import webdriver

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


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

Looks Like. chromedriver.exe file must be same directory where your script file present

CodePudding user response:

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

  • Related