Python+selenium Auto-cycle throw QQ mailbox Drifting bottle

Source: Internet
Author: User

The Python code is as follows:

#Coding=utf-8 fromSeleniumImportWebdriver fromTimeImportSleep fromRandomImportRandintdefauto_throw (username, password):"" " Automatic loopThrowing Bottles"""Driver=Webdriver. Chrome () Driver.get ("https://mail.qq.com")
Driver.maxmize_window () # Maximize window sleep (1) #Toggle IFrame FormDriver.switch_to.frame ("Login_frame") Driver.find_element_by_xpath ('//*[@id = "U"]'). Send_keys (username) # User name Driver.find_element_by_xpath ('//*[@id = "P"]'). Send_keys (password) # password Driver.find_element_by_xpath ('//*[@id = "Login_button"]'). Click () # Login#Tanche The table back to the outermost layerdriver.switch_to.default_content () Sleep (2) I=0 M=0#Cycle the bottle whileTrue:Try: Driver.find_element_by_xpath ('//*[@id = "Folder_11"]/b[1]'). Click ()#Drifting BottleSleep (1) #Toggle IFrame FormDriver.switch_to.frame ("MainFrame") Sleep (1) Driver.find_element_by_xpath ('//*[@id = "Toolbar"]/div/a[1]'). Click ()#throw aSleep (1) Driver.find_element_by_xpath ('//*[@id = "Bottle_magic"]/div/div[1]/a[1]/span'). Click ()#Ordinary BottleSleep (1) Driver.find_element_by_xpath ('//*[@id = "Bottle_send"]/div[2]/div[1]/div[4]/div[2]/div[1]/textarea'). Send_keys ("Stranger
Your lucky number is%d!."%randint (1,10000)) Sleep (2) Driver.find_element_by_xpath ('//*[@id = "Bottle_send"]/div[2]/div[2]/div[3]/a[2]'). Click ()#throw it out . #Tanche The table back to the outermost layerdriver.switch_to.default_content () m+ = 1Print("the first%d bottles were successfully thrown out!"%m) Sleep (2) except: Print("throwing a bottle or throwing a bottle is running out of chance!") I+ = 1ifI > 10: Print("The chance to throw the bottle is running out!") Breakif __name__=='__main__':
Print ("--------automatically cycle lost QQ mailbox Drift bottle script--------")
Username = input ("Enter your QQ mailbox user name:")
Password = input ("Enter your QQ email login password:")
Auto_throw (username, password)

Python+selenium Auto-cycle throw QQ mailbox Drifting bottle

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.