pythonGUI Automation: bypass the verification code

1. Obtain cookies  

  Codes are as follows:

Import Time
 from the Selenium Import webdriver 

class cookies_login: 
    WD = webdriver.Chrome ()
     DEF getCookies (Self): 
        WD = self.wd 
        wd.maximize_window () 
        # after successful login Jump page 
        url = " http://47.108.47.47 : 81 / ADMIN " 
        # login page 
        wd.get ( " http://47.108.47.47:81/admin/login?company=9 " )
         the while True:
             Print ( " Please the Login "  )
            the time.sleep (3)
            while wd.current_url == url:
                cookies=wd.get_cookies()
                wd.quit()
                return cookies

2. bypass the verification code

  Codes are as follows:

from selenium import webdriver
import time
from xctest_selenium.get_cookies import *
class NoSignLogin:
    def get_nosignlogin(self):
        cookies=cookies_login().getCookies()
        wd=webdriver.Chrome()
        wd.maximize_window()
        wd.implicitly_wait(20)
        # 登录成功跳转后的页面
        wd.get("http://47.108.74.74:81/admin#datacount")
        for cookie in cookies:
            wd.add_cookie(cookie)
            time.sleep(3)
        wd.refresh()

Guess you like

Origin www.cnblogs.com/badbadboyyx/p/12168452.html