def getDriverWithProxySupport(self, proxy_host, proxy_port):
if self.debug == False:
self.display = Display(visible=0, size=(1920, 1080))
self.display.start()
profile = self.getWebDriverProfile()
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.http", proxy_host)
profile.set_preference("network.proxy.http_port", proxy_port)
profile.set_preference("network.proxy.https", proxy_host)
profile.set_preference("network.proxy.https_port", proxy_port)
profile.set_preference("network.proxy.ssl", proxy_host)
profile.set_preference("network.proxy.ssl_port", proxy_port)
profile.update_preferences()
capabilities = webdriver.DesiredCapabilities().FIREFOX
capabilities["marionette"] = False
newdriver = webdriver.Firefox(firefox_profile=profile, capabilities=capabilities)
#newdriver = webdriver.Firefox(firefox_profile=profile)
self.wait = ui.WebDriverWait(newdriver, 10) # timeout after 10 seconds
return newdriver
评论列表
文章目录