pythonselenium-webdriverchrome-web-driver

I cant install ChromeDriverManager with ChromeDriverManager().install()


I've been learning Python for 2 month, and this error has never occurred to me once but all of a sudden I can't download CHROMEDRIVERMANAGER and whenever I get to its website to download it manually it says This XML file does not appear to have any style information. The document tree is shown below. The error: ` Access Denied Access denied.

We're sorry, but this service is not available in your location

This XML file does not appear to have any style information associated with it. The document tree is shown below.

Access denied Access denied. We're sorry, but this service is not available in your location

` this is the error that I am getting trying to download CHROMEDRIVER I believe its because my code requests to download CHROMEDRIVER the error pops up the same one that pops up when I try to download it My code

import selenium.webdriver.chrome.webdriver
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
import pyautogui
from webdriver_manager.chrome import ChromeDriverManager
import random
import numpy as np
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By

options = Options()
options.add_experimental_option("detach", True)
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()),
options=options)
driver.get("https://www.pinterest.com/ideas/")

apparently, something is wrong with the line where I said what is the driver


Solution

  • Change the below line from:

    driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()),
    options=options)
    

    TO:

    driver = webdriver.Chrome(service=Service(ChromeDriverManager(version="114.0.5735.90").install()),options=options)
    

    Above should solve your issue. Having said that, with latest selenium(v4.6.0 or above), you don't really need ChromeDriverManager to download/handle browser drivers. Selenium's new tool known as SeleniumManager will do what ChromeDriverManager used to do. So the code now can be simplified as below:

    options = Options()
    options.add_experimental_option("detach", True)
    driver = webdriver.Chrome(options=options)
    driver.get("https://www.pinterest.com/ideas/")
    

    References - Introducing Selenium Manager