Пример #1
0
    def test_05(self):
        """未注册手机号注册 注册成功"""
        driver = self.driver

        driver.find_elements_by_class_name("ant-input-lg")[0].send_keys(
            random_mobile())
        driver.find_element_by_class_name("btn-sendCode").click()
        sleep(2)
        mobile = driver.find_elements_by_class_name(
            "ant-input-lg")[0].get_attribute("value")
        driver.find_elements_by_class_name("ant-input-lg")[1].send_keys(
            redis_link(mobile))
        driver.find_element_by_xpath(
            "/html/body/div/section/section/div[3]/div/form/div[4]/div/div/span/button"
        ).click()

        sleep(2)
        #     设置密码  两次密码不一致校验
        driver.find_elements_by_class_name("ant-input-lg")[0].send_keys(
            "123456..")
        driver.find_elements_by_class_name("ant-input-lg")[1].send_keys(
            "123456..")
        # sleep(3)
        # password_hint = driver.find_element_by_class_name("ant-form-explain").text
        driver.find_elements_by_class_name("ant-btn-block")[0].click()
        sleep(2)
        try:
            get_windows_img(driver)
        except Exception:
            get_windows_img(driver)
Пример #2
0
 def test_03(self):
     """未注册手机号注册 设置密码强度较弱"""
     driver = self.driver
     driver.find_elements_by_class_name("ant-input-lg")[0].send_keys(
         random_mobile())
     sleep(2)
     driver.find_element_by_class_name("btn-sendCode").click()
     mobile = driver.find_elements_by_class_name(
         "ant-input-lg")[0].get_attribute("value")
     print(mobile, "输入框的手机号")
     print(type(mobile), "输入框的手机号类型")
     sleep(2)
     driver.find_elements_by_class_name("ant-input-lg")[1].send_keys(
         redis_link(mobile))
     driver.find_element_by_xpath(
         "/html/body/div/section/section/div[3]/div/form/div[4]/div/div/span/button"
     ).click()
     sleep(2)
     #     设置密码  两次密码不一致校验
     driver.find_elements_by_class_name("ant-input-lg")[0].send_keys(
         "123456789")
     driver.find_elements_by_class_name("ant-input-lg")[1].send_keys(
         "123456789")
     sleep(3)
     password_hint = driver.find_element_by_class_name(
         "ant-form-explain").text
     #
     try:
         self.assertIn("密码强度较弱", password_hint)
         get_windows_img(driver)
     except Exception:
         get_windows_img(driver)
Пример #3
0
    def test_02(self):
        """更改绑定手机号"""
        driver = self.driver
        # 获取当前绑定手机号
        value = driver.find_elements_by_class_name("text-darkgrey")[1].text
        # 使用 re 提取出手机号
        value = re.match("(\d+)", value)

        driver.find_elements_by_class_name("accountDatumBtn")[0].click()
        driver.find_element_by_class_name("ant-btn-background-ghost").click()
        sleep(3)
        # 根据手机号发送验证码
        driver.find_element_by_id("userCode").send_keys(
            redis_link(value.group(0)))
        driver.find_elements_by_class_name("ant-btn-primary")[1].click()
        sleep(3)
        #重置手机号
        driver.find_element_by_id("userPhone").send_keys(random_mobile())
        # 获取手机文本框手机号
        mobile = driver.find_element_by_id("userPhone").get_attribute("value")
        # 点击发送
        driver.find_element_by_class_name("ant-btn-background-ghost").click()

        # 根据获取手机号,从redis中获取验证码
        sleep(2)
        driver.find_element_by_id("userCode").send_keys(redis_link(mobile))
        # 点击提交
        driver.find_element_by_xpath(
            '//*[@id="__next"]/section/section/section/main/form/div[3]/div/div/span/div/button'
        ).click()
        sleep(5)
        # 截图
        get_windows_img(driver)
Пример #4
0
    def test_01(self):
        """更改昵称"""

        driver = self.driver
        driver.find_elements_by_class_name(
            "ant-btn-background-ghost")[1].click()
        value = "昵称" + str(random_mobile())
        driver.find_element_by_id("userName").clear()
        driver.find_element_by_id("userName").send_keys(value)
        driver.find_element_by_xpath(
            "/html/body/div[2]/div/div[2]/div/div[2]/div/form/div[2]/div/div/span/div/button[2]"
        ).click()
        sleep(5)
        self.assertIn("", "")
        get_windows_img(driver)
Пример #5
0
    def test_02(self):
        """账户不存在登录"""

        driver = self.driver
        driver.find_element_by_xpath('//*[@id="mobile"]').send_keys(
            random_mobile())
        driver.find_element_by_xpath('//*[@id="password"]').send_keys(
            "123456..")
        driver.find_element_by_xpath(
            '//*[@id="__next"]/section/main/aside/div[2]/div/div[3]/div[1]/form/div[3]/button'
        ).click()
        sleep(3)
        text = driver.find_element_by_xpath(
            '//*[@id="__next"]/section/main/aside/div[2]/div/div[3]/div[1]/form/div[1]/div/div/div'
        ).text

        try:
            self.assertEqual(text, "账户不存在")
            get_windows_img(driver)
        except Exception as e:
            raise "账户不存在出错%s" % e
    def test_02(self):
        """新增供应商"""
        driver = self.driver
        try:
            driver.find_element_by_link_text("供应商列表").click()
            sleep(2)
            driver.find_elements_by_class_name("ant-btn-primary")[1].click()
            sleep(2)
            # 输入客户名称
            driver.find_element_by_id("userName").send_keys(random_str())
            # 联系人
            str = random_str()
            driver.find_element_by_id("usercontacts").send_keys(str)
            # 手机号码
            driver.find_element_by_id("userPhone").send_keys(random_mobile())
            # 所在地选择
            driver.find_elements_by_class_name(
                "ant-select-selection__rendered")[0].click()
            sleep(2)
            # 随机选择省份  城市先不选 选择默认
            driver.find_elements_by_class_name(
                "ant-select-dropdown-menu-item")[random_key()].click()
            # 输入详细地址
            # 从所在地输入框中选择
            address = driver.find_element_by_id("address").text
            driver.find_element_by_id("detailAddress").send_keys(address)

            # 点击完成按钮  不用点完成按钮 没找到原因
            # driver.find_elements_by_class_name("primary")[1].click()
            sleep(5)

            text = driver.find_element_by_xpath(
                "/html/body/div[1]/section/section/section/main/aside[2]/div/div/div[1]/div/div/div/div/div/table/tbody/tr[1]/td[2]"
            ).text

            self.assertIn(str, text)
            get_windows_img(driver)
        except Exception:
            get_windows_img(driver)
    def test_04(self):
        """清空按钮校验"""
        driver = self.driver

        driver.find_element_by_link_text("客户列表").click()
        # 输入名称,姓名,手机号
        driver.find_elements_by_class_name("ant-input")[0].send_keys(
            random_str())
        driver.find_elements_by_class_name("ant-input")[1].send_keys(
            random_str())
        driver.find_elements_by_class_name("ant-input")[2].send_keys(
            random_mobile())

        # 点击清空按钮
        sleep(2)
        driver.find_elements_by_class_name("searchBtn")[1].click()
        sleep(2)
        text = driver.find_elements_by_class_name("ant-input")[0].text
        try:
            self.assertEqual("请输入", text)
            get_windows_img(driver)
        except Exception:
            get_windows_img(driver)