@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
python之一登录场景
最新推荐文章于 2023-01-31 13:18:53 发布