1

I using webdriver-manager 3.8.4 Compatible with Selenium 4.5

the goal is :

1.set the directory where we want to download and save the webdriver

2.Specify the version of webdriver

Download a specific webdriver version using Webdriver-manager: the needed : version="94.0.4606.113" with path ="C:\webDriverDesktop" electronApp

Traceback (most recent call last):
  File "C:\Users\balloumn\NotSync\Myscript\CS\WEB_D\V1.py", line 44, in <module>
    chrome = webdriver.Chrome(service=Service(ChromeDriverManager(version="94.0.4606.113", path ="C:\\webDriverDesktop" ,cache_valid_range=1,download_manager=download_manager).install()),options=opt) # ok
  File "C:\Users\balloumn\AppData\Local\Programs\Python\Python310\lib\site-packages\webdriver_manager\chrome.py", line 39, in install
    driver_path = self._get_driver_path(self.driver)
  File "C:\Users\balloumn\AppData\Local\Programs\Python\Python310\lib\site-packages\webdriver_manager\core\manager.py", line 31, in _get_driver_path
    binary_path = self.driver_cache.save_file_to_cache(driver, file)
  File "C:\Users\balloumn\AppData\Local\Programs\Python\Python310\lib\site-packages\webdriver_manager\core\driver_cache.py", line 46, in save_file_to_cache
    files = archive.unpack(path)
  File "C:\Users\balloumn\AppData\Local\Programs\Python\Python310\lib\site-packages\webdriver_manager\core\archive.py", line 30, in unpack
    return self.__extract_zip(directory)
  File "C:\Users\balloumn\AppData\Local\Programs\Python\Python310\lib\site-packages\webdriver_manager\core\archive.py", line 37, in __extract_zip
    archive = zip_class(self.file_path)
  File "C:\Users\balloumn\AppData\Local\Programs\Python\Python310\lib\zipfile.py", line 1267, in __init__
    self._RealGetContents()
  File "C:\Users\balloumn\AppData\Local\Programs\Python\Python310\lib\zipfile.py", line 1334, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
os.environ['WDM_SSL_VERIFY'] = '0'
capabilities = webdriver.DesiredCapabilities.CHROME
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

PROXY = "https://Login:psw@appxxxx:port"
opt = webdriver.ChromeOptions()
opt.add_argument('--proxy-server=%s' % PROXY)
opt.add_argument("ignore-certificate-errors")

class CustomHttpClient(HttpClient):
    def get(self, url, params=None) -> Response:
        proxies={'http': "https://Login:psw@appxxxx:port",
         'https': "https://Login:psw@appxxxx:port",
         }
        return requests.get(url, params,proxies=proxies,verify=False)

http_client = CustomHttpClient()
download_manager = WDMDownloadManager(http_client)

chrome = webdriver.Chrome(service=Service(ChromeDriverManager(version="94.0.4606.113", path ="C:\\webDriverDesktop" ,cache_valid_range=1,download_manager=download_manager).install()),options=opt) 
time.sleep(5)
chrome.close()

0 Answers0