Пример #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
Пример #2
0
class Slip(object):
    def __init__(self):
        self.dr = GetDriver().dr  #注意加GetDriver()用的是方法,而不是GetDriver类

    def GetSize(self):
        x = self.dr.get_window_size()['width']
        y = self.dr.get_window_size()['height']
        return (x, y)

    def Swipe_up(self):
        self.dr.swipe(20, 1500, 20, 20, 2000)
Пример #3
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
Пример #4
0
class SettingPage(object):
    #将GetDriver()的方法拿过来用
    def __init__(self):
        self.dr = GetDriver().dr  #注意加GetDriver()用的是方法,而不是GetDriver类

    #定位“退出登录”
    def Logout(self):
        try:
            self.logout = self.dr.find_element_by_xpath("//*[@text='退出登录']")
        except Exception as error:
            assert False, '未找到元素:退出登陆'
        return self.logout

    #定位修改密码
    def ResetPassword(self):
        pass

    #定位清空缓存
    def ClearCache(self):
        pass

    #定位意见返馈
    def Feedback(self):
        pass

    #定位关于我们
    def AboutUs(self):
        pass
Пример #5
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
Пример #6
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, '未找到取消按钮'
Пример #7
0
class Move(object):
    def __init__(self):
        self.dr = GetDriver().dr
        self.x = self.dr.get_window_size()['width']
        self.y = self.dr.get_window_size()['height']

    def Move_left(self):
        self.move_left = self.dr.swipe(self.x * 0.9, self.y * 0, self.x * 0.1,
                                       self.y * 0, 1000)
        return self.move_left

    def Move_right(self):
        self.move_right = self.dr.swipe(self.x * 0.1, self.y * 0, self.x * 0.9,
                                        self.y * 0, 1000)
        return self.move_right

    def Move_up(self):
        self.move_up = self.dr.swipe(self.x * 0, self.y * 0.9, self.x * 0,
                                     self.y * 0.1, 1000)
        return self.move_up

    def Move_down(self):
        self.move_down = self.dr.swipe(self.x * 0, self.y * 0.1, self.x * 0.1,
                                       self.y * 0.9, 1000)
        return self.move_down
Пример #8
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')
Пример #9
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
Пример #10
0
class MyPage(object):
    #将GetDriver()的方法拿过来用
    def __init__(self):
        self.dr = GetDriver().dr  #注意加GetDriver()用的是方法,而不是GetDriver类

    #定位“设置”
    def Setting(self):
        try:
            self.setting = self.dr.find_element_by_xpath('"//*[@text="设置"]"')
        except Exception as error:
            assert False, '未找到元素:用户名'
        return self.setting

    #定位消息通知
    def Message(self):
        pass

    #定位报事
    def Baoshi(self):
        pass

    #d定位累计工单
    def Leijigd(self):
        pass

    #定位累计投诉
    def Leijits(self):
        pass

    #定位累计咨询
    def Leijizx(self):
        pass

    #定位个人信息
    def PersonMessage(self):
        pass
Пример #11
0
 def __init__(self):
     self.dr = GetDriver().dr
Пример #12
0
class Home_Index(object):
    def __init__(self):
        self.dr = GetDriver().dr

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def BaoXiu(self):
        try:
            self.baoxiu = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.baoxiu

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei

    def JiaoFei(self):
        try:
            self.jiaofei = self.dr.find_element_by_xpath('')
        except Exception as error:
            assert False, '未找到改元素'
        return self.jiaofei
Пример #13
0
 def __init__(self):
     self.dr = GetDriver().dr
     self.x = self.dr.get_window_size()['width']
     self.y = self.dr.get_window_size()['height']
Пример #14
0
 def setUpClass(cls):
     cls.dr = GetDriver().dr
Пример #15
0
 def tearDownClass(cls):  # 所有case后运行
     GetDriver().dr.close_app()
Пример #16
0
 def setUpClass(cls):  #所有条case前执行一次
     cls.dr = GetDriver().dr
Пример #17
0
 def __init__(self):
     self.dr = GetDriver().dr  #注意加GetDriver()用的是方法,而不是GetDriver类