授权QQ登录的qq端前端页面变迁

 

 

 

    ac_type = 'qq'
    if ac_type == 'qq':
        myid, mypwd = qq_key
        xp = '/html/body/div/div/div[2]/div/div/div/ul/li[3]'
        # udp
        xp = '/html/body/div/div/div[2]/div/div/div/ul/li[2]'
        browser.find_element_by_xpath(xp).click()
        time.sleep(random.randint(3, 10))
        browser.refresh()
        for rp in range(3):
            try:
                browser.switch_to.frame('ptlogin_iframe')
                js = 'document.getElementById("bottom_qlogin").childNodes[0].click()'
                browser.execute_script(js)
                break
            except Exception as e:
                print(e)
                browser.refresh()
                time.sleep(2)
                continue
        time.sleep(random.randint(3, 10))
        js = '%s%s%s' % ('document.getElementById("u").value="', myid, '"')
        browser.execute_script(js)
        js = '%s%s%s' % ('document.getElementById("p").value="', mypwd, '"')
        browser.execute_script(js)
        time.sleep(random.randint(5, 15))
        # old ori
        # xp_newpage = '//*[@id="go"]'
        # browser.find_element_by_xpath(xp_newpage).click()
        js = 'document.getElementById("login_button").click()'
        browser.execute_script(js)
        time.sleep(random.randint(1, 10))

  

 

posted @ 2018-05-22 18:22  papering  阅读(400)  评论(0编辑  收藏  举报