selenium web driver chrome Doesent want to Work

Viewed 31

I was Trying To Learn selenium python But it says when i run the file it has wrong premessions and my chrome version is(105.0.5195.102) and when i was trying to find a web driver i did`t find the same web driver so i installed something other than it edit i have unziped the wbe driver now the code is

enter code here
from selenium import webdriver
Path = "/home/ammar/Downloads/chromedriver"
driver = webdriver.Chrome(Path)

driver.get("https://techwithtim.net")

and here is the new output

DeprecationWarning: executable_path has been deprecated, please pass in a Service object driver = webdriver.Chrome(Path)

so if its something related to my web driver i can`t find the same version as mine so if anyone knows where i can find the same web driver tell me

1 Answers

Try this:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

options = webdriver.ChromeOptions()
# the detach option is required otherway chrome get closed after a short time
options.add_experimental_option("detach", True)
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
driver.get("https://techwithtim.net")
Related