5
我想將Selenium Webdriver與需要用戶身份驗證的代理一起使用。這可能嗎?Python Selenium Webdriver - 代理身份驗證
這是,我有這麼遠,但我不知道放在哪裏憑據(用戶名:@通代理:端口)
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.http", "proxy")
profile.set_preference("network.proxy.http_port", "port_number")
profile.update_preferences()
driver = webdriver.Firefox(firefox_profile=profile)
driver.get('http://www.google.com')
driver.title
你有沒有找到解決方案? – ChairmanMeow
嗨,是的,我最終與Selenium一起使用了PhanomJS:https://realpython.com/blog/python/headless-selenium-testing-with-python-and-phantomjs/和http://phantomjs.org/api/command -line.html – Maecky
以擴展名使用Firefox,請參閱:https://stackoverflow.com/a/39903614/955422 –