from basepage import *
from selenium.webdriver.common.by import By
class LoginPage(Page):
'''登录页面'''
url = '/teacher/login.html'
username_loc = (By.ID,'user_name')
password_loc = (By.ID,'password')
submit_loc = (By.ID,'login')
def type_username(self,username):
self.find_element(*self.username_loc).clear()
self.find_element(*self.username_loc).send_keys(username)
def type_password(self,password):
self.find_element(*self.password_loc).clear()
self.find_element(*self.password_loc).send_keys(password)
def type_submit(self):
self.find_element(*self.submit_loc).click()
def login_action(self,username,password):
self.open()
self.type_username(username)
self.type_password(password)
self.type_submit()
loginPass_loc = (By.ID,'out')
loginFail_loc = (By.LINK_TEXT,'注册页面')
def type_loginPass_hit(self):
return self.find_element(*self.loginPass_loc).text
def type_loginFail_hit(self):
return self.find_element(*self.loginFail_loc).text