driver = WebChrome() driver.implicitly_wait(20) driver.get("http://14.21.59.70:1000/") driver.maximize_window() #放大浏览器 # 登录夏子霞支付借款单 common.login(driver, "xiazixia") common.pay_loan(driver) common.quit(driver) # 登录huangzhenxu账号,提交还款申请单 common.login(driver, "huangzhenxu") driver.find_element_by_xpath( "//*[@id=\"app\"]/div/div/div[2]/div/div/ul/div[3]/li/ul/div[3]/a/li/span" ).click() driver.assert_template( Template(r"tpl1595316700201.png", record_pos=(11.41, 1.0), resolution=(100, 100)), "进入还款申请单") driver.airtest_touch( Template(r"tpl1595316722041.png", record_pos=(11.645, 1.825), resolution=(100, 100))) driver.assert_template( Template(r"tpl1595316735573.png", record_pos=(10.88, 1.59), resolution=(100, 100)), "进入新增页面") driver.airtest_touch( Template(r"tpl1595319105650.png", target_pos=6, record_pos=(15.725, 2.05), resolution=(100, 100))) driver.assert_template(
# -*- 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__)
# -*- encoding=utf8 -*- from airtest.core.api import * __author__ = "zxfn4514" 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("https://github.com/AirtestProject") driver.find_element_by_xpath( "//*[@id=\"js-pjax-container\"]/div/header/div/nav/a[2]").click() driver.find_element_by_xpath("//a[@data-hotkey='g b']").click() driver.airtest_touch( Template(r"tpl1534930299434.png", record_pos=(12.015, 2.275), resolution=(100, 100))) driver.assert_template( Template(r"tpl1534930307633.png", record_pos=(8.61, 2.925), resolution=(100, 100)), "Please fill in the test point.")
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.maximize_window() #放大浏览器 driver.get("http://14.21.59.70:1000/#/mrp/base/warehouseList") common.login(driver, "huangzhenxu") driver.find_element_by_xpath( "//*[@id=\"app\"]/div/div/div[2]/div/div/ul/div/li/ul/div/a/li/span" ).click() #进入【上传发票】页面 driver.assert_template( Template(r"tpl1594800342361.png", record_pos=(7.415, 2.15), resolution=(100, 100)), "成功打开发票管理页面") driver.airtest_touch( Template(r"tpl1594800381828.png", record_pos=(7.82, 2.985), resolution=(100, 100))) driver.assert_template( Template(r"tpl1594800422516.png", record_pos=(13.66, 4.545), resolution=(100, 100)), "打开识别发票接界面") driver.airtest_touch( Template(r"tpl1594800605536.png", record_pos=(15.805, 6.9), resolution=(100, 100))) driver.assert_template( Template(r"tpl1594800624394.png",
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", "验证是否登录进入主页.") common.upload_invoice(driver) # 上传一张发票 driver.airtest_touch(Template(r"tpl1597398632931.png", record_pos=(0.36, 7.65), resolution=(100, 100))) driver.assert_template(Template(r"tpl1595237905970.png", record_pos=(9.16, 1.595), resolution=(100, 100)), "打开差旅报销申请单") driver.airtest_touch(Template(r"tpl1595238021979.png", record_pos=(9.275, 2.43), resolution=(100, 100))) driver.assert_template(Template(r"tpl1595238038956.png", record_pos=(8.545, 2.035), resolution=(100, 100)), "进入新增页面") driver.airtest_touch(Template(r"tpl1595238520371.png", target_pos=4, record_pos=(7.775, 4.005), resolution=(100, 100))) driver.assert_template(Template(r"tpl1595238613863.png", record_pos=(3.855, 4.43), resolution=(100, 100)), "进入选择出差申请单界面") driver.airtest_touch(Template(r"tpl1595238654302.png", record_pos=(14.395, 5.615), resolution=(100, 100))) driver.find_element_by_id("erp_txtMEMO").send_keys("租金") driver.airtest_touch(Template(r"tpl1595238805466.png", record_pos=(2.18, 2.125), resolution=(100, 100))) driver.assert_template(Template(r"tpl1595238835098.png", record_pos=(13.135, 1.555), resolution=(100, 100)), "提示保存成功") driver.assert_template(Template(r"tpl1595469277807.png", record_pos=(13.305, 2.33), resolution=(100, 100)), "保存成功") time.sleep(1) driver.execute_script('window.scrollTo(0,document.body.scrollHeight)') #滑到底部 driver.find_element_by_xpath("//*[@id=\"pane-first\"]/form/div[4]/div/div/div/div/input").send_keys("审批意见") driver.airtest_touch(Template(r"tpl1595490704194.png", record_pos=(1.755, 9.28), resolution=(100, 100))) driver.assert_template(Template(r"tpl1597398883604.png", record_pos=(4.07, 2.675), resolution=(100, 100)), "提交成功,进入直属领导审批")
common.login(driver, "huangzhenxu") common.create_loan(driver) print("登录夏子霞") common.login(driver, "xiazixia") common.pay_loan(driver) sleep(2) common.quit(driver) print("登录何英账号") common.login(driver, "huangzhenxu") print("上传一张发票") common.upload_invoice(driver) driver.find_element_by_xpath( "//*[@id=\"app\"]/div/div/div[2]/div/div/ul/div[4]/li/ul/div/a/li/span" ).click() driver.assert_template( Template(r"tpl1595484957475.png", record_pos=(11.275, 0.975), resolution=(100, 100)), "进入费用报销申请单界面") driver.airtest_touch( Template(r"tpl1595484997538.png", record_pos=(10.46, 1.81), resolution=(100, 100))) driver.assert_template( Template(r"tpl1595485017525.png", record_pos=(9.765, 1.565), resolution=(100, 100)), "进入新增费用报销界面") driver.find_element_by_id("erp_txtMEMO").send_keys("报销租金") driver.airtest_touch( Template(r"tpl1595485120532.png", record_pos=(9.64, 1.79), resolution=(100, 100))) driver.assert_template(
__author__ = "Administrator" from airtest.core.api import * auto_setup(__file__) 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("https://crmhybridapp.autohome.com.cn/webapp/firstPage/chargeIndex") driver.set_window_size(500, 950) driver.find_element_by_xpath("//input[@placeholder='请输入OA账号']").click() driver.find_element_by_xpath("//input[@placeholder='请输入OA账号']").send_keys( "wangjian1102") driver.find_element_by_xpath("//input[@placeholder='请输入OA密码']").click() driver.find_element_by_xpath("//input[@placeholder='请输入OA密码']").send_keys( "Auto5678") driver.find_element_by_xpath("//*[@id=\"app\"]/div/div[2]/a/div").click() driver.airtest_touch( Template(r"tpl1575735320020.png", record_pos=(16.77, 8.99), resolution=(100, 100))) driver.assert_template( Template(r"tpl1575735408604.png", record_pos=(13.075, 1.8), resolution=(100, 100)), "汪剑登录成")
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[2]/li/ul/div[2]/a/li/span" ).click() driver.assert_template( Template(r"tpl1594866810340.png", record_pos=(8.64, 1.08), resolution=(100, 100)), "打开【招待申请单】") driver.airtest_touch( Template(r"tpl1594866859370.png", record_pos=(8.87, 1.925), resolution=(100, 100))) driver.assert_template( Template(r"tpl1594867550086.png", record_pos=(9.55, 2.37), resolution=(100, 100)), "进入新增页面") driver.airtest_touch( Template(r"tpl1594867580071.png", target_pos=4, record_pos=(12.415, 3.975), resolution=(100, 100)))
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.find_element_by_xpath( "//*[@id=\"app\"]/div/div/div[2]/div/div/ul/div[2]/li/ul/div/a/li/span" ).click() driver.assert_template( Template(r"tpl1594806824724.png", record_pos=(10.395, 1.93), resolution=(100, 100)), "进入出差申请单") driver.airtest_touch( Template(r"tpl1594806856010.png", record_pos=(10.62, 2.76), resolution=(100, 100))) driver.assert_template( Template(r"tpl1594806903770.png", record_pos=(11.045, 2.605), resolution=(100, 100)), "进入新增出差申请单界面") driver.find_element_by_xpath( "//*[@id=\"erp_cmbTRAVEL_FROM_PLACE\"]/div/div/input").click() driver.airtest_touch( Template(r"tpl1594807757859.png", record_pos=(10.455, 4.745), resolution=(100, 100)))
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.airtest_touch(Template(r"tpl1597394167142.png", record_pos=(0.07, 6.645), resolution=(100, 100))) driver.assert_template(Template(r"tpl1595215637171.png", record_pos=(6.735, 1.575), resolution=(100, 100)), "进入预付款申请单页面") driver.airtest_touch(Template(r"tpl1595215662545.png", record_pos=(7.125, 1.975), resolution=(100, 100))) driver.assert_template(Template(r"tpl1595215694789.png", record_pos=(6.4, 1.76), resolution=(100, 100)), "进入新增界面") driver.find_element_by_xpath("//*[@id=\"erp_cmbEXPECTED_INVOICE_TYPE\"]/div/div/input").send_keys("") driver.airtest_touch(Template(r"tpl1595215753390.png", record_pos=(7.805, 5.555), resolution=(100, 100))) driver.assert_template(Template(r"tpl1595215764639.png", record_pos=(7.065, 4.355), resolution=(100, 100)), "选择预计发票类型") driver.find_element_by_id("erp_txtEXPECTED_INVOICE_RATE").clear() driver.find_element_by_id("erp_txtEXPECTED_INVOICE_RATE").send_keys("10") driver.find_element_by_id("erp_txtADVANCES_AMOUNT").clear() driver.find_element_by_id("erp_txtADVANCES_AMOUNT").send_keys("1000") driver.find_element_by_id("erp_txtPAYEE_BANK_ACCOUNT").send_keys("123456") driver.find_element_by_id("erp_txtPAYEE_BANK").send_keys("654321") driver.find_element_by_id("erp_txtPAYEE_FULL_NAME").send_keys("银河装备") driver.find_element_by_id("erp_txtADVANCES_REASON").send_keys("租金") driver.find_element_by_id("erp_txtMEMO").send_keys("租金") driver.find_element_by_id("erp_cmbADVANCES_ATTR_TYPE").click()
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() driver.find_element_by_xpath("//a[@href='#']").click() driver.find_element_by_id("companyText").send_keys("看一下") driver.find_element_by_xpath("//input[@placeholder='手机号:']").send_keys("13411111111") driver.find_element_by_xpath("//input[@placeholder='验证码:']").send_keys("1023")
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, "heying") 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[2]/a/li/span" ).click() driver.assert_template( Template(r"tpl1595381252824.png", record_pos=(9.86, 1.125), resolution=(100, 100)), "进入借款单页面") driver.airtest_touch( Template(r"tpl1595381273465.png", record_pos=(10.055, 1.96), resolution=(100, 100))) driver.assert_template( Template(r"tpl1595381296421.png", record_pos=(9.375, 1.75), resolution=(100, 100)), "进入新增借款单界面") driver.find_element_by_xpath( "//*[@id=\"erp_cmbLOAN_TYPE_ID\"]/div/div/input").click() driver.airtest_touch( Template(r"tpl1597391204520.png", record_pos=(3.49, 6.075), resolution=(100, 100)))
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") common.upload_invoice(driver) #上传一张发票 driver.find_element_by_xpath( "//*[@id=\"app\"]/div/div[1]/div[2]/div[1]/div/ul/div[4]/li/ul/div[2]/a/li/span" ).click() driver.assert_template( Template(r"tpl1595228936982.png", record_pos=(2.895, 0.88), resolution=(100, 100)), "进入费用报销申请单") driver.airtest_touch( Template(r"tpl1595228967476.png", record_pos=(2.99, 1.69), resolution=(100, 100))) driver.assert_template( Template(r"tpl1595228980833.png", record_pos=(2.275, 1.495), resolution=(100, 100)), "进入新增页面") driver.find_element_by_id("erp_txtMEMO").send_keys("租金") driver.airtest_touch( Template(r"tpl1595229065206.png", record_pos=(2.195, 1.705), resolution=(100, 100))) driver.assert_template(