WebDriverUtil.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:webnuke 作者: bugbound 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号