# -*- encoding=utf8 -*- __author__ = "janson" from airtest.core.api import * # 查看借还款界面 from airtest.core.api import * using(r"E:\黄振旭\费用管理系统自动化测试用例\conf\common.air") from common import common from selenium import webdriver from selenium.webdriver.common.keys import Keys from airtest_selenium.proxy import WebChrome driver = WebChrome() driver.implicitly_wait(20) driver.get("http://14.21.59.70:1000") driver.maximize_window() #放大浏览器 common.login(driver, "huangzhenxu") driver.assert_exist("//*[@id=\"tags-view-container\"]/div/div/div/span", "xpath", "验证是否登录进入主页.") driver.find_element_by_xpath( "//*[@id=\"app\"]/div/div/div[2]/div/div/ul/div[3]/li/ul/div/a/li/span" ).click() driver.assert_template( Template(r"tpl1594869543864.png", record_pos=(10.415, 1.0), resolution=(100, 100)), "进入借还款追踪管理") driver.close() auto_setup(__file__)
poco('一键购买').click() sleep(20) if exists(Template(r"tpl1572316650111.png", record_pos=(-0.344, -0.186), resolution=(2560, 1440))): log('购买成功') pass stop_app(app_id) sleep(3) clear_app(app_id) ################################################################ from airtest.core.api import * from airtest_selenium.proxy import WebChrome game_id = '600144' driver = WebChrome() driver.implicitly_wait(20) sleep(3) driver.maximize_window() driver.get("http://tech-support.upltv.com:82/index") driver.find_element_by_xpath("//a[@href='/auth/login']").click() driver.find_element_by_xpath("//input[@autocomplete='on']").send_keys('*****@*****.**') driver.find_element_by_xpath("//input[@autocomplete='off']").send_keys('Temp2019') driver.find_element_by_xpath("//input[@value='登录']").click() sleep(5) Logging('准备数据上报------------------------------------------') driver.find_element_by_xpath("//*[@id=\"bs-example-navbar-collapse-1\"]/ul/li/a/span").click() driver.find_element_by_xpath("//a[@href='/report/analysis']").click() driver.find_element_by_xpath("//input[@type='text']").send_keys(game_id) sleep(3) driver.find_element_by_xpath("//*[@id=\"contentlist\"]/li/span").click()
__author__ = "Administrator" from airtest.core.api import * from selenium import webdriver from selenium.webdriver.common.keys import Keys from airtest_selenium.proxy import WebChrome from selenium.webdriver.common.action_chains import ActionChains#导入鼠标悬停模块 driver = WebChrome()#打开浏览器 # driver.implicitly_wait(10) auto_setup(__file__) driver.get("http://createwit.com/")#进入创智美业官网 time.sleep(2) driver.maximize_window()#浏览器窗口最大化 tag_element = driver.find_element_by_xpath("//a[@href='product.html']")#定位该元素 ActionChains(driver).move_to_element(tag_element).perform()#鼠标悬停到该元素 driver.find_element_by_link_text("ERP").click()#点击该元素 driver.assert_template(Template(r"tpl1583921002974.png", record_pos=(5.87, 1.895), resolution=(100, 100)), "是否定位至erp") driver.find_element_by_xpath("//img[@src='images/product/js_1.png']").click() driver.assert_template(Template(r"tpl1583921034507.png", record_pos=(7.63, 2.285), resolution=(100, 100)), "是否定位至讲师") js="window.scrollTo(0,document.body.scrollHeight)" driver.execute_script(js)#页面滑动至最底部 time.sleep(1) driver.assert_template(Template(r"tpl1583919799081.png", record_pos=(4.455, 7.99), resolution=(100, 100)), "验证是否滑动至最底部") driver.find_element_by_xpath("//a[@href='about.html']").click() driver.assert_template(Template(r"tpl1583918269179.png", record_pos=(3.38, 4.15), resolution=(100, 100)), "是否跳转至关于我们页面") driver.find_element_by_xpath("//a[@href='download.html']").click() driver.assert_template(Template(r"tpl1583918305017.png", record_pos=(3.245, 5.25), resolution=(100, 100)), "是否跳转至下载专区页面") # driver.find_element_by_xpath("/html/body/div[4]/div/div[2]/div/div[3]/a").click()