def AliPay(): driver = create_driver() time.sleep(5) print " [+]Navigating To Website.." driver.get("https://auth.alipay.com/login/index.htm") time.sleep(10) while True: print "-- --- -- --- -- --- -- --- -- --- --" try: c = driver.find_element_by_class_name('ui-nav')[0] t = c.find_elements_by_tag_name("li")[0] print " [!]Clicking to show QR code image..." button._execute(webdriver.remote.command.Command.CLICK_ELEMENT) time.sleep(5) except: pass try: driver.save_screenshot('tmp.png') #screenshot entire page img = driver.find_elements_by_tag_name("canvas")[0] print " [+]The QR code image found !" location = img.location size = img.size print " [+]Grabbing photo.." Screenshot("tmp.png", location, size) print " [#]Saved To tmp.png" webdriver.delete_all_cookies() time.sleep(10) print " [!]Refreshing page..." driver.refresh() continue except: break
def __init__(self, webdriver): #uva-style ID self.randomstring = (''.join(random.choice(string.ascii_lowercase) for x in range(3)) + str(random.randint(0,9)) + ''.join(random.choice(string.ascii_lowercase) for x in range(2)) ) self.name = self.randomstring self.email = self.randomstring + "@virginia.edu" print "New UserVoice with random=" + self.randomstring try: webdriver.delete_all_cookies() except WebDriverException: webdriver.get(url) webdriver.delete_all_cookies() #print "Cookies deleted" self.wb = webdriver self.broke = False self.signed = "No"
def __init__(self, webdriver): uname = ''.join(random.choice(string.ascii_lowercase) for x in range(13)) self.first_name = uname self.last_name = uname self.reason = "reasons" self.password = 123456 self.zipcode = 22904 self.address = str(random.randint(1,500)) + " " + uname + " Street" self.city = 'charlottesville' self.state = 'VA' self.email = self.last_name + "@mailinator.com" try: webdriver.delete_all_cookies() except WebDriverException: webdriver.get("http://change.org") webdriver.delete_all_cookies() self.wb = webdriver self.broke = False self.signed = "No"
def QQ(): driver = create_driver() time.sleep(5) print " [+]Navigating To Website.." driver.get("http://w.qq.com") time.sleep(10) while True: print "-- --- -- --- -- --- -- --- -- --- --" try: driver.save_screenshot('tmp.png') #screenshot entire page img = driver.find_elements_by_tag_name("img")[0] print " [+]The QR code image found !" location = img.location size = img.size print " [+]Grabbing photo.." Screenshot("tmp.png" ,location ,size) print " [#]Saved To tmp.png" webdriver.delete_all_cookies() time.sleep(10) print " [!]Refreshing page..." driver.refresh() continue except: break
def browser(webdriver): "Returns the webdriver with all its cookies cleared." webdriver.delete_all_cookies() return webdriver
driver.get("chrome://version/") except Exception as e: print(str(e)) print("Chrome Ready...") return driver if __name__ == "__main__": sysdir=os.path.dirname(os.path.realpath(sys.argv[0])) url="https://mp.weixin.qq.com/s/skrRciQHFgOmiTDV2TG0Ng" #要刷的页面 chromeDriverFile=sysdir+"/chromedriver.exe" #驱动目录Linux为chromedriver userDataPath=sysdir+"/tmp" #用户目录 sleepTime=3 #页面刷新等待时间 total=99999 #循环次数 webdriver=initDriver(chromeDriverFile,userDataPath) time.sleep(10) for t in range(0,total): try: webdriver.get(url) print("Success: %s"%str(t)) ActionChains(webdriver).key_down(Keys.HOME).perform() ActionChains(webdriver).key_down(Keys.DOWN).perform() ActionChains(webdriver).key_down(Keys.DOWN).perform() ActionChains(webdriver).key_down(Keys.DOWN).perform() time.sleep(1) ActionChains(webdriver).key_down(Keys.END).perform() time.sleep(1) ActionChains(webdriver).key_up(Keys.HOME).perform() webdriver.delete_all_cookies() time.sleep(int(sleepTime)) except Exception as e: print(str(e))