Exemple #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
Exemple #2
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
Exemple #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
Exemple #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
Exemple #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