automatic registration process on the practical operation of (a)

This article related to technical knowledge are:

  • selenium automation positioning;
  • html dom element fetch;
  • Based on opencv gap slider positioning;
  • Regular expressions;

Chance to read an article about: the use of reptile increase processon free file number , just process on the number of files to be full, so I want a practical operation.

After analysis, you can learn process on to others by sharing their own unique links, expansion of three others after the file by link to register an account, you can get the system.

Sorting through the code line and a logic automatically registered with selenium. Directly on the map:

From the above can be learned at that time ProcessOn login registration process is relatively simple, dom element is not complicated, all of the input box. E-mail is verified by the verification link.

Who saw this article when, ProcessOn registration has undergone changes, authentication into Tencent verification slider. After verification of the slider will be sent by registered mail to the mailbox. Content of the message is to verify the code.

selenium, soup, dom, temp-mail all new skills. In fact, python line and also less. Set up environmental probably run a bit, dom element in selenium frequently when positioning error.

Universal's degree Niang (I may not be a qualified ape, I used to degree of your mother, not conveniently ladder, speed can not refrain), modify the code as follows:

def open(self):
    """
    open browser, and input register code
    """
    self.browser.get(self.url)
    time.sleep(5)
    # press 'register' button
    self.browser.find_element_by_class_name('button').click()
    # fill 'email/phone' as user_name
    self.browser.find_element_by_id('login_phone').send_keys(self.email)
    # fill 'password'
    self.browser.find_element_by_id('login_password').send_keys(self.psw)
    # fill 'fullname/nickname'
    self.browser.find_element_by_id('login_fullname').send_keys(self.name)
    # trigger 'TencentCaptcha' button to send verify email
    self.browser.find_element_by_id('TencentCaptcha').click()

See pretty much know that Tencent verification slider with keywords, the degree of your mother. Found one: Tencent WaterBox verification code to crack . Pull down the reproduction, may be relatively new. Reproduce it passed.

Looked at the source, the main point is to get the technology gap position by opencv, of course, simulate human operation.

Login class access may be integral to ProcessOn, where relatively small changes:

class the Login (Object):
     DEF  __init__ (Self, Browser):
         # with ProcessOn on the same browser 
        # self.url = "https://open.captcha.qq.com/online.html" 
        self.driver = Browser

    DEF login_main (Self):
         # remove action trigger slider, slider operation triggered by ProcessOn 
        # ssl._create_default_https_context = ssl._create_unverified_context 
        Driver = self.driver
         # the wait for the Load at The dom CAN otherwise not the Find at The Element 
        # here must sleep a little wait dom finished loading 
        the time.sleep (5 )

        driver.switch_to.frame(driver.find_element_by_id('tcaptcha_iframe'))  # switch 到 滑块frame
        time.sleep(0.5)
        bk_block = driver.find_element_by_xpath('//img[@id="slideBg"]')  # 大图
        web_image_width = bk_block.size
        web_image_width = web_image_width['width']
        bk_block_x = bk_block.location['x']
        ...
        # Omitted here several 
        ...
         # Do not close the browser 
        # self.after_quit ()

Next is to get to temp-mail in the mail and get the verification code.

Prior to this there is a small episode, at that time (a few months ago?) Get a list from the domain in the temp-mail is normal.

def getdomain():
    global domains
    if domains == []:
        r = requests.get("https://temp-mail.org/en/option/change/")
        soup = BeautifulSoup(r.text, "html.parser")
        domains = [tag.text for tag in soup.find(id="domain").find_all("option")]
    return random.choice(domains)

When running today, I found that to get the domains is empty. After the browser F12 to view element changes found, temp-mail for a certain amount of anti-climb policy (do not know whether my Suman ^ _ ^). <Option> is dynamically loaded by the script. Html not yet the moment to get loaded.

def getdomain():
    global domains
    if domains == []:
        url = "https://temp-mail.org/en/option/change/"
        browser = webdriver.Chrome()
        browser.get(url)
        domainsText = browser.find_element_by_id('domain').get_attribute('innerHTML')
        patt = re.compile(r'<option.+?>(.+?)</option>')
        domains = patt.findall(domainsText)
        browser.quit()
    return random.choice(domains)

The program was thinking after waiting dom is loaded, and then resolve to crawl mailing list by domain soup. Research for a while unsuccessful, then the direct use of selenium artifact.

Loaded more slowly, but also a one-shot deal.

After get the email domain, we can construct a random email address, user name and password, that is ready to account information.

The next thing is to trigger a verification code sent to the corresponding mailbox and grab the verification code.

Because before experienced a temp-mail, mailbox casual setting, free to receive e-mail, small works that can be closed, and everyone wanted to talk about technology upgrades too fast, temp-mail again the demon.

Information on how funeral, Let's hear the following decomposition.

 

PS: I wanted to talk about process on for another demon.

Social forcing us grow!

 

Guess you like

Origin www.cnblogs.com/imine-lightq-jane/p/11613984.html