1.PageLocators目录下的具体模块

Python+Selenium+Unittest实现PO模式web自动化框架(4)

 

 

 2.PageLocators目录下主要放置个页面的元素定位。用于统一管理个页面的定位元素。

例如:登录页面的元素定位login_page_locator.py

# --^_^-- coding:utf-8 --^_^--
# @Remark:登录页面元素定位

from selenium.webdriver.common.by import By


class LoginPageLocator:
    # 用户名输入框
    user_loc = (By.XPATH, '//input[@>)
    # 密码输入框
    pwd_loc = (By.XPATH, '//input[@>)
    # 登录按钮
    login_button_loc = (By.XPATH, '//input[@>)
    # 密码错误提示信息
    login_error_loc = (By.XPATH, '//div[@class="layui-layer-content"]')

 

相关文章: