외부 인터넷에 연결하기 위해 프록시 서버를 사용하는 우리의 네트워크 환경은 "=> 인터넷 옵션 => 연결 => LAN 설정 (예 :"10.212.20.11:8080 ")에서 구성됩니다.셀레늄 webdriver 용 chomedriver와 프록시를 사용하는 방법은 무엇입니까?
이제 Chrome과 IE에서 selenium webdriver를 사용하고 있지만 프록시 서버가 활성화되어 있으면 브라우저를 시작할 수 없습니다. 여기
는 파이썬 코드 : 여기from selenium import webdriver
driver = webdriver.Chrome(executable_path='E:\Selenium\WebDrivers\chromedriver.exe')
오류 메시지입니다 (IE "인터넷 옵션"에 프록시를 사용하지 않도록 설정하면, 그것을 잘 작동) :
Traceback (most recent call last):
File "E:\WorkSpace\GitHub\selenium\sandbox\test.py", line 4, in <module>
driver = webdriver.Chrome(executable_path='E:\Selenium\WebDrivers\chromedriver.exe')
File "C:\Python27\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 66, in __init__
self.quit()
File "C:\Python27\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in quit
self.service.stop()
File "C:\Python27\lib\site-packages\selenium\webdriver\chrome\service.py", line 97, in stop
url_request.urlopen("http://127.0.0.1:%d/shutdown" % self.port)
File "C:\Python27\lib\urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "C:\Python27\lib\urllib2.py", line 406, in open
response = meth(req, response)
File "C:\Python27\lib\urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Python27\lib\urllib2.py", line 438, in error
result = self._call_chain(*args)
File "C:\Python27\lib\urllib2.py", line 378, in _call_chain
result = func(*args)
File "C:\Python27\lib\urllib2.py", line 625, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "C:\Python27\lib\urllib2.py", line 406, in open
response = meth(req, response)
File "C:\Python27\lib\urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Python27\lib\urllib2.py", line 444, in error
return self._call_chain(*args)
File "C:\Python27\lib\urllib2.py", line 378, in _call_chain
result = func(*args)
File "C:\Python27\lib\urllib2.py", line 527, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 401: Unauthorized
을 그래서, 방법 chromedriver에 대한 프록시를 설정 하시겠습니까? IE 드라이버에는 같은 문제가 있습니다.
감사합니다. Ehsan,하지만 코드를 변경했지만 오류가 여전히 존재합니다.
from selenium import webdriver
chrome_option = webdriver.ChromeOptions()
chrome_option.add_argument("--proxy-server=10.213.20.62:80")
driver = webdriver.Chrome(executable_path='E:\Selenium\WebDrivers\chromedriver.exe',
chrome_options=chrome_option)
driver.quit()
해결! IE => 인터넷 옵션 => 연결 => LAN 설정에서 프록시 "127.0.0.1"을 사용하지 않는 예외 주소를 추가하면이 문제가 해결됩니다! 어쨌든 고마워!
해결되었습니다! IE => 인터넷 옵션 => 연결 => LAN 설정에서 프록시 "127.0.0.1"을 사용하지 않는 예외 주소를 추가하면이 문제가 해결됩니다! 어쨌든 고마워! –
'.quit()'을 호출 할 때 407 개의 오류와 비슷한 문제가 있었으며, 여기 상황에 도움이된다. 나는 [질문 및 답변] (http://stackoverflow.com/questions/22018126/selenium-chromedriver-http-407-on-quit)을 게시하여 여기에있는 링크를 포함하여 솔루션을 강조 표시했습니다. 감사! – Tetrinity