Geosurf Proxy server and user authentication in undetected chromedriver

51 views Asked by At

I am trying to authenticate the geosurf proxy locally since undetected chromedriver does have any pop-up / window (when the browser is opened) to fill up the username and password manually.

Here's my code :

import time
import urllib.request as req
import os
import undetected_chromedriver as uc

if __name__ == '__main__':
    print(req.getproxies())
    os.environ['http_proxy'] = "http://username:password@proxy-server:port"
    os.environ['https_proxy'] = "http://username:password@proxy-server:port"

    options = uc.ChromeOptions()
    options.headless = False
    options.add_argument('--proxy-server=proxy-server:port')
    driver = uc.Chrome(options=options, use_subprocess=False)
    driver.get('https://google.com')
    time.sleep(2)
    driver.quit()

I am getting this error:

    Traceback (most recent call last):
  File "F:\Web_Automation\Ticket_Buy\proxy_testing.py", line 45, in <module>
    driver = uc.Chrome(options=options, use_subprocess=False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "F:\Web_Automation\venv\Lib\site-packages\undetected_chromedriver\__init__.py", line 466, in __init__
    super(Chrome, self).__init__(
  File "F:\Web_Automation\venv\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__
    super().__init__(
  File "F:\Web_Automation\venv\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 56, in __init__
    super().__init__(
  File "F:\Web_Automation\venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 205, in __init__
    self.start_session(capabilities)
  File "F:\Web_Automation\venv\Lib\site-packages\undetected_chromedriver\__init__.py", line 724, in start_session
    super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
  File "F:\Web_Automation\venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 289, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "F:\Web_Automation\venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 344, in execute
    self.error_handler.check_response(response)
  File "F:\Web_Automation\venv\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 193, in check_response
    raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: dial tcp 192.168.1.85:0->127.0.0.1:64940: connectex: The requested address is not valid in its context.


Exception ignored in: <function Chrome.__del__ at 0x0000016A2D12D580>
Traceback (most recent call last):
  File "F:\Web_Automation\venv\Lib\site-packages\undetected_chromedriver\__init__.py", line 843, in __del__
  File "F:\Web_Automation\venv\Lib\site-packages\undetected_chromedriver\__init__.py", line 798, in quit
OSError: [WinError 6] The handle is invalid

The proxy credentials are alias here, I have not written real credentials but believe me they are correct. What am i doing wrong here ?I beg you help me.

0

There are 0 answers