You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
4.7 KiB
79 lines
4.7 KiB
*** Settings ***
|
|
Library BuiltIn
|
|
Library AppiumLibrary
|
|
Library OperatingSystem
|
|
Library Collections
|
|
Library DatabaseLibrary
|
|
Library String
|
|
|
|
*** Keywords ***
|
|
用户打开小程序
|
|
#UI自动化,连接设备
|
|
#用户已登录过,打开小程序直接进入
|
|
Open Application http://127.0.0.1:4723/wd/hub platformName=Android platformVersion=12 deviceName=2MH0224529003183
|
|
#... appPackage=com.tencent.mm appActivity=ui.LauncherUI #打开微信
|
|
#Click Element xpath=//android.widget.TextView[@text='微信' and @content-desc='微信'] #打开微信
|
|
#sleep 2
|
|
#Click Element xpath=//android.widget.ImageView[@resource-id='com.tencent.mm:id/he6'] #点击搜索
|
|
#Click Element xpath=//android.widget.EditText[@resource-id='com.tencent.mm:id/bxz'] #点击文本输入框
|
|
#sleep 1
|
|
#Input Text xpath=//android.widget.EditText[@resource-id='com.tencent.mm:id/bxz'] 盒版拼拼 #文本框输入:盒版拼拼
|
|
#sleep 1
|
|
#Click Element xpath=//android.widget.TextView[@resource-id='com.tencent.mm:id/ir3' and @text='盒版拼拼'] #点击搜索的结果
|
|
#sleep 1
|
|
Close Application
|
|
|
|
重新进入小程序
|
|
#重新进入小程序
|
|
Click Element xpath=//android.widget.ImageButton[@content-desc='更多'] #点击“...”
|
|
sleep 1
|
|
Click Element xpath=//android.support.v7.widget.RecyclerView[@resource-id='com.tencent.mm:id/ab8']/android.widget.LinearLayout[4]/android.widget.RelativeLayout[1]/android.widget.ImageView[2] #重新进入小程序
|
|
sleep 1
|
|
Close Application
|
|
|
|
读取TXT文件
|
|
#读取TXT文件
|
|
${file} Get File D:\\LYL\\Test\\Dating\\phone-test.txt #读取文件
|
|
${skip-line} Set Variable 1 #跳过第一行
|
|
${lines} Set Variable -1 #读取整个文件,从第二行开始
|
|
${content} Get Lines Containing String ${file} ${skip-line} ${lines}
|
|
FOR ${id} IN ${content}
|
|
${id} String.Split String ${id} \n
|
|
END
|
|
Set Global Variable ${id}
|
|
|
|
数据库操作
|
|
#操作数据库
|
|
FOR ${tid} IN @{id} #遍历列表
|
|
Connect To Database Using Custom Params pymysql database='dating-agency-uec',user='root',password='qniaothreetwoonego',host='8.135.8.221'
|
|
@{input-account} Execute Sql String insert into da_account SELECT * from uec.qn_account WHERE tid = '${tid}' and is_delete = 0 #插入uec.qn_account数据到da_account表
|
|
${check} Query select user_id from da_account where tid = '${tid}' and is_delete=0 #查询da_account表数据
|
|
${userid} Set Variable ${check[0][0]}
|
|
${input-user} Execute Sql String insert into da_user SELECT * from uec.qn_user WHERE id = '${userid}' and is_delete = 0 #插入uec.qn_user表数据到da_user表中
|
|
${check} Execute Sql String UPDATE da_user SET app_from = 50325897884795880 WHERE id = ${userid} #更新da_user表app_from数据
|
|
Disconnect From Database
|
|
END
|
|
BuiltIn.Set Global Variable ${userid}
|
|
|
|
小程序UI自动化
|
|
#小程序UI自动化
|
|
Open Application http://127.0.0.1:4723/wd/hub platformName=Android platformVersion=9 deviceName=emulator-5554 automationName=uiautomator2
|
|
${Ysize} Get Window Height #获取屏幕高度
|
|
${Xsize} Get Window Width #获取屏幕宽度
|
|
${X1} BuiltIn.Evaluate ${Xsize}*0.5
|
|
${Y1} BuiltIn.Evaluate ${Ysize}*0.25
|
|
${Y2} BuiltIn.Evaluate ${Ysize}*0.5
|
|
Swipe ${X1} ${Y1} ${X1} ${Y2} #模拟下拉操作
|
|
Wait Until Page Contains 趣招亲 3 #等待页面出现指定的文本
|
|
Click Element xpath=//android.widget.RelativeLayout[@content-desc=\"趣招亲,\"]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[1]/android.widget.ImageView[1] #点击“趣招亲”小程序(已登录)
|
|
BuiltIn.Sleep 1
|
|
Click Element xpath=//android.view.View[@text=\"我的\"] #进入小程序后点击"我的"
|
|
BuiltIn.Sleep 1
|
|
Click Element xpath=//android.view.View[@text=\"微信用户\"] #登录趣招亲
|
|
Wait Until Page Contains 一键登录 3 #等待页面出现指定的文本
|
|
Click Element xpath=//*[@text="我已阅读并同意"] #勾选协议
|
|
Click Element xpath=//*[@text="一键登录"] #一键登录
|
|
Click Element xpath=//android.view.View[@text=\"180****4975\"] #确认手机号登录
|
|
#Wait Until Page Contains 立即完善 3 #等待页面出现指定的文本
|
|
#Click Element xpath=//android.webkit.WebView/android.view.View[2]/android.view.View[1] #立即完善资料
|
|
Close Application
|