po模型的handle层,主要用于给定位的元素发送value,register_handle.py
from page.register_page import RegisterPage from log.user_log import UserLog class RegisterHandle(object): def __init__(self,driver): self.register_p = RegisterPage(driver) def send_user_email(self,email): self.log = UserLog() self.logger = self.log.get_log() self.register_p.get_email_element().send_keys(email) self.logger.info('输入的邮箱值是:'+ email) def send_user_name(self,username): self.register_p.get_username_element().send_keys(username) def send_user_password(self,password): self.register_p.get_password_element().send_keys(password) def send_user_code(self,code): self.register_p.get_code_element().send_keys(code) #获取文字信息 def get_text_info(self,info): try: if info == 'user_email_error': text = self.register_p.get_email_error_element().text elif info == 'user_name_error': text = self.register_p.get_name_error_element().text elif info == 'password_error': text = self.register_p.get_password_error_element().text else: text = self.register_p.get_code_error_element().text except: text = None return text #点击注册按钮 def click_button(self): self.register_p.get_button_element().click() #获取注册按钮文字 def get_button_text(self): return self.register_p.get_button_element().text