Authenticate proxy in Python Selenium (zscalar)

640 Views Asked by At

I am trying to launch a url using selenium and python.
Without logging into zscalar proxy I get "This site can’t be reached" on the browser.
The browser does launch.

I am able to authenticate using python requests, but I am not able to get the syntax right for selenium. Here is the code, it does not work.

proxyList =['http://onlineuser:[email protected]:10077']

chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument('--proxy-server={}'.format(random.choice(proxyList)))
driver = webdriver.Chrome(executable_path="chromedriver.exe", chrome_options=chromeOptions)
driver.get("https://somewebsite.com")

But the following code works fine (python requests)

proxy_data = {'http': 'http://onlineuser:[email protected]:10077',
              'https': 'http://onlineuser:[email protected]:10077'}

    response = requests.post(url, headers=headers, data=payload_limited, proxies=proxy_data)
0

There are 0 best solutions below