Ejemplo n.º 1
0
    def _create_driver(self):
        driver = new_driver(user_agent=USER_AGENT, js_re_ignore='/cas\/captcha.jpg/g')

        # 随便访问一个相同host的地址,方便之后设置cookie
        driver.get('http://gzlss.hrssgz.gov.cn/xxxx')

        return driver
Ejemplo n.º 2
0
    def _create_driver(self):
        driver = new_driver(user_agent=USER_AGENT,
                            js_re_ignore='/PicCheckCode1/g')

        driver.get('http://www.bjgjj.gov.cn/')

        return driver
Ejemplo n.º 3
0
 def _create_driver(self):
     driver = new_driver(user_agent=USER_AGENT,
                         js_re_ignore='/PicCheckCode1/g')
     proxy = webdriver.Proxy()
     proxy.proxy_type = ProxyType.DIRECT
     proxy.add_to_capabilities(webdriver.DesiredCapabilities.PHANTOMJS)
     driver.start_session(webdriver.DesiredCapabilities.PHANTOMJS)
     # 以前遇到过driver.get(url)一直不返回,但也不报错的问题,这时程序会卡住,设置超时选项能解决这个问题。
     driver.set_page_load_timeout(13)
     # 设置10秒脚本超时时间
     driver.set_script_timeout(13)
     return driver
Ejemplo n.º 4
0
 def _create_driver(self):
     driver = new_driver(user_agent=USER_AGENT,
                         js_re_ignore='/cas\/captcha.jpg/g')
     # proxy = webdriver.Proxy()
     # proxy.proxy_type = ProxyType.DIRECT
     # proxy.add_to_capabilities(webdriver.DesiredCapabilities.PHANTOMJS)
     # driver.start_session(webdriver.DesiredCapabilities.PHANTOMJS)
     # # 以前遇到过driver.get(url)一直不返回,但也不报错的问题,这时程序会卡住,设置超时选项能解决这个问题。
     driver.set_page_load_timeout(20)
     # 设置10秒脚本超时时间
     driver.set_script_timeout(20)
     # 随便访问一个相同host的地址,方便之后设置cookie
     driver.get('http://gzlss.hrssgz.gov.cn/xxxx')
     return driver
Ejemplo n.º 5
0
 def _create_driver(self):
     driver = new_driver(user_agent=USER_AGENT,
                         js_re_ignore='/cdwsjb\/CaptchaImg.png/g')
     proxy = webdriver.Proxy()
     proxy.proxy_type = ProxyType.DIRECT
     proxy.add_to_capabilities(webdriver.DesiredCapabilities.PHANTOMJS)
     driver.start_session(webdriver.DesiredCapabilities.PHANTOMJS)
     # 以前遇到过driver.get(url)一直不返回,但也不报错的问题,这时程序会卡住,设置超时选项能解决这个问题。
     driver.set_page_load_timeout(13)
     # 设置10秒脚本超时时间
     driver.set_script_timeout(13)
     # 随便访问一个相同host的地址,方便之后设置cookie
     driver.get('https://gr.cdhrss.gov.cn:442/xxxx')
     return driver
Ejemplo n.º 6
0
    def _create_driver(self):
        driver = new_driver(user_agent=USER_AGENT,
                            js_re_ignore='/sbsjb\wzb\/Bmblist12.jpg/g')
        # driver.service.service_args.append('--proxy='+get_proxy_ip()+'')
        # driver.service.service_args.append('--proxy-type=socks5')

        proxy = webdriver.Proxy()
        proxy.proxy_type = ProxyType.MANUAL
        proxy.http_proxy = get_proxy_ip()
        proxy.add_to_capabilities(webdriver.DesiredCapabilities.PHANTOMJS)
        driver.start_session(webdriver.DesiredCapabilities.PHANTOMJS)

        # 以前遇到过driver.get(url)一直不返回,但也不报错的问题,这时程序会卡住,设置超时选项能解决这个问题。
        driver.set_page_load_timeout(30)
        # 设置10秒脚本超时时间
        driver.set_script_timeout(30)

        # 随便访问一个相同host的地址,方便之后设置cookie
        driver.get('"http://www.12333sh.gov.cn/xxxx')
        return driver
Ejemplo n.º 7
0
    def _create_driver(self):
        driver = new_driver(user_agent=USER_AGENT, js_re_ignore='')

        # 随便访问一个相同host的地址,方便之后设置cookie
        driver.get('http://www.gzgjj.gov.cn/xxxx')
        return driver
Ejemplo n.º 8
0
 def _create_chrome_driver(self):
     driver = new_driver(user_agent=USER_AGENT,
                         driver_type=DriverType.CHROME)
     return driver
Ejemplo n.º 9
0
 def _create_driver(self):
     driver = new_driver(user_agent=USER_AGENT,
                         js_re_ignore='/web\/ImageCheck.jpg/g')
     driver.get(MAIN_URL)
     return driver
Ejemplo n.º 10
0
 def _create_driver(self):
     driver = new_driver(user_agent=USER_AGENT,
                         js_re_ignore='/web\/ImageCheck.jpg/g')
     driver.get('https://nbp.szzfgjj.com/xxx')
     return driver