Exemple #1
0
 screen.mouseMove('Image_Next_To_Captcha.png')
 current_loc = Env.getMouseLocation()
 current_loc.x -= 150
 screen.hover(current_loc)
 #screen.wait(copyImageLocation,15)
 #screen.click(copyImageLocation)
 tries = 0
 while True:  #try a few times to decode the captcha
     tries += 1
     if tries == 10:  #solve manually
         captcha_solution = input(
             "Please enter the solution to the captcha manually")
         break
     screen.rightClick(current_loc)
     try:
         screen.wait(copyImageLocation, 15)
         screen.click(copyImageLocation)
         #screen.type("o", KeyModifier.CTRL)
         captcha_url = Env.getClipboard()
         p = subprocess.Popen([
             '%s %s "%s"' %
             ('/usr/bin/python', CLOUDFUSION_PATH +
              '/third_party/captcha_decoder/decode_number_captcha.py',
              captcha_url)
         ],
                              stdout=subprocess.PIPE,
                              shell=True)
         captcha_solution, err = p.communicate()  #wait for process to exit
         if captcha_solution != None and len(captcha_solution) > 2:
             captcha_solution = int(captcha_solution)
             break
from sikuli.Sikuli import Screen

scr = Screen()
scr.wait(psc, int(timeout))
 screen.type(Key.TAB)
 screen.mouseMove('Image_Next_To_Captcha.png')
 current_loc = Env.getMouseLocation()
 current_loc.x -= 150
 screen.hover(current_loc)
 #screen.wait(copyImageLocation,15)
 #screen.click(copyImageLocation)
 tries = 0
 while True: #try a few times to decode the captcha
     tries += 1
     if tries == 10: #solve manually
         captcha_solution = input("Please enter the solution to the captcha manually")
         break
     screen.rightClick(current_loc)
     try:
         screen.wait(copyImageLocation,15)
         screen.click(copyImageLocation)
         #screen.type("o", KeyModifier.CTRL)
         captcha_url = Env.getClipboard()
         p = subprocess.Popen(['%s %s "%s"' % ('/usr/bin/python', CLOUDFUSION_PATH+'/third_party/captcha_decoder/decode_number_captcha.py', captcha_url)], stdout=subprocess.PIPE, shell=True)
         captcha_solution, err = p.communicate() #wait for process to exit
         if captcha_solution != None and len(captcha_solution) > 2:
             captcha_solution = int(captcha_solution)
             break
     except Exception, e:
         pass
     screen.click(retryCaptcha)
 
 screen.type(Key.DOWN)
 screen.type(Key.DOWN)
 screen.wait(captchaInput)