Пример #1
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
Пример #2
0
 def follow_date(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)
     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/android.view.View/android.view.View/android.view.View[%s]/android.view.View[3]/android.view.View[3]"
                 % i)
             time.sleep(1)
             x2 = x.get_attribute(name='content-desc')
             list.append(x2)  # 把数据添加到数组列表
             print(list)
             i = i + 1
             time.sleep(1)
             if i == 5 and a == 1:
                 b = 1
                 m = fengzhuang()
                 m.swipe_app(b)  # 第一次滑动幅度小,滑动半条数据
                 a = a + 1
             if i > 5:
                 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
Пример #3
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
Пример #4
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
Пример #5
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