Home > other >  Python selenium agents set up IP error, a great god
Python selenium agents set up IP error, a great god

Time:11-18

 
The from the selenium import webdriver

ChromeOptions=webdriver. ChromeOptions ()

# set agent
ChromeOptions. Add_argument (" -- proxy server=http://202.20.16.82:10152 ")
Browser=webdriver. Chrome (chrome_options=chromeOptions)

# check the machine IP, check to see if the agent work
The get (" http://httpbin.org/ip ")
# the get (" http://www.baidu.com ")

Print (the page_source)

# exit, to clear the browser cache
The quit ()


 Traceback (the most recent call last) : 
The File "E:/pythonProject_1/interface test (based on the code implementation)/for_test py", line 24, in & lt; module>
The get (" http://httpbin.org/ip ")
The File "E: \ pythonProject_1 \ venv \ lib \ site - packages, selenium and webdriver \ remote \ webdriver py", line 213, in the get
The self. The execute (Command. The GET, {' url: the url})
The File "E: \ pythonProject_1 \ venv \ lib \ site - packages, selenium and webdriver \ remote \ webdriver py", line 201, in the execute
The self. The error_handler. Check_response (response)
The File "E: \ pythonProject_1 \ venv \ lib \ site - packages, selenium and webdriver \ remote \ errorhandler py", line 181, in check_response
Raise exception_class (message, screen, stacktrace)
Selenium.com mon. Exceptions. WebDriverException: Message: unknown error: net: : ERR_PROXY_CONNECTION_FAILED
(Session info: chrome=86.0.4240.183)
(Driver info: chromedriver=86.0.4240.22 (398 b0743353ff36fb1b82468f63a3a93b4e2e89e - refs/branch - heads/4240 @ # {378}), platform=Windows NT 10.0.17763 x86_64)


Process is over, exit code 1

  • Related