Browse Source

选择密码登录

ignatz 3 years ago
parent
commit
1b3e0833e1
2 changed files with 2 additions and 0 deletions
  1. 1 0
      robot/chrome.py
  2. 1 0
      robot/loc.py

+ 1 - 0
robot/chrome.py

@@ -24,6 +24,7 @@ class Robot:
         self.driver.get(url.logout)
         self.driver.get(url.login)
         self.driver.switch_to.frame('loginIframe')
+        self.wait_to_click(loc.password_login_tab).click()
         self.wait_to_click(loc.username).send_keys(username)
         self.wait_to_click(loc.password).send_keys(password + Keys.RETURN)
         self.wait.until(EC.url_to_be(url.uc_index))

+ 1 - 0
robot/loc.py

@@ -2,6 +2,7 @@
 
 from selenium.webdriver.common.by import By
 
+password_login_tab = By.CSS_SELECTOR, '.content-title > a:nth-of-type(2)'
 username = By.ID, 'username'
 password = By.ID, 'password'