Beispiel #1
0
 def crm_job(self):
     time.sleep(2)
     t = 1
     Sin().driver.find_element_by_id("com.alibaba.android.rimet:id/home_bottom_tab_button_work").click()
     time.sleep(2)
     TouchAction(Sin().driver).press(x=1006, y=1917).move_to(x=1043, y=1288).release().perform()
     time.sleep(2)
     element = "//android.view.View[@content-desc='CRM开发版']"
     m = fengzhuang()
     m.swipe_element(element, t)
Beispiel #2
0
 def shaixuan(self):
     #Sin().driver.find_element_by_xpath(
     #   "//android.view.View[contains(@content-desc,'商家 今日新增')]").click()
     Sin().driver.find_element_by_xpath(
         "//android.widget.TextView[@content-desc='返回']").click()
     time.sleep(1)
     ele = Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='商家列表']/android.view.View/android.view.View/android.view.View/android.view.View[1]/android.view.View[5]/android.widget.EditText"
     )
     ele.click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='商家列表']/android.view.View/android.view.View/android.view.View/android.view.View[1]/android.view.View[3]/android.widget.EditText"
     ).send_keys("自动化-商家")
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='搜索']").click()
     time.sleep(1)
     i = 1
     f = 0
     a = 1
     list = []
     while i < 100:  # 筛选商家列表
         try:
             x = Sin().driver.find_element_by_xpath(
                 "//android.webkit.WebView[@content-desc='商家列表']/android.view.View/android.view.View/android.view.View/"
                 "android.view.View[2]/android.view.View[2]/android.view.View/android.view.View/android.view.View[%s]/android.view.View[1]"
                 % i)
             time.sleep(1)
             x2 = x.get_attribute(name='content-desc')
             list.append(x2)  # 把数据添加到数组列表
             #print(list)
             i = i + 1
             time.sleep(1)
             if i == 4 and a == 1:
                 b = 1
                 m = fengzhuang()
                 m.swipe_app(b)  #第一次滑动幅度小,滑动半条数据
                 a = a + 1
             if i > 4:
                 i = i - 1
                 b = 2
                 m = fengzhuang()
                 m.swipe_app(b)
                 if list[f] == list[f - 1]:
                     print("列表已滑到底部,无更多数据")
                     break
             f = f + 1
             time.sleep(1)
         except NoSuchElementException:
             f = f - 1
             print("我提交的报告列表读取完成,退出")
             break
     return list, f
Beispiel #3
0
 def swipe_app(self, i):
     #滑动app方法
     width = Sin().driver.get_window_size()['width']
     height = Sin().driver.get_window_size()['height']
     if i == 1:
         Sin().driver.swipe(width / 2, height * 0.4, width / 2,
                            height * 0.3)
         i = i + 1
     else:
         Sin().driver.swipe(width / 2, height * 0.4, width / 2,
                            height * 0.212)
Beispiel #4
0
 def login(self):
     Sin().driver.find_element_by_id(
         "com.alibaba.android.rimet:id/et_pwd_login").send_keys(
             "qweasdzxc807158")
     time.sleep(1)
     Sin().driver.find_element_by_id(
         "com.alibaba.android.rimet:id/tv").click()
     time.sleep(2)
     Sin().driver.find_element_by_xpath(
         "//android.widget.RelativeLayout[@content-desc='工作[1]']/android.widget.TextView"
     ).click()
     time.sleep(5)
Beispiel #5
0
 def crm_job(self):
     time.sleep(2)
     t1 = fengzhuang()
     t = 1
     Sin().driver.find_element_by_xpath(
         "//android.widget.RelativeLayout[@content-desc='工作[1]']/android.widget.TextView"
     ).click()
     time.sleep(2)
     TouchAction(Sin().driver).press(x=1006, y=1917).move_to(
         x=1043, y=1288).release().perform()
     time.sleep(2)
     element = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.widget.LinearLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.FrameLayout/com.uc.webview.export.WebView/com.uc.webkit.be/android.webkit.WebView/android.view.View/android.view.View[3]/android.view.View[2]/android.view.View[4]/android.view.View/android.view.View[1]/android.view.View"
     t1.swipe_element(element, t)
     time.sleep(3)
Beispiel #6
0
 def swipe_element(self, element, t):
     #封装的滑动页面寻找元素方法
     width = Sin().driver.get_window_size()['width']
     height = Sin().driver.get_window_size()['height']
     i = 0
     while i < 10:
         try:
             if t == 1:  #点击按钮
                 Sin().driver.find_element_by_xpath(element).click()
             if t == 2:  #输入框
                 Sin().driver.find_element_by_xpath(element).send_keys(
                     "自动化测试")
             break
         except Exception as e:
             Sin().driver.swipe(width / 2, height * 0.4, width / 2,
                                height * 0.2)  # 滑动屏幕
             i = i + 1
Beispiel #7
0
    def yuangongbohao(self):
        Sin().driver.find_element_by_xpath(
            "	//android.widget.TextView[@content-desc='返回']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='商家员工']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[3]/android.view.View/android.view.View[1]/android.view.View/android.view.View/android.view.View[1]/android.view.View[6]"
        ).click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/"
            "android.widget.FrameLayout/android.support.v7.widget.LinearLayoutCompat/android.widget.FrameLayout/android.widget.ListView/android.widget.TextView[2]"
        ).click()
        time.sleep(2)
        t = Sin().driver.find_element_by_id("android:id/message").text

        Sin().driver.find_element_by_id("android:id/button1").click()

        return t
Beispiel #8
0
    def shaixuanqianke(self):
        Sin().driver.find_element_by_xpath(
           "//android.widget.TextView[@content-desc='返回']").click()
        #time.sleep(1)
        #Sin().driver.find_element_by_xpath(
          #  "//android.view.View[contains(@content-desc,'潜客 今日新增')]").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='潜客列表']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[1]/android.view.View[5]/android.widget.EditText").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='潜客列表']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[1]/android.view.View[3]/android.widget.EditText").send_keys("自动")
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='搜索']").click()
        time.sleep(2)

        i = 1
        f=0
        a = 1
        list = []
        while i < 100:
            try:
                x = Sin().driver.find_element_by_xpath(
                    "//android.webkit.WebView[@content-desc='潜客列表']/android.view.View/android.view.View/android.view.View/"
                    "android.view.View[2]/android.view.View/android.view.View/android.view.View/android.view.View[%s]/android.view.View[2]"%i)
                time.sleep(1)
                x2 = x.get_attribute(name='content-desc')
                list.append(x2)         #把数据添加到数组列表
                i = i+1
                time.sleep(1)
                if i == 4 and a == 1:
                    b = 1
                    m = fengzhuang()
                    m.swipe_app(b)      #第一次滑动幅度小,滑动半条数据
                    a = a+1

                if i > 4:
                    i = i - 1          #第二次及以上滑动整条数据
                    b = 2
                    m = fengzhuang()
                    m.swipe_app(b)

                if list[f] == "自动一":     #滑到到最后一条数据跳出循环
                    print("列表读取完成,退出")
                    break
                f = f + 1

            except NoSuchElementException:
                f = f - 1
                print("列表读取完成,退出")
                break
        #print(list)
        return list,f
Beispiel #9
0
    def shaixuan(self):
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='筛选']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='我提交的报告']").click()
        time.sleep(1)
        i = 1
        f = 0
        list = []
        list1 = []
        while i < 100:  # 筛选我提交的报告
            try:
                x = Sin().driver.find_element_by_xpath(
                    "//android.webkit.WebView[@content-desc='日报列表']/android.view.View/android.view.View/android.view.View/android.view.View[2]/"
                    "android.view.View/android.view.View/android.view.View/android.view.View[%s]/android.view.View[7]/android.view.View[1]" % i)
                r_time1 = Sin().driver.find_element_by_xpath(
                    "//android.webkit.WebView[@content-desc='日报列表']/android.view.View/android.view.View/android.view.View/"
                    "android.view.View[2]/android.view.View/android.view.View/android.view.View/android.view.View[%s]/android.view.View[3]" % i)
                time.sleep(1)
                x2 = x.get_attribute(name='content-desc')
                r_time = r_time1.get_attribute(name='content-desc')
                list.append(x2)  # 把数据添加到数组列表
                list1.append(r_time)
                # print(list1)
                i = i + 1
                time.sleep(1)
                if i > 4:
                    if i > 5:
                        i = i - 1
                    b = 2
                    m = fengzhuang()
                    m.swipe_app(b)
                    if list1[f] == list1[f - 1]:
                        print("列表已滑到底部,无更多数据")
                        break
                f = f + 1
                time.sleep(1)

            except NoSuchElementException:
                f = f - 1
                print("我提交的报告列表读取完成,退出")
                break
        print(list)
        return list,f
Beispiel #10
0
    def test_case07(self):
        "填写商家员工跟进情况"
        h = Login()
        g_time, t1, t4 = h.s_genjinqingkuang()

        time.sleep(0.5)
        try:
            self.assertEqual(t1, '操作成功')
            self.assertEqual(t4, '自动化测试')
            Sin().driver.find_element_by_xpath(
                "//android.view.View[@content-desc='%s']" % g_time)
            print(u"商家员工跟进情况保存成功")
        except AssertionError:
            print(u"商家员工跟进情况保存失败")
            raise
        time.sleep(2)
Beispiel #11
0
 def swipe(self, ele, n):
     #封装的滑动选择框方法
     w = ele.size['width']  #获取元素宽
     h = ele.size['height']  #获取元素高
     x = ele.location['x']  #获取元素起点x坐标
     y = ele.location['y']  #获取元素起点y坐标
     print(x, y)
     '''
     if m == 1:
         x1 = int(w / 2)
     if m == 2:
         x1 = int(w)
     if m == 3:
         x1 = int(w * 2)
     '''
     x1 = int(x)
     y1 = int(h / 5 * 1.7 + y)
     y2 = int(h / 5 * 1 + y)
     #print(x1, y1, y2)
     # 连续滑动n次
     for i in range(n):
         Sin().driver.swipe(x1, y1, x1, y2, 1000)
         time.sleep(1)
Beispiel #12
0
    def filtrate_type(self):
        Sin().driver.find_element_by_xpath(
           "//android.widget.TextView[@content-desc='返回']").click()
        #Sin().driver.find_element_by_xpath(
           # "//android.view.View[@content-desc='工作汇报']").click()
        time.sleep(1)

        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='日报']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='周报']").click()
        time.sleep(1)

        i = 1
        f = 0
        list = []
        list2 = []
        while i < 100:         #筛选周报
            try:
                x = Sin().driver.find_element_by_xpath(
                    "//android.webkit.WebView[@content-desc='日报列表']/android.view.View/android.view.View/android.view.View/"
                    "android.view.View[2]/android.view.View/android.view.View/android.view.View/android.view.View[%s]/android.view.View[5]" % i)
                r_time1 = Sin().driver.find_element_by_xpath(
                    "//android.webkit.WebView[@content-desc='日报列表']/android.view.View/android.view.View/android.view.View/"
                    "android.view.View[2]/android.view.View/android.view.View/android.view.View/android.view.View[%s]/android.view.View[3]" % i)

                time.sleep(1)
                r_time = r_time1.get_attribute(name='content-desc')
                x2 = x.get_attribute(name='content-desc')
                list.append(x2)  # 把数据添加到数组列表
                list2.append(r_time)
                i = i + 1
                time.sleep(1)
                if i > 4:
                    if i > 5:
                        i = i - 1
                    b = 2
                    m = fengzhuang()
                    m.swipe_app(b)
                    if list2[f] == list2[f - 1]:
                        print("列表已滑到底部,无更多数据")
                        break
                f = f + 1
            except NoSuchElementException:
                f = f - 1
                print("周报列表读取完成,退出")
                break
        print(list)
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='周报']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='月报']").click()
        time.sleep(1)
        n = 1
        k = 0
        list1 = []
        list3 = []
        while n < 9:  # 筛选月报
            try:
                x = Sin().driver.find_element_by_xpath(
                    "//android.webkit.WebView[@content-desc='日报列表']/android.view.View/android.view.View/android.view.View/"
                    "android.view.View[2]/android.view.View/android.view.View/android.view.View/android.view.View[%s]/android.view.View[4]" % n)
                r_time1 = Sin().driver.find_element_by_xpath(
                    "//android.webkit.WebView[@content-desc='日报列表']/android.view.View/android.view.View/android.view.View/"
                    "android.view.View[2]/android.view.View/android.view.View/android.view.View/android.view.View[%s]/android.view.View[3]" % n)

                time.sleep(1)
                r_time = r_time1.get_attribute(name='content-desc')
                x2 = x.get_attribute(name='content-desc')
                list1.append(x2)  # 把数据添加到数组列表
                list3.append(r_time)
                n = n + 1
                time.sleep(1)
                if n > 4:
                    if n > 5:
                        n = n - 1
                    b = 2
                    m = fengzhuang()
                    m.swipe_app(b)
                    if list3[k] == list3[k - 1]:
                        print("列表已滑到底部,无更多数据")
                        break
                k = k + 1
            except NoSuchElementException:
                k = k - 1
                print("月报列表读取完成,退出")
                break
        print(list1)

        return list,f,list1,k
Beispiel #13
0
    def xinzengshangjia(self):
        Sin().driver.find_element_by_xpath(
            "(//android.view.View[@content-desc='进入'])[3]").click()
        time.sleep(2)
        try:
            Sin().driver.find_element_by_xpath(
                "//android.view.View[@content-desc='新建商家']").click()
        except WebDriverException:
            print("出错啦")
            time.sleep(1)
            Sin().driver.find_element_by_xpath(
                "//android.view.View[@content-desc='新建商家']").click()
        #i=datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
        i = str(random.randint(1, 10000000))
        t = "商家" + i
        m = "自动化"
        mobile = m + "-" + t
        time.sleep(2)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增商家']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[2]/android.view.View[3]/android.widget.EditText"
        ).send_keys(m)

        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增商家']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[3]/android.view.View[3]/android.widget.EditText"
        ).send_keys(t)
        '''
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增商家']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[4]/android.view.View[3]/android.widget.EditText").send_keys(i)
        '''

        time.sleep(2)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='请选择商户类型']").click()
        time.sleep(2)

        ele = Sin().driver.find_element_by_xpath(
            '//android.webkit.WebView[@content-desc="新增商家"]/android.view.View/'
            'android.view.View/android.view.View/android.view.View[4]/android.view.View[4]/android.view.View/android.view.View[2]/android.view.View'
        )
        n = 3
        m = fengzhuang()
        m.swipe(ele, n)
        time.sleep(2)
        TouchAction(Sin().driver).tap(x=976, y=1442).perform()
        #self.driver.find_element_by_xpath(
        #   "//android.widget.Button[@content-desc='确认']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='请选择区域']").click()
        time.sleep(2)
        n = 1
        ele = Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增商家']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[5]/android.view.View[4]/android.view.View/android.view.View[2]/android.view.View[2]"
        )
        m.swipe(ele, n)
        time.sleep(2)

        n1 = 1
        ele1 = Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增商家']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[5]/android.view.View[4]/android.view.View/android.view.View[2]/android.view.View[3]"
        )
        m.swipe(ele1, n1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='确认']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='请选择']").click()
        time.sleep(2)
        n2 = 1
        ele2 = Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增商家']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[9]/android.view.View[3]/android.view.View/android.view.View[2]/android.view.View"
        )
        m.swipe(ele2, n2)
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='确认']").click()
        time.sleep(1)
        try:
            Sin().driver.find_element_by_xpath(
                "//android.webkit.WebView[@content-desc='新增商家']/android.view.View/"
                "android.view.View/android.view.View/android.view.View[6]/android.view.View[3]/android.widget.EditText"
            ).send_keys("广东八块钱")
        except NoSuchElementException:
            Sin().driver.find_element_by_xpath(
                "//android.webkit.WebView[@content-desc='新增商家']/android.view.View/"
                "android.view.View/android.view.View/android.view.View[6]/android.view.View[3]/android.widget.EditText"
            ).send_keys("广东八块钱")
        time.sleep(1)

        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增商家']/android.view.View/android.view.View/android.view.View/android.view.View[7]/android.view.View[4]"
        ).click()
        time.sleep(1)

        #定位地点微调
        Sin().driver.find_element_by_xpath(
            "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.ImageView"
        ).click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout[1]/android.view.ViewGroup/android.support.v7.widget.LinearLayoutCompat/android.widget.SearchView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.EditText"
        ).click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout[1]/android.view.ViewGroup/android.support.v7.widget.LinearLayoutCompat/android.widget.SearchView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.EditText"
        ).send_keys("威尼斯")
        time.sleep(1.5)
        TouchAction(Sin().driver).tap(x=976, y=2088).perform()
        time.sleep(1)
        TouchAction(Sin().driver).tap(x=599, y=263).perform()
        time.sleep(1)
        TouchAction(Sin().driver).tap(x=1013, y=154).perform()
        time.sleep(1)

        try:
            Sin().driver.find_element_by_xpath(
                "(//android.widget.RadioButton[@content-desc=''])[5]").click(
                )
        except WebDriverException:
            time.sleep(1)
            Sin().driver.find_element_by_xpath(
                "(//android.widget.RadioButton[@content-desc=''])[5]").click(
                )

        time.sleep(2)
        #TouchAction(self.driver).press(x=924, y=2046).move_to(x=946, y=1756).release().perform()
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增商家']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[11]/android.view.View[2]/android.widget.EditText"
        ).send_keys("1")
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增商家']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[10]/android.view.View[2]/android.widget.EditText"
        ).send_keys("1")
        time.sleep(1)
        t1 = 1
        element = "//android.widget.CheckBox[@content-desc='日式']"
        m.swipe_element(element, t1)
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.CheckBox[@content-desc='中式现代']").click()

        time.sleep(2)
        t = 1
        element1 = "//android.view.View[@content-desc='之前活动参与情况']"
        m.swipe_element(element1, t)
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增商家']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[3]/android.view.View[2]/android.widget.EditText"
        ).send_keys("自动化测试")
        time.sleep(2)
        Sin().driver.find_element_by_accessibility_id("添加").click()
        #time.sleep(1)
        try:
            #t = Sin().driver.find_element_by_xpath("//android.webkit.WebView[@content-desc='商家详情']/android.view.View/android.view.View[2]/android.view.View")
            t = WebDriverWait(Sin().driver, 10).until(
                EC.visibility_of_element_located((
                    By.XPATH,
                    "//android.webkit.WebView[@content-desc='商家详情']/android.view.View/android.view.View[2]/android.view.View"
                )))
            t1 = t.get_attribute(name='content-desc')
            t2 = Sin().driver.find_element_by_xpath(
                "//android.view.View[contains(@content-desc,'自动化-商家')]")
            t4 = t2.get_attribute(name='content-desc')
        except NoSuchElementException:
            time.sleep(0.5)
            t = Sin().driver.find_element_by_xpath(
                "//android.webkit.WebView[@content-desc='商家详情']/android.view.View/android.view.View[2]/android.view.View"
            )
            t1 = t.get_attribute(name='content-desc')
            t2 = Sin().driver.find_element_by_xpath(
                "//android.view.View[contains(@content-desc,'自动化-商家')]")
            t4 = t2.get_attribute(name='content-desc')
        print(t1)
        return mobile, t1, t4
Beispiel #14
0
    def baifangjilu_qiantui(self):
        TouchAction(Sin().driver).tap(x=374, y=1338).perform()  #模拟坐标点击签到记录
        time.sleep(1)
        ele = Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='拜访签退']/android.view.View/android.view.View/android.view.View/android.view.View[4]/android.view.View[3]/android.widget.EditText"
        )
        ele.click()
        ele1 = ele.get_attribute('text')
        t = fengzhuang()
        t.edittextclear(ele1)
        ele.send_keys("自动化拜访(签退测试)")
        time.sleep(1)
        TouchAction(Sin().driver).tap(x=981, y=1442).perform()  #模拟坐标点击收起键盘
        time.sleep(1)
        TouchAction(Sin().driver).tap(x=986, y=1439).perform()
        time.sleep(50)
        try:
            Sin().driver.find_element_by_xpath(
                "//android.widget.Button[contains(@content-desc,'签退')]").click(
                )
        except NoSuchElementException:
            time.sleep(5)
            Sin().driver.find_element_by_xpath(
                "//android.widget.CheckBox[contains(@content-desc,'签退')]"
            ).click()
        t = WebDriverWait(Sin().driver, 10).until(
            EC.visibility_of_element_located((
                By.XPATH,
                "//android.webkit.WebView[@content-desc='拜访记录']/android.view.View/android.view.View[2]/android.view.View"
            )))
        # t = Sin().driver.find_element_by_xpath("//android.view.View[@content-desc='签退成功']")
        t1 = t.get_attribute(name='content-desc')
        print(t1)
        time.sleep(0.5)
        t2 = Sin().driver.find_element_by_xpath(
            "//android.view.View[contains(@content-desc,'已签退')]")
        t4 = t2.get_attribute(name='content-desc')
        t3 = Sin().driver.find_element_by_xpath(
            "//android.view.View[contains(@content-desc,'自动化拜访')]")
        t5 = t3.get_attribute(name='content-desc')

        return t1, t4, t5
Beispiel #15
0
    def xinzengqianke(self):

        t = fengzhuang()
        name = t.name()
        qianke_name = "自动"+name
        time.sleep(2)
        TouchAction(Sin().driver).tap(x=72, y=159).perform()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "(//android.view.View[@content-desc='进入'])[1]").click()
        time.sleep(2)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='新建潜客']").click()
        time.sleep(2)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='添加潜客']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[2]/android.view.View[3]/android.widget.EditText").send_keys(qianke_name)
        time.sleep(1)

        tel = t.tel()
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='添加潜客']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[3]/android.view.View[3]/android.widget.EditText").send_keys(tel)
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "(//android.view.View[@content-desc='请选择'])[1]").click()
        time.sleep(1)
        n=1
        ele=Sin().driver.find_element_by_xpath("//android.webkit.WebView[@content-desc='添加潜客']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[4]/android.view.View[4]/android.view.View/android.view.View[2]/android.view.View")
        t.swipe(ele,n)
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='确认']").click()
        '''
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "(//android.view.View[@content-desc='请选择'])[1]").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='添加潜客']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[10]/android.view.View[2]/android.view.View/android.view.View/android.view.View/android.view.View[1]").click()
        '''
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='请选择']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='确认']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "(//android.widget.RadioButton[@content-desc=''])[2]").click()
        time.sleep(1)
        try:
            Sin().driver.find_element_by_xpath(
                "//android.webkit.WebView[@content-desc='添加潜客']/android.view.View/android.view.View/android.view.View/"
                "android.view.View[8]/android.view.View[3]/android.widget.EditText").send_keys("自动化楼盘")
        except WebDriverException:
            time.sleep(1)
            Sin().driver.find_element_by_xpath(
                "//android.webkit.WebView[@content-desc='添加潜客']/android.view.View/android.view.View/android.view.View/"
                "android.view.View[8]/android.view.View[3]/android.widget.EditText").send_keys("自动化楼盘")
        time.sleep(1.5)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='展开更多']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='添加潜客']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[10]/android.view.View[2]/android.widget.EditText").send_keys("111")
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='保存']").click()
        #time.sleep(1)
        #t = Sin().driver.find_element_by_xpath(
         #  "//android.webkit.WebView[@content-desc='潜客详情']/android.view.View/android.view.View[2]/android.view.View")
        #Sin().driver.refresh()
        #time.sleep(0.4)

        #time.sleep(0.5)
        '''
        try:
            t = Sin().driver.find_element_by_xpath(
                  "//android.webkit.WebView[@content-desc='潜客详情']/android.view.View/android.view.View[2]/android.view.View")
        except NoSuchElementException:
            time.sleep(0.5)
            t = Sin().driver.find_element_by_xpath(
                "//android.webkit.WebView[@content-desc='潜客详情']/android.view.View/android.view.View[2]/android.view.View")
        '''
        t = WebDriverWait(Sin().driver, 10).until(
               EC.visibility_of_element_located((By.XPATH, "//android.webkit.WebView[@content-desc='潜客详情']/android.view.View/android.view.View[2]/android.view.View")))


        #except (StaleElementReferenceException,TimeoutException):
          #  print("nihao")
            ##Sin().driver.refresh()
        #t = WebDriverWait(Sin().driver, 5).until(
         #    EC.presence_of_element_located((By.XPATH, "//android.webkit.WebView[@content-desc='潜客详情']/android.view.View/android.view.View[2]/android.view.View"))).get_attribute(name='content-desc')
        #print("t="+t)


       #t1 = t.get_attribute(name='content-desc')
            #time.sleep(1)
        t1 = t.get_attribute(name='content-desc')

        #t = Sin().driver.find_element_by_xpath("//android.view.View[@content-desc='操作成功']")

        t2 = Sin().driver.find_element_by_xpath("//android.view.View[contains(@content-desc,'自动')]")
        t4 = t2.get_attribute(name='content-desc')
        t5 = Sin().driver.find_element_by_xpath("//android.view.View[contains(@content-desc,'%s')]" % tel)
        t6 = t5.get_attribute(name='content-desc')
        print(t1)
        return t4,t6,tel,qianke_name
Beispiel #16
0
    def qiankechachong(self):
        TouchAction(Sin().driver).tap(x=82, y=176).perform()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='客户查重']").click()
        time.sleep(1)
        mobile = '15033174430'
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='查重']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[2]/android.widget.EditText").send_keys(mobile)
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='查重']").click()
        time.sleep(1)
        t = Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='查重']/android.view.View/"
            "android.view.View/android.view.View/android.view.View[2]/android.view.View/android.view.View[1]"
        )
        t1 = t.get_attribute(name='content-desc')
        time.sleep(1)
        t2 = Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='查重']/android.view.View/"
            "android.view.View/android.view.View/android.view.View[2]/android.view.View/android.view.View[4]/android.view.View[1]"
        )
        t3 = t2.get_attribute(name='content-desc')
        time.sleep(1)
        t4 = Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='查重']/android.view.View/"
            "android.view.View/android.view.View/android.view.View[2]/android.view.View/android.view.View[4]/android.view.View[3]"
        )
        t5 = t4.get_attribute(name='content-desc')

        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='返回']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='查重']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[2]/android.view.View[2]/android.view.View[1]"
        ).click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='查重']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[2]/android.widget.EditText").send_keys(mobile)
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='查重']").click()
        time.sleep(1)
        t6 = Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='查重']/android.view.View/"
            "android.view.View/android.view.View/android.view.View[2]/android.view.View/android.view.View[1]"
        )
        t7 = t6.get_attribute(name='content-desc')
        return mobile, t1, t3, t5, t7
Beispiel #17
0
 def tearDownClass(self):
     print('结束测试客户查重')
     Sin().driver.quit()
Beispiel #18
0
    def xinzengyuangong(self):

        time.sleep(1)
        #i = str(random.randint(1, 10000000))
        mobile = "自动员工"
        t = fengzhuang()
        tel = t.tel()
        print(tel)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='商家员工']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='添加人员']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增员工']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[2]/android.view.View[3]/android.widget.EditText"
        ).send_keys(mobile)
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增员工']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[3]/android.view.View[3]/android.widget.EditText"
        ).send_keys(tel)
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增员工']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[4]/android.view.View[2]/android.widget.EditText"
        ).send_keys("软件测试工程师")
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增员工']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[5]/android.view.View[2]/android.widget.EditText"
        ).send_keys("广东湛江")
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.RadioButton[@content-desc='未婚']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新增员工']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[7]/android.view.View[2]/android.widget.EditText"
        ).send_keys("粤A888888")
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='添加']").click()
        #time.sleep(1)
        t = WebDriverWait(Sin().driver, 10).until(
            EC.visibility_of_element_located((
                By.XPATH,
                "//android.webkit.WebView[@content-desc='员工详情']/android.view.View/android.view.View[2]/android.view.View"
            )))
        #t = Sin().driver.find_element_by_xpath("//android.webkit.WebView[@content-desc='员工详情']/android.view.View/android.view.View[2]/android.view.View")
        t1 = t.get_attribute(name='content-desc')
        t2 = Sin().driver.find_element_by_xpath(
            "//android.view.View[contains(@content-desc,'自动员工')]")
        t4 = t2.get_attribute(name='content-desc')
        t3 = Sin().driver.find_element_by_xpath(
            "//android.view.View[contains(@content-desc,'手机号码')]")
        t5 = t3.get_attribute(name='content-desc')
        print(t1)
        return mobile, tel, t1, t4, t5
Beispiel #19
0
    def crm_job(self):
        try:
            login = Sin().driver.find_element_by_id(
                "com.alibaba.android.rimet:id/et_pwd_login")
            login1 = login.is_displayed()
            print(login1)
            if login1 == True:
                login.send_keys("qweasdzxc807158")
                time.sleep(1)
                Sin().driver.find_element_by_id(
                    "com.alibaba.android.rimet:id/tv").click()
        except NoSuchElementException:
            pass

        time.sleep(2)
        t = 1
        Sin().driver.find_element_by_id(
            "com.alibaba.android.rimet:id/home_bottom_tab_button_work").click(
            )
        #time.sleep(2)
        #TouchAction(Sin().driver).press(x=1006, y=1917).move_to(x=1043, y=1288).release().perform()
        time.sleep(2)

        # 范围时间
        d_time = datetime.datetime.strptime(
            str(datetime.datetime.now().date()) + '6:00', '%Y-%m-%d%H:%M')
        d_time1 = datetime.datetime.strptime(
            str(datetime.datetime.now().date()) + '8:00', '%Y-%m-%d%H:%M')

        # 当前时间
        n_time = datetime.datetime.now()
        time.sleep(1)
        if n_time > d_time and n_time < d_time1:
            element = "//android.view.View[@content-desc='CRM']"  #正式服
        else:
            element = "//android.view.View[@content-desc='CRM开发版']"  #测试服
        m = fengzhuang()
        m.swipe_element(element, t)
        time.sleep(3)
        try:  #寻找元素失败后等待1秒重新寻找
            t1 = WebDriverWait(Sin().driver, 10).until(
                EC.visibility_of_element_located(
                    (By.XPATH,
                     "//android.view.View[contains(@content-desc,'李和健')]")))
            t2 = t1.get_attribute(name='content-desc')
            t = Sin().driver.find_element_by_id(
                "com.alibaba.android.rimet:id/title").text
        except NoSuchElementException:
            time.sleep(1)
            t1 = Sin().driver.find_element_by_xpath(
                "//android.view.View[contains(@content-desc,'李和健')]")
            t2 = t1.get_attribute(name='content-desc')
            t = Sin().driver.find_element_by_id(
                "com.alibaba.android.rimet:id/title").text
        return t2, t
Beispiel #20
0
    def bianjishangjia(self):

        t1 = Sin().driver.find_element_by_xpath(
            "//android.view.View[contains(@content-desc,'自动化-商家')]")
        t2 = t1.get_attribute(name='content-desc')
        t3 = t2.split('-')[1]
        mobile1 = t3 + "(编辑)"
        mobile = "自动化-" + mobile1
        print(mobile)
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "(//android.view.View[@content-desc='编辑资料'])").click()
        time.sleep(1)
        ele2 = Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='编辑商家']/android.view.View/android.view.View/android.view.View/android.view.View[4]/android.view.View[3]/android.widget.EditText"
        )
        ele2.click()
        time.sleep(1)
        ele3 = ele2.get_attribute('text')
        t = fengzhuang()
        t.edittextclear(ele3)
        time.sleep(1)
        ele2.send_keys(mobile1)
        time.sleep(1)
        TouchAction(Sin().driver).tap(x=981, y=1442).perform()  # 模拟坐标点击收起键盘
        time.sleep(1)
        TouchAction(Sin().driver).tap(x=986, y=1439).perform()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc=\"编辑商家\"]/android.view.View/android.view.View/android.view.View/android.view.View[7]/android.view.View[2]"
        ).click()
        time.sleep(1)
        ele = Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='编辑商家']/android.view.View/android.view.View/android.view.View/android.view.View[7]/android.view.View[3]/android.widget.EditText"
        )
        ele.click()
        time.sleep(1)
        ele1 = ele.get_attribute('text')
        t.edittextclear(ele1)
        time.sleep(1)
        ele.send_keys("广东八块钱科技部")
        time.sleep(2)
        Sin().driver.find_element_by_xpath(
            "(//android.view.View[@content-desc='确定'])").click()
        time.sleep(0.5)
        t = Sin().driver.find_element_by_xpath(
            "//android.view.View[contains(@content-desc,'广东八块钱')]")
        t1 = t.get_attribute(name='content-desc')
        t2 = Sin().driver.find_element_by_xpath(
            "//android.view.View[contains(@content-desc,'自动化-商家')]")
        t4 = t2.get_attribute(name='content-desc')
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='跟进情况']").click()
        time.sleep(1)
        t5 = Sin().driver.find_element_by_xpath(
            "//android.view.View[contains(@content-desc,'变更为 自动化-商家')]")
        t6 = t5.get_attribute(name='content-desc')
        t7 = Sin().driver.find_element_by_xpath(
            "//android.view.View[contains(@content-desc,'广东八块钱变更为')]")
        t8 = t7.get_attribute(name='content-desc')
        return mobile, t1, t4, t6, t8
Beispiel #21
0
 def q_genjingqingkuang(self):
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='跟进情况']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='填写跟进']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "(//android.view.View[@content-desc='请选择'])[1]").click()
     time.sleep(1)
     t = fengzhuang()
     n = 1
     ele = Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='填写跟进']/android.view.View/android.view.View/android.view.View/"
         "android.view.View[2]/android.view.View[4]/android.view.View/android.view.View[2]/android.view.View")
     t.swipe(ele, n)
     time.sleep(1)
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.widget.Button[@content-desc='确认']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "(//android.view.View[@content-desc='请选择'])[1]").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.widget.Button[@content-desc='确认']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "(//android.view.View[@content-desc='请选择'])[1]").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.widget.Button[@content-desc='确认']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='请选择']").click()
     time.sleep(1)
     n1 = 1
     ele1 = Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='填写跟进']/android.view.View/android.view.View/android.view.View/"
         "android.view.View[5]/android.view.View[3]/android.view.View/android.view.View[2]/android.view.View")
     t.swipe(ele1, n1)
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.widget.Button[@content-desc='确认']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='填写跟进']/android.view.View/android.view.View/android.view.View/"
         "android.view.View[6]/android.view.View[3]/android.widget.EditText").send_keys("自动化测试(潜客跟进测试)")
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='确定']").click()
     #time.sleep(1)
     #t = Sin().driver.find_element_by_xpath("//android.view.View[@content-desc='跟进成功']")
     t = WebDriverWait(Sin().driver, 10).until(
         EC.visibility_of_element_located((By.XPATH, "//android.view.View[@content-desc='跟进成功']")))
     t1 = t.get_attribute(name='content-desc')
     t2 = Sin().driver.find_element_by_xpath("//android.view.View[contains(@content-desc,'自动化测试')]")
     t4 = t2.get_attribute(name='content-desc')
     return t1,t4
Beispiel #22
0
    def add_daily(self):
        TouchAction(Sin().driver).tap(x=82, y=176).perform()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='工作汇报']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='新增汇报']").click()
        time.sleep(1)
        #Sin().driver.find_element_by_xpath(
          #  "//android.widget.Button[@content-desc='新增日报']").click()
        TouchAction(Sin().driver).tap(x=540, y=1670).perform()
        time.sleep(1)

        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新建日报']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[3]/android.view.View/android.view.View[3]/android.widget.EditText").send_keys("自动化日报总结")
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新建日报']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[4]/android.view.View/android.view.View[3]/android.widget.EditText").send_keys("自动化日报计划")
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='选择文件']").click()
        time.sleep(1)
        Sin().driver.find_element_by_id("android:id/text1").click()
        time.sleep(1)
        Sin().driver.find_element_by_id("com.alibaba.android.rimet:id/checkbox").click()
        time.sleep(1)
        Sin().driver.find_element_by_id("com.alibaba.android.rimet:id/btn_send").click()
        time.sleep(1)
        t = fengzhuang()
        b = 2
        t.swipe_app(b)
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
           "//android.webkit.WebView[@content-desc='新建日报']/android.view.View/android.view.View/android.view.View/android.view.View[5]/android.view.View/android.view.View[4]").click()
        time.sleep(1)
        ele1 = Sin().driver.find_element_by_xpath("//android.webkit.WebView[@content-desc='新建日报']/android.view.View/"
            "android.view.View/android.view.View/android.view.View[6]/android.view.View[1]/android.view.View[2]")
        g = 14
        t.swipe(ele1, g)
        time.sleep(1)
        flag=Sin().driver.find_element_by_xpath("//android.webkit.WebView[@content-desc='新建日报']/android.view.View/" 
            "android.view.View/android.view.View/android.view.View[6]/android.view.View[1]/android.view.View[2]/android.view.View[22]/android.widget.CheckBox")
        ha = flag.get_attribute("checked")
        time.sleep(1)
        #print(ha)
        if ha == "false":   #判断按钮是否选中,返回的是String类型,不是boolean值
            Sin().driver.find_element_by_xpath(
                "//android.view.View[@content-desc='赵怡']").click()
        else:
            print("该按钮已选中,无需选择")
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='确定']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='提交']").click()
        #time.sleep(0.5)
        #h1 = Sin().driver.find_element_by_xpath("//android.view.View[@content-desc='发布成功']")
        h1 = WebDriverWait(Sin().driver, 10).until(
            EC.visibility_of_element_located((By.XPATH, "//android.view.View[@content-desc='发布成功']")))
        h = h1.get_attribute(name='content-desc')
        time.sleep(1)
        return h
Beispiel #23
0
    def filtrate_date(self):
        #Sin().driver.find_element_by_xpath(
        #    "//android.widget.TextView[@content-desc='返回']").click()
        #Sin().driver.find_element_by_xpath(
          #  "//android.view.View[@content-desc='工作汇报']").click()
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='新增汇报']").click()
        time.sleep(1)
        # Sin().driver.find_element_by_xpath(
        #  "//android.widget.Button[@content-desc='新增日报']").click()
        TouchAction(Sin().driver).tap(x=540, y=1670).perform()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新建日报']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[1]/android.view.View[4]").click()
        time.sleep(1)
        TouchAction(Sin().driver).tap(x=515, y=1821).perform()
        time.sleep(2)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新建日报']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[3]/android.view.View/android.view.View[3]/android.widget.EditText").send_keys("自动化日报总结")
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新建日报']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[4]/android.view.View/android.view.View[3]/android.widget.EditText").send_keys("自动化日报计划")

        time.sleep(1)
        t = fengzhuang()
        b = 2
        t.swipe_app(b)
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='提交']").click()
        time.sleep(2)
        TouchAction(Sin().driver).tap(x=82, y=176).perform()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='月报']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='日报']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='日期']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[contains(@content-desc,'昨天')]").click()
        time.sleep(1)
        i = 1
        f = 0
        list = []
        list1 = []
        while i < 100:  # 筛选昨天日报
            try:
                x = Sin().driver.find_element_by_xpath(
                    "//android.webkit.WebView[@content-desc='日报列表']/android.view.View/android.view.View/android.view.View/"
                    "android.view.View[2]/android.view.View/android.view.View/android.view.View/android.view.View[%s]/android.view.View[4]" % i)
                r_time1 = Sin().driver.find_element_by_xpath(
                    "//android.webkit.WebView[@content-desc='日报列表']/android.view.View/android.view.View/android.view.View/"
                    "android.view.View[2]/android.view.View/android.view.View/android.view.View/android.view.View[%s]/android.view.View[3]" % i)
                time.sleep(1)
                x2 = x.get_attribute(name='content-desc')
                r_time = r_time1.get_attribute(name='content-desc')
                list.append(x2)  # 把数据添加到数组列表
                list1.append(r_time)
                #print(list1)
                i = i + 1
                time.sleep(1)
                if i > 4:
                    if i >5:
                       i = i - 1
                    b = 2
                    m = fengzhuang()
                    m.swipe_app(b)
                    if list1[f] == list1[f - 1]:
                        print("列表已滑到底部,无更多数据")
                        break
                f = f + 1
                time.sleep(1)

            except NoSuchElementException:
                f = f - 1
                print("昨天日报列表读取完成,退出")
                break
        print(list)
        return list,f
Beispiel #24
0
 def bianjiqianke(self):
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='编辑资料']").click()
     time.sleep(1)
     ele2 = Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='编辑潜客']/android.view.View/android.view.View/android.view.View/"
         "android.view.View[2]/android.view.View[3]/android.widget.EditText")
     ele2.click()
     time.sleep(1)
     ele3 = ele2.get_attribute('text')
     t = fengzhuang()
     t.edittextclear(ele3)
     ele2.send_keys("自动编辑")
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='确定']").click()
     #time.sleep(0.5)
     t = WebDriverWait(Sin().driver, 10).until(
         EC.visibility_of_element_located((By.XPATH, "//android.view.View[@content-desc='操作成功']")))
     #t = Sin().driver.find_element_by_xpath("//android.view.View[@content-desc='操作成功']")
     t1 = t.get_attribute(name='content-desc')
     t2 = Sin().driver.find_element_by_xpath("//android.view.View[contains(@content-desc,'自动')]")
     t4 = t2.get_attribute(name='content-desc')
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='跟进情况']").click()
     time.sleep(1)
     t5 = Sin().driver.find_element_by_xpath("//android.view.View[contains(@content-desc,'变更为 自动')]")
     t6 = t5.get_attribute(name='content-desc')
     return t1,t4,t6
Beispiel #25
0
    def add_weekly(self):
        Sin().driver.find_element_by_xpath(
            "//android.widget.TextView[@content-desc='返回']").click()
        #Sin().driver.find_element_by_xpath(
           # "//android.view.View[@content-desc='工作汇报']").click()
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='新增汇报']").click()
        time.sleep(1)
        # Sin().driver.find_element_by_xpath(
        #  "//android.widget.Button[@content-desc='新增日报']").click()
        TouchAction(Sin().driver).tap(x=562, y=1813).perform()
        time.sleep(1)

        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新建周报']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[3]/android.view.View/android.view.View[3]/android.widget.EditText").send_keys("自动化周报总结")
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新建周报']/android.view.View/android.view.View/android.view.View/"
            "android.view.View[4]/android.view.View/android.view.View[3]/android.widget.EditText").send_keys("自动化周报计划")
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='选择文件']").click()
        time.sleep(1)
        Sin().driver.find_element_by_id("android:id/text1").click()
        time.sleep(1)
        Sin().driver.find_element_by_id("com.alibaba.android.rimet:id/checkbox").click()
        time.sleep(1)
        Sin().driver.find_element_by_id("com.alibaba.android.rimet:id/btn_send").click()
        time.sleep(1)
        t = fengzhuang()
        b = 2
        t.swipe_app(b)
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.webkit.WebView[@content-desc='新建周报']/android.view.View/android.view.View/android.view.View/android.view.View[5]/android.view.View/android.view.View[4]").click()
        time.sleep(1)

        flag = Sin().driver.find_element_by_xpath("//android.webkit.WebView[@content-desc='新建周报']/android.view.View/"
                "android.view.View/android.view.View/android.view.View[6]/android.view.View[1]/android.view.View[2]/android.view.View[2]/android.widget.CheckBox")
        ha = flag.get_attribute("checked")     #isSelected()判断选中没有效果
        time.sleep(1)
        print(ha)
        if ha == "false":  # 判断按钮是否选中,返回的是String类型,不是boolean值
            Sin().driver.find_element_by_xpath(
                "//android.webkit.WebView[@content-desc='新建周报']/android.view.View/android.view.View/android.view.View/"
                "android.view.View[6]/android.view.View[1]/android.view.View[2]/android.view.View[2]/android.widget.CheckBox").click()
        else:
            print("该按钮已选中,无需选择")
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='确定']").click()
        time.sleep(2)
        Sin().driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='提交']").click()
        #time.sleep(0.5)
        try:
            h1 = WebDriverWait(Sin().driver, 10).until(
                EC.visibility_of_element_located((By.XPATH, "//android.view.View[@content-desc='发布成功']")))
            h = h1.get_attribute(name='content-desc')
        except NoSuchElementException:
            print("该元素不存在")
        time.sleep(1)
        return h
Beispiel #26
0
 def baifangjilu_qiandao(self):
     Sin().driver.find_element_by_xpath(
         "	//android.widget.TextView[@content-desc='返回']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='拜访记录']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='新增拜访']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "	//android.view.View[@content-desc='拜访员工 ']").click()
     time.sleep(1.5)
     Sin().driver.find_element_by_xpath(
         "//android.widget.CheckBox[contains(@content-desc,'自动员工')]").click(
         )
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='确定']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='新增拜访']/android.view.View/android.view.View/android.view.View/"
         "android.view.View[4]/android.view.View[3]/android.widget.EditText"
     ).send_keys("自动化拜访")
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.widget.Button[@content-desc='选择文件']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.support.v7.widget.LinearLayoutCompat/android.widget.FrameLayout/android.widget.ListView/android.widget.TextView[1]"
     ).click()
     time.sleep(2)
     Sin().driver.find_element_by_id(
         "com.alibaba.android.rimet:id/checkbox").click()
     time.sleep(1)
     Sin().driver.find_element_by_id(
         "com.alibaba.android.rimet:id/btn_send").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.widget.Button[contains(@content-desc,'签到')]").click()
     #time.sleep(1)
     #t = Sin().driver.find_element_by_xpath("//android.view.View[@content-desc='签到成功']")
     t = WebDriverWait(Sin().driver, 10).until(
         EC.visibility_of_element_located((
             By.XPATH,
             "//android.webkit.WebView[@content-desc='拜访记录']/android.view.View/android.view.View[2]/android.view.View"
         )))
     t1 = t.get_attribute(name='content-desc')
     t2 = Sin().driver.find_element_by_xpath(
         "//android.view.View[contains(@content-desc,'未签退')]")
     t4 = t2.get_attribute(name='content-desc')
     return t1, t4
Beispiel #27
0
    def bianjiyuangong(self):
        TouchAction(Sin().driver).tap(x=607, y=981).perform()  #坐标模拟点击商家
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='编辑资料']").click()
        time.sleep(2)
        try:
            ele = Sin().driver.find_element_by_xpath(
                "//android.webkit.WebView[@content-desc='编辑员工']/android.view.View/android.view.View/android.view.View/android.view.View[4]/android.view.View[2]/android.widget.EditText"
            )
        except NoSuchElementException:
            ele = Sin().driver.find_element_by_xpath(
                "//android.webkit.WebView[@content-desc='编辑员工']/android.view.View/android.view.View/android.view.View/android.view.View[4]/android.view.View[2]/android.widget.EditText"
            )

        time.sleep(1)
        ele.click()
        time.sleep(1)
        ele1 = ele.get_attribute('text')
        t = fengzhuang()
        time.sleep(1)
        t.edittextclear(ele1)
        time.sleep(1)
        ele.send_keys("软件测试攻城狮")
        time.sleep(1)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='确定']").click()
        #time.sleep(0.5)
        t = WebDriverWait(Sin().driver, 10).until(
            EC.visibility_of_element_located(
                (By.XPATH, "//android.view.View[@content-desc='修改成功']")))
        #t = Sin().driver.find_element_by_xpath("//android.view.View[@content-desc='修改成功']")
        t1 = t.get_attribute(name='content-desc')
        t2 = Sin().driver.find_element_by_xpath(
            "//android.view.View[contains(@content-desc,'软件测试')]")
        t4 = t2.get_attribute(name='content-desc')
        time.sleep(2)
        Sin().driver.find_element_by_xpath(
            "//android.view.View[@content-desc='跟进情况']").click()
        time.sleep(1)
        t5 = Sin().driver.find_element_by_xpath(
            "//android.view.View[contains(@content-desc,'从 软件测试工程师变更为')]")
        t6 = t5.get_attribute(name='content-desc')
        return t1, t4, t6
Beispiel #28
0
 def s_genjinqingkuang(self):
     time.time()
     g_time = time.strftime('%Y-%m-%d', time.localtime(time.time()))
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='跟进情况']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='填写跟进']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "(//android.view.View[@content-desc='请选择'])[1]").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.widget.Button[@content-desc='确认']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "(//android.view.View[@content-desc='请选择'])[1]").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.widget.Button[@content-desc='确认']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "(//android.view.View[@content-desc='请选择'])[1]").click()
     time.sleep(2)
     n1 = 1
     t = fengzhuang()
     ele = Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='填写跟进']/android.view.View/android.view.View/android.view.View/"
         "android.view.View[5]/android.view.View[3]/android.view.View/android.view.View[2]/android.view.View[3]"
     )
     t.swipe(ele, n1)
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.widget.Button[@content-desc='确认']").click()
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='填写跟进']/android.view.View/android.view.View/android.view.View/"
         "android.view.View[6]/android.view.View[3]/android.widget.EditText"
     ).send_keys("自动化测试")
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='确定']").click()
     #time.sleep(1)
     #t = Sin().driver.find_element_by_xpath("//android.view.View[@content-desc='操作成功']")
     t = WebDriverWait(Sin().driver, 10).until(
         EC.visibility_of_element_located(
             (By.XPATH, "//android.view.View[@content-desc='操作成功']")))
     t1 = t.get_attribute(name='content-desc')
     t2 = Sin().driver.find_element_by_xpath(
         "//android.view.View[contains(@content-desc,'自动化测试')]")
     t4 = t2.get_attribute(name='content-desc')
     return g_time, t1, t4
Beispiel #29
0
 def shangjiachachong(self):
     Sin().driver.find_element_by_xpath(
         "//android.view.View[@content-desc='商家员工查重']").click()
     mobile = '13800135000'
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='查重']/android.view.View/android.view.View/android.view.View/"
         "android.view.View[2]/android.widget.EditText").send_keys(mobile)
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.widget.Button[@content-desc='查重']").click()
     time.sleep(1)
     t = Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='查重']/android.view.View/"
         "android.view.View/android.view.View/android.view.View[2]/android.view.View/android.view.View[1]"
     )
     t1 = t.get_attribute(name='content-desc')
     time.sleep(1)
     t2 = Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='查重']/android.view.View/"
         "android.view.View/android.view.View/android.view.View[2]/android.view.View/android.view.View[4]/android.view.View[1]"
     )
     t3 = t2.get_attribute(name='content-desc')
     time.sleep(1)
     t4 = Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='查重']/android.view.View/"
         "android.view.View/android.view.View/android.view.View[2]/android.view.View/android.view.View[4]/android.view.View[4]"
     )
     t5 = t4.get_attribute(name='content-desc')
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.widget.Button[@content-desc='返回']").click()
     mobile1 = '13800135088'
     Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='查重']/android.view.View/android.view.View/android.view.View/"
         "android.view.View[2]/android.widget.EditText").send_keys(mobile1)
     time.sleep(1)
     Sin().driver.find_element_by_xpath(
         "//android.widget.Button[@content-desc='查重']").click()
     time.sleep(1)
     t6 = Sin().driver.find_element_by_xpath(
         "//android.webkit.WebView[@content-desc='查重']/android.view.View/android.view.View/android.view.View/android.view.View[2]/android.view.View[1]"
     )
     t7 = t6.get_attribute(name='content-desc')
     return mobile, t1, t3, t5, t7
Beispiel #30
0
 def edittextclear(self, text):
     #封装的清除输入框方法
     Sin().driver.keyevent(123)
     for i in range(0, len(text)):
         Sin().driver.keyevent(67)