标签:exp click __init__ driver sub web inf word self
# 公共页 basepage.py
class BasePage:
def __init__(self, driver):
self.driver = driver
# 登录页面 loginpage.py
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from locators.login_locator import LoginLocator
from pages.base_page import BasePage
class LoginPage(BasePage):
login_locator = LoginLocator()
def get_phone_element(self):
return WebDriverWait(self.driver, 20).until(EC.visibility_of_element_located(
self.login_locator.phone_element))
def get_password_element(self):
return WebDriverWait(self.driver, 20).until(EC.visibility_of_element_located(
self.login_locator.password_element))
def send_phone_value(self, phone):
return self.get_phone_element().send_keys(phone)
def send_password_value(self, password):
return self.get_password_element().send_keys(password)
def clear_phone_value(self):
return self.get_phone_element().clear()
def clear_password_value(self):
return self.get_password_element().clear()
def get_submit_element(self):
return WebDriverWait(self.driver, 20).until(EC.visibility_of_element_located(
self.login_locator.submit_element))
def click_submit_element(self):
return self.get_submit_element().click()
def get_success_info(self):
return WebDriverWait(self.driver, 20).until(EC.visibility_of_element_located(
self.login_locator.success_info_element))
def get_error_msg_info(self):
return WebDriverWait(self.driver, 20).until(EC.visibility_of_element_located(
self.login_locator.error_msg_info_element))
def get_error_flash_info(self):
return WebDriverWait(self.driver, 20).until(EC.visibility_of_element_located(
self.login_locator.error_flash_info_element))
标签:exp click __init__ driver sub web inf word self
原文地址:https://www.cnblogs.com/sophia-985935365/p/12640005.html