Exemple #1
0
class LoginPage(object):
    #将GetDriver()的方法拿过来用
    def __init__(self):
        self.dr = GetDriver().dr  #注意加GetDriver()用的是方法,而不是GetDriver类

    #定义定位用户名的方法
    def UserName(self):
        #尝试页面定位该元素,如果失败则弹出相关提示信息
        try:
            self.user = self.dr.find_element_by_id(
                'com.meilin.wulianbaogj:id/et_login_username')
        except Exception as error:
            assert False, '未找到元素:用户名'
        return self.user

    # 定义定位密码的方法
    def Password(self):
        # 尝试页面定位该元素,如果失败则弹出相关提示信息
        try:
            self.psd = self.dr.find_element_by_id(
                'com.meilin.wulianbaogj:id/et_login_password')
        except Exception as error:
            assert False, '未找到元素:密码'
        return self.psd

    # 定义定位登录按钮的方法
    def LoginBtn(self):
        # 尝试页面定位该元素,如果失败则弹出相关提示信息
        try:
            self.loginbtn = self.dr.find_element_by_id(
                'com.meilin.wulianbaogj:id/login_mian_btn')
        except Exception as error:
            assert False, '未找到元素:登录按钮'
        return self.loginbtn
Exemple #2
0
class BaosPage(object):
    #将GetDriver()的方法拿过来用
    def __init__(self):
        self.dr = GetDriver().dr  #注意加GetDriver()用的是方法,而不是GetDriver类
        #self.dr.hide_keyboard()  # 隐藏键盘

    #定位报事内容方法
    def Content(self):
        try:  #尝试寻找该元素,若找不到则给与提示
            self.content = self.dr.find_element_by_id(
                'com.meilin.wulianbaogj:id/content')
        except Exception as error:
            assert False, '未找到输入框'
        return self.content

    # #定义上传照片方法
    # def Uploadimage(self):
    #     try:#尝试寻找该元素,若找不到则给与提示
    #         self.uploadimage=self.dr.find_element_by_id('com.meilin.wulianbaogj:id/content')#(200,450)
    #         self.uploadimage=self.dr.f
    #     except Exception as error:
    #         assert False,'未找到图片上传元素'
    #     return self.uploadimage
    # #定义上传视频方法
    # def Uploadvideo(self):
    #     try:
    #         self.uploadvideo=self.dr.
    #定义上传语音方法
    def Noice(self):
        try:
            self.noice = TouchAction().long_press(
                'com.meilin.wulianbaogj:id/talkBtn', 4000)
        except Exception as error:
            assert False, "未找到按钮"
        return self.noice

    #定义备注方法
    def Notice(self):
        try:
            self.notice = self.dr.find_element_by_id(
                "com.meilin.wulianbaogj:id/remarkET")
        except Exception as error:
            assert False, "未找到按钮"
        return self.notice

    #定义提交方法
    def Sub(self):
        try:
            self.sub = self.dr.find_element_by_xpath("//*[@text='提交']")
        except Exception as error:
            assert False, '未找到提交按钮'
        return self.sub
Exemple #3
0
class CameraPage(object):
    #将GetDriver()的方法拿过来用
    def __init__(self):
        self.dr = GetDriver().dr  #注意加GetDriver()用的是方法,而不是GetDriver类

    #定义拍照方法
    def Shutter(self):
        try:
            self.shuutter = self.dr.find_element_by_id(
                'com.android.camera:id/v9_shutter_button_internal')
        except Exception as error:
            assert False, '未找到拍摄按钮'
        return self.shuutter

    #定义关闭方法
    def Close(self):
        pass

    #定义前后转换方法
    def Picker(self):
        pass

    #定义摄像
    def LongShutter(self):
        try:
            self.longshutter = self.dr.find_element_by_id(
                'com.android.camera:id/v9_shutter_button_internal')
        except Exception as error:
            assert False, '未找到录制按钮'

    #定义apply方法
    def Apply(self):
        try:
            self.apply = self.dr.find_element_by_id(
                'com.android.camera:id/inten_done_apply')
        except Exception as errot:
            assert False, '未找到确定按钮'

    #定义retry方法
    def Retry(self):
        try:
            self.retry = self.dr.find_element_by_id(
                'com.android.camera:id/intent_done_retry')
        except Exception as error:
            assert False, '未找到取消按钮'
Exemple #4
0
class BaoXiu_Index(object):
    def __init__(self):
        self.dr=GetDriver().dr
    def Voice_input(self):
        self.aaa=self.dr.find_element_by_id('com.meilin.wulianbao:id/iv_voice')
        try:
            self.voice_input=TouchAction(self.dr).long_press(self.aaa,5000).perform()
        except:
            Move().Move_up()
            self.dr.find_element_by_id('com.meilin.wulianbao:id/rr_voice').click()
        return self.voice_input
    def Write_input(self):
        try:
            self.write_input=self.dr.find_element_by_id('com.meilin.wulianbao:id/word')
        except:
            self.dr.find_element_by_id('com.meilin.wulianbao:id/rr_write').click()
        return self.write_input
    def Video_input(self):
        pass
    def BaoXiu_Button(self):
        try:
            self.baoxiu_button=self.dr.find_element_by_id('com.meilin.wulianbao:id/next_button')
        except Exception as error:
            assert False,'未找到按钮'
        return self.baoxiu_button
Exemple #5
0
class HomePage(object):
    #将GetDriver()的方法拿过来用
    def __init__(self):
        self.dr=GetDriver().dr#注意加GetDriver()用的是方法,而不是GetDriver类
    #定义在线报事的方法
    def BaoS(self):
    # 尝试页面定位该元素,如果失败则向上滑动屏幕
        try:
            self.baos= self.dr.find_element_by_id('com.meilin.wulianbaogj:id/rl_baoshi')
        except:
            Slip().UpSwipe()
        return self.baos
    #定义巡检方法
    def Xunjian(self):
        pass
    #定义巡查方法
    def Xuncha(self):
        pass
    #定义紧急任务方法
    def Jinj(self):
        pass
    #定位“我的”页入口
    def EnterMyPage(self):
        self.dr.find_element_by_id('com.meilin.wulianbaogj:id/mian_lil4')
Exemple #6
0
class Login_Index(object):
    def __init__(self):
        self.dr = GetDriver().dr

    def UserName(self):
        try:
            self.username = self.dr.find_element_by_id(
                'com.meilin.wulianbao:id/userId_EditText')
        except Exception as error:
            assert False, '未找到用户名输入框'
        return self.username

    def PassWord(self):
        try:
            self.password = self.dr.find_element_by_id(
                'com.meilin.wulianbao:id/password_EditText')
        except Exception as error:
            assert False, '未找到密码输入框'
        return self.password

    def RememberPassword(self):
        try:
            self.rememberpassword = self.dr.find_element_by_id(
                'com.meilin.wulianbao:id/regist_checkBox')
        except Exception as error:
            assert False, '未找记住密码复选框'
        return self.rememberpassword

    def ForgetPassword(self):
        try:
            self.forgetpassword = self.dr.find_element_by_id(
                'com.meilin.wulianbao:id/forgetPassword_textView')
        except Exception as error:
            assert False, '未找到忘记密码'
        return self.forgetpassword

    def LoginButton(self):
        try:
            self.loginbutton = self.dr.find_element_by_id(
                'com.meilin.wulianbao:id/next_button')
        except Exception as error:
            assert False, '未找到登录按钮'
        return self.loginbutton

    def Regist(self):
        try:
            self.regist = self.dr.find_element_by_id(
                'com.meilin.wulianbao:id/now_login')
        except Exception as error:
            assert False, '未找到注册'
        return self.regist