new_cjo_spider_test.py 文件源码

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

项目:fintech_spider 作者: hee0624 项目源码 文件源码
def get_driver_chrome(self):
        # chromedriver
        options = webdriver.ChromeOptions()
        proxy = get_proxy()
        # NOTE: ??"http"?"https"??????????http?????https
        self.proxies["http"] = proxy
        self.proxies["https"] = proxy
        if proxy:
            options.add_argument('--proxy-server=' + proxy)

        display = Display(visible=0, size=(800, 800))
        display.start()
        driver = webdriver.Chrome(executable_path=r"/home/lxw/Software/chromedriver_selenium/chromedriver", chrome_options=options)

        """
        # PhantomJS: Not working. why?
        driver = webdriver.PhantomJS(executable_path=r"/home/lxw/Downloads/phantomjs/phantomjs-2.1.1-linux-x86_64/bin/phantomjs")
        proxy = webdriver.Proxy()
        proxy.proxy_type = ProxyType.MANUAL
        proxy_str = get_proxy()
        if proxy_str:
            proxy.http_proxy = proxy_str
        # ????????webdriver.DesiredCapabilities.PHANTOMJS?
        proxy.add_to_capabilities(webdriver.DesiredCapabilities.PHANTOMJS)
        driver.start_session(webdriver.DesiredCapabilities.PHANTOMJS)
        """

        # ??????
        driver.set_page_load_timeout(self.TIMEOUT)
        driver.set_script_timeout(self.TIMEOUT)  # ???????????
        return driver
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号