Esempio n. 1
0
def clean_window():
    try:
        check.wait_element("n,商城")
        oper.click("n,商城")
        check.wait_element("i,com.xingjiabi.shengsheng:id/ivClose")
        oper.click("i,com.xingjiabi.shengsheng:id/ivClose")
        check.wait_element("n,我")
    except Exception as e:
        oper.log("清理弹窗页面失败:" + str(e), 2)
Esempio n. 2
0
def clean_init():
    try:
        check.wait_element("i,com.xingjiabi.shengsheng:id/tvGuideLogin")
        check.exist_element("i,com.xingjiabi.shengsheng:id/tvGuideLogin")
        oper.driver_wait_click("i,com.xingjiabi.shengsheng:id/tvGuideLogin")
        oper.action_press(x=0.5, y=0.95)
        check.wait_element("n,请选择性别")
        check.exist_element("n,请选择性别")
        oper.click("i,com.xingjiabi.shengsheng:id/ivSwitchGenderMan")
    except Exception as e:
        oper.log("清理初始化页面失败:" + str(e), 2)
Esempio n. 3
0
def login(phone, password=helper.read_config_item("account_info", "password")):
    """
    登录操作
    Args:
        phone: 电话号码,默认值配置文件的account_info的phone
        password: 密码,默认值配置文件的account_info的password
    Returns:
        True
    """
    check.wait_element("n,我")
    oper.click("n,我")
    check.wait_element("i,com.xingjiabi.shengsheng:id/btnUserLogin")
    oper.click("i,com.xingjiabi.shengsheng:id/btnUserLogin")
    check.wait_element(
        "x,//android.widget.TextView[@resource-id='com.xingjiabi.shengsheng:id/tvXjbLoginTab']"
    )
    oper.click(
        "x,//android.widget.TextView[@resource-id='com.xingjiabi.shengsheng:id/tvXjbLoginTab']"
    )
    check.wait_element("i,com.xingjiabi.shengsheng:id/xjb_login_name")
    oper.clear("i,com.xingjiabi.shengsheng:id/xjb_login_name")
    oper.send_keys("i,com.xingjiabi.shengsheng:id/xjb_login_name", phone)
    oper.clear("i,com.xingjiabi.shengsheng:id/xjb_login_psd")
    oper.send_keys("i,com.xingjiabi.shengsheng:id/xjb_login_psd", password)
    oper.click("i,com.xingjiabi.shengsheng:id/xjb_login_but")
    check.wait_element("n,我")
    check.assert_exist_element("n,我")
Esempio n. 4
0
def logout():
    check.wait_element("n,我")
    oper.click("n,我")
    check.wait_element("i,com.xingjiabi.shengsheng:id/ivMineToolbarSetting")
    oper.click("i,com.xingjiabi.shengsheng:id/ivMineToolbarSetting")
    check.wait_text("通用设置")
    oper.swipe_up()
    check.wait_element("i,com.xingjiabi.shengsheng:id/login_off_layout")
    oper.click("i,com.xingjiabi.shengsheng:id/login_off_layout")
    check.wait_element(
        "i,com.xingjiabi.shengsheng:id/md_buttonDefaultPositive")
    oper.click("i,com.xingjiabi.shengsheng:id/md_buttonDefaultPositive")
    check.wait_element_disappear(
        "i,com.xingjiabi.shengsheng:id/md_buttonDefaultPositive")
    check.assert_not_exist_element(
        "i,com.xingjiabi.shengsheng:id/mad_buttonDefaultPositive")
    # 退出设置模块
    check.wait_text("通用设置")
    check.assert_exist_text("通用设置")
    check.wait_element("i,com.xingjiabi.shengsheng:id/top_left_button")
    oper.click("i,com.xingjiabi.shengsheng:id/top_left_button")
    check.wait_element("n,我")
    check.assert_exist_element("n,我")
Esempio n. 5
0
 def input_key_event(self):
     location = self.dispose_location()
     oper.click(location)
     event_str = oper.KeyEvent(self.for_param()['key_code'])
     event_str.event()