python之一登录场景

@allure.feature('定位辅助录入页面')
class TestClass_LogingInfo:
    @allure.story('打开APP进入新安装页面')
    def test_openapp_infologingpage(self):
        with allure.step("App_Sign_in_C01/App_Sign_in_C02/App_Sign_in_C03"):
            global driver_base
            driver_base = AppInfo.OpenApp()
            time.sleep(3)
            self.source = driver_base.page_source
            if "用户登录" in self.source:
                try:
                    user_name = AppInfo.read_config("scripts/common/config.yml").user_name()
                    driver_base.find_element_by_id("com.huanguo.moi:id/etLoginName").send_keys(user_name)
                    pwd = AppInfo.read_config("scripts/common/config.yml").pass_word()
                    driver_base.find_element_by_id("com.huanguo.moi:id/etLoginPwd").send_keys(pwd)
                    driver_base.find_element_by_id("com.huanguo.moi:id/btnLoginSubmit").click()
                except Exception as e:
                    allure.attach(driver_base.get_screenshot_as_png(), "登录失败", allure.attachment_type.PNG)
                    print(e)
                    assert "登录失败"
            time.sleep(5)
            source = driver_base.page_source
            if "允许" and "拒绝" in source:
                try:
                    driver_base.find_element_by_xpath("//*[@text='允许']").click()
                except Exception as e:
                    print(e)
                    allure.attach(driver_base.get_screenshot_as_png(), "首次登录,允许按钮检查", allure.attachment_type.PNG)
                    assert 1 > 2
            if "始终允许" and "禁止" in source:
                try:
                    driver_base.find_element_by_xpath("//*[@text='始终允许']").click()
                except Exception as e:
                    print(e)
                    allure.attach(driver_base.get_screenshot_as_png(), "首次登录,第二个允许按钮检查", allure.attachment_type.PNG)
                    assert 1 > 2
            time.sleep(5)
            source = driver_base.page_source
            if "允许" and "拒绝" in source:
                try:
                    driver_base.find_element_by_xpath("//*[@text='允许']").click()
                except Exception as e:
                    print(e)
                    allure.attach(driver_base.get_screenshot_as_png(), "首次登录,第二个允许按钮检查", allure.attachment_type.PNG)
                    assert 1 > 2
            if "始终允许" and "禁止" in source:
                try:
                    driver_base.find_element_by_xpath("//*[@text='始终允许']").click()
                except Exception as e:
                    print(e)
                    allure.attach(driver_base.get_screenshot_as_png(), "首次登录,第二个允许按钮检查", allure.attachment_type.PNG)
                    assert 1 > 2
            time.sleep(5)
            source = driver_base.page_source
            if "自动驾驶" and "定位辅助录入" and "平地机录入" and "基站录入" and "新安装" in source:
                assert "自动驾驶" and "定位辅助录入" and "平地机录入" and "基站录入" and "新安装" in source
            else:
                print(source)
                allure.attach(driver_base.get_screenshot_as_png(), "新安装页面检查失败", allure.attachment_type.PNG)
                assert "自动驾驶" and "定位辅助录入" and "平地机录入" and "基站录入" and "新安装" in source

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值