from selenium import webdriver
chromeOptions = webdriver.ChromeOptions()
# 設定代理
chromeOptions.add_argument("--proxy-server=http://202.20.16.82:10152")
browser = webdriver.Chrome(chrome_options=chromeOptions)
# 查看本機ip,查看代理是否起作用
browser.get("http://httpbin.org/ip")
# browser.get("http://www.baidu.com")
print(browser.page_source)
# 退出,清除瀏覽器快取
browser.quit()
Traceback (most recent call last):
File "E:/pythonProject_1/介面測驗(基于代碼實作)/for_test.py", line 24, in <module>
browser.get("http://httpbin.org/ip")
File "E:\pythonProject_1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 213, in get
self.execute(Command.GET, {'url': url})
File "E:\pythonProject_1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 201, in execute
self.error_handler.check_response(response)
File "E:\pythonProject_1\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 181, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_PROXY_CONNECTION_FAILED
(Session info: chrome=86.0.4240.183)
(Driver info: chromedriver=86.0.4240.22 (398b0743353ff36fb1b82468f63a3a93b4e2e89e-refs/branch-heads/4240@{#378}),platform=Windows NT 10.0.17763 x86_64)
行程已結束,退出代碼 1
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/224584.html
標籤:其他開發語言
上一篇:求助abaqus大神,激光熱源子程式怎么撰寫?要求如圖
下一篇:linux系統下,監聽滑鼠的問題
