예제 #1
0
class LoginPage(object):
    def __init__(self, driver):
        self.element = PySelenium(driver)

    # 清空输入框
    def clear_input(self):
        self.element.element_clear('Login', 'UserName')
        self.element.element_clear('Login', 'PassWord')

    # 输入用户名
    def send_username(self, keywords):
        self.element.input_element('Login', 'UserName', keywords)

    # 输入密码
    def send_password(self, keywords):
        self.element.input_element('Login', 'PassWord', keywords)

    # 点击登录
    def click_submit(self):
        self.element.click_element('Login', 'Submit')

    # 获取首页机构名称
    def get_org_name(self):
        return self.element.get_element_text('Index', 'OrgName')

    # 点击退出
    def click_logout(self):
        self.element.click_element('Index', 'Logout')

    # 获取欢迎登录文字
    def get_welcome(self):
        return self.element.get_element_text('Login', 'Welcome')
예제 #2
0
class AccountPage(object):
    def __init__(self, driver):
        self.element = PySelenium(driver)

    # 点击管理菜单
    def click_menu_manage(self):
        self.element.js_click_element('Index', 'MenuManage')

    # 选择人员管理
    def click_account(self):
        self.element.get_ul_li('Index', 'ManageList', 0)

    # 获取按钮文字
    def get_add_text(self):
        return self.element.get_element_text('AccountManage', 'AddAccountBtn')

    # 点击新增人员按钮
    def click_add_account_btn(self):
        self.element.click_element('AccountManage', 'AddAccountBtn')

    # 获取对话框标题
    def get_dialog_title(self):
        return self.element.get_element_text('AccountManage', 'DialogTitle')

    # 输入员工姓名
    def input_account_name(self, content):
        self.element.element_clear('AccountManage', 'AccountName')
        self.element.click_element('AccountManage', 'AccountName')
        self.element.input_element('AccountManage', 'AccountName', content)

    # 输入用户名(由于用户名会自动生成,暂不做特殊处理)
    def input_account_nickname(self):
        self.element.click_element('AccountManage', 'AccountNickName')

    # 输入员工电话
    def input_account_phone(self, content):
        self.element.element_clear('AccountManage', 'AccountPhone')
        self.element.click_element('AccountManage', 'AccountPhone')
        self.element.input_element('AccountManage', 'AccountPhone', content)

    # 点击角色下拉菜单
    def click_role_select(self):
        self.element.js_click_element('AccountManage', 'AccountRole')

    # 点击等级下拉菜单
    def click_level_select(self):
        self.element.js_click_element('AccountManage', 'AccountLevel')

    # 选择角色
    def select_role_and_level(self):
        self.element.get_ul_li('AccountManage', 'RoleAndLevelList')

    # 点击创建员工按钮
    def click_create_btn(self):
        self.element.click_element('AccountManage', 'CreateAccountBtn')

    # 获取员工列表中的员工姓名
    def get_account_name(self):
        return self.element.get_element_text('AccountManage',
                                             'AccountListName')

    # 获取员工列表中的员工电话
    def get_account_phone(self):
        return self.element.get_element_text('AccountManage',
                                             'AccountListPhone')