Exemplo n.º 1
0
    def _get_captcha_code(self, full_screen_path, captcha_path):
        driver = self.client.driver
        if self.last_iframe_postion is not None:
            p = self.last_iframe_postion
        else:
            p = {'x':0, 'y':0}
            
        try:
            verifyshow = driver.find_element_by_css_selector("#J_Other .mod")
        except:
            print "Not found vrify code"
            return None
        
        driver.get_screenshot_as_file(full_screen_path)    
        vp = verifyshow.location
        s = verifyshow.size
        
        #box = (left, top, left+width, top+height)
        left = p['x'] + vp ['x']
        top = p['y'] + vp['y']
        new_box = (int(left), int(top), int(left + s['width']), int(top + s['height']))
            
        from sailing.webrobot.captcha import get_captcha, create_captcha_image
        create_captcha_image(full_screen_path, captcha_path, new_box)
        

        print "starting get captcha: %s" % (captcha_path, )        
        data = get_captcha(captcha_path, )
        print "captcha response:%s" % str(data)
    
        if data['status'] == 'ok':
            code = data['captcha']
            return code
        
        return None            
Exemplo n.º 2
0
	def _get_captcha_code(self, driver, p, full_screen_path, captcha_path):
		self.logger.info("the screen path: %s" % full_screen_path)
		driver.get_screenshot_as_file(full_screen_path)	
		
		try:
			verifyshow = driver.find_element_by_css_selector(".code_img")
		except:
			print "Not found vrify code"
			return None
		vp = verifyshow.location
		s = verifyshow.size
		
		#box = (left, top, left+width, top+height)
		left = p['x'] + vp ['x']
		top = p['y'] + vp['y']
		new_box = (int(left), int(top), int(left + s['width']), int(top + s['height']))
			
		self.save_screenshot_img(full_screen_path, captcha_path, new_box)
		
		from sailing.webrobot.captcha import get_captcha

		print "starting get captcha: %s" % (captcha_path, )		
		data = get_captcha(captcha_path, )
		print "captcha response:%s" % str(data)
	
		if data['status'] == 'ok':
			code = data['captcha']
			return code
		
		return None
Exemplo n.º 3
0
    def _get_captcha_code(self, driver, p, full_screen_path, captcha_path):

        try:
            verifyshow = driver.find_element_by_css_selector(".check-code-img")
        except:
            print "Not found vrify code"
            return None

        driver.get_screenshot_as_file(full_screen_path)
        vp = verifyshow.location
        s = verifyshow.size

        #box = (left, top, left+width, top+height)
        left = p['x'] + vp['x']
        top = p['y'] + vp['y']
        new_box = (int(left), int(top), int(left + s['width']),
                   int(top + s['height']))

        self.save_screenshot_img(full_screen_path, captcha_path, new_box)

        from sailing.webrobot.captcha import get_captcha

        print "starting get captcha: %s" % (captcha_path, )
        data = get_captcha(captcha_path, )
        print "captcha response:%s" % str(data)

        if data['status'] == 'ok':
            code = data['captcha']
            return code

        return None
Exemplo n.º 4
0
    def _get_captcha_code(self, driver, p, full_screen_path, captcha_path):

        try:
            verifyshow = driver.find_element_by_css_selector("#verifyshow")
        except:
            print "Not found vrify code"
            return None

        driver.get_screenshot_as_file(full_screen_path)
        vp = verifyshow.location
        s = verifyshow.size

        # box = (left, top, left+width, top+height)
        left = p["x"] + vp["x"]
        top = p["y"] + vp["y"]
        new_box = (int(left), int(top), int(left + s["width"]), int(top + s["height"]))

        self.save_screenshot_img(full_screen_path, captcha_path, new_box)

        from sailing.webrobot.captcha import get_captcha

        print "starting get captcha: %s" % (captcha_path,)
        data = get_captcha(captcha_path)
        print "captcha response:%s" % str(data)

        if data["status"] == "ok":
            code = data["captcha"]
            return code

        return None