问卷点击题目提交答案

这段bash脚本通过ADB工具实现对安卓设备的UI自动化测试,主要涉及问卷的答题流程,包括刷卡、手机号和极简模式的入口选择,以及不同问卷的题目选择和起病时间设置。它会循环执行多次,确保所有问卷流程的正确性。
摘要由CSDN通过智能技术生成

#!/bin/bash
#uiautomator获取页面元素,元素是否在该页,判断进行点击事件测试
ip151=10.66.209.151
#mkdir ip132
#adb -s $ip134 shell am start -n com.guoming.health.device.voiceskill/com.guoming.health.device.voiceskill.video.ui.ConstactsHomeActivity
echo “输入1为刷卡模式”
echo “输入2为手机号”
echo “输入3为极简模式”
read -p “请您输入1-6任意字符:” NUM
ip=D66PFEVWSWAYH6EM
function card()
{
#刷卡模式
adb -s $ip shell uiautomator dump /data/local/tmp/app.uix
#cd ip132/
if [ $? -ne 0 ]; then
echo “fail”
else
#adb pull /data/local/tmp/app.uix
#text=cat app.uix|grep -ai "请刷卡获取号码" |cut -c 2992-3012
text=adb -s $ip shell cat /data/local/tmp/app.uix|grep -ai "请刷卡获取号码" |cut -c 2992-3012
if [ “$text” = “请刷卡获取号码” ] ; then
echo “进入成功”
adb -s $ip shell input text 1111111111111111111111111111111111111111111111111
#诊前检查页面,确认用户信息后,点击开始检测,调用zhenqiancheck函数
zhenqiancheck
else
echo $text fail
fi
fi
}
function phonenumber()
{
#手机号模式
adb -s $ip shell uiautomator dump /data/local/tmp/app.uix
if [ $? -ne 0 ]; then
echo “fail”
else
#adb pull /data/local/tmp/app.uix
#text=cat app.uix|grep -ai "请输入您的手机号" |cut -c 4880-4903
text=adb -s $ip shell cat /data/local/tmp/app.uix|grep -ai "请输入您的手机号" |cut -c 4880-4903
if [ “$text” = “请输入您的手机号” ] ; then
echo “进入成功”
adb -s $ip shell input text 15195899250
#诊前检查页面,确认用户信息后,点击开始检测,调用zhenqiancheck函数
else
echo $text fail
fi
fi
}
function jijian()
{
#极简模式
adb -s $ip shell uiautomator dump /data/local/tmp/app.uix
if [ $? -ne 0 ]; then
echo “fail”
else
#adb pull /data/local/tmp/app.uix
#text=cat app.uix |cut -c 3302-3319|grep -ai "中医舌脉检查"
text=adb -s $ip shell cat /data/local/tmp/app.uix |cut -c 3302-3319|grep -ai "中医舌脉检查"
if [ “$text” = “中医舌脉检查” ] ; then
echo “进入成功”
adb -s $ip shell input tap 512 314
else
echo $text fail
fi
fi
}
function zhenqiancheck()
{
#诊前检查页面,确认用户信息后,点击开始检测
sleep 5
adb -s $ip shell uiautomator dump /data/local/tmp/app.uix
if [ $? -ne 0 ]; then
echo “fail”
else
text=adb -s $ip shell cat /data/local/tmp/app.uix |cut -c 6016-6027|grep -ai "开始检测"
if [ “$text” = “开始检测” ] ; then
echo “进入成功”
adb -s $ip shell input tap 512 520
else
echo $text fail
fi
fi
}
function gangliefuzheng()
{
#问卷肛裂复诊
i=1
#while [ $i -le 4 ]
#do
adb -s i p s h e l l u i a u t o m a t o r d u m p / d a t a / l o c a l / t m p / a p p . u i x i f [ " ip shell uiautomator dump /data/local/tmp/app.uix if [ " ipshelluiautomatordump/data/local/tmp/app.uixif["i" = “1” ] ; then
sleep 1
echo $i"进入肛裂复诊成功"
adb -s $ip shell input tap 147 204
sleep 1
adb -s $ip shell uiautomator dump /data/local/tmp/app.uix
sleep 1
text=adb -s $ip shell cat /data/local/tmp/app.uix |cut -c 2982-2993|grep -ai "自诊说明"
if [ “$text” = “自诊说明” ] ; then
echo “进入选择症状成功”
#选择症状,自诊说明页,点击开始填写
adb -s $ip shell input tap 512 528
sleep 3
#选择题,选择有
t=1
while [ $t -le 8 ]
do
adb -s $ip shell input tap 532 301
#选择题,选择点击下一题
sleep 1
adb -s $ip shell input tap 827 528
let t++
done
else
echo “失败”
fi
#点击选择起病时间:
sleep 3
adb -s $ip shell uiautomator dump /data/local/tmp/app.uix
sleep 2
text=adb -s $ip shell cat /data/local/tmp/app.uix |cut -c 5549-5566|grep -ai "选择起病时间"
sleep 1
if [ “$text” = “选择起病时间” ] ; then
#选择时间框
adb -s $ip shell input tap 372 243
#选择确定
sleep 1
adb -s $ip shell input tap 981 250
sleep 1
adb -s $ip shell input tap 827 528

					else
						echo "失败"
					fi
					k=1
					while [ $t -le 36 ]
					do
							#选择第一个选项
						sleep 3
						adb -s $ip shell input tap 532 220
							#选择题,选择点击下一题
						sleep 1
						adb -s $ip shell input tap 827 528
						let t++
					done
	else
		echo 失败
					'''
else if [ "$i" = "2" ] ; then
					echo $i"进入肛瘘复诊成功"
					adb -s $ip shell input tap 392 204
else [ "$i" = "3" ]	
					echo $i"进入痔病复诊成功"
					adb -s $ip shell input tap 632 204
else [ "$i" = "4" ]
					echo $i"进入初诊成功"
					adb -s $ip shell input tap 877 204
'''
	fi
	adb -s $ip shell input tap 722 432
	sleep 15
	#let i++

#done
}
function gangloufuzheng()
{
#问卷肛瘘复诊
i=1
#while [ $i -le 4 ]
#do
adb -s i p s h e l l u i a u t o m a t o r d u m p / d a t a / l o c a l / t m p / a p p . u i x i f [ " ip shell uiautomator dump /data/local/tmp/app.uix if [ " ipshelluiautomatordump/data/local/tmp/app.uixif["i" = “1” ] ; then
sleep 1
echo $i"进入问卷肛瘘复诊成功"
adb -s $ip shell input tap 392 204
sleep 1
adb -s $ip shell uiautomator dump /data/local/tmp/app.uix
sleep 1
text=adb -s $ip shell cat /data/local/tmp/app.uix |cut -c 2982-2993|grep -ai "自诊说明"
if [ “$text” = “自诊说明” ] ; then
echo “进入选择症状成功”
#选择症状,自诊说明页,点击开始填写
adb -s $ip shell input tap 512 528
sleep 3
#选择题,选择有
t=1
while [ $t -le 8 ]
do
adb -s $ip shell input tap 532 301
#选择题,选择点击下一题
sleep 1
adb -s $ip shell input tap 827 528
let t++
done
else
echo “失败”
fi
#点击选择起病时间:
sleep 3
adb -s $ip shell uiautomator dump /data/local/tmp/app.uix
sleep 2
text=adb -s $ip shell cat /data/local/tmp/app.uix |cut -c 5549-5566|grep -ai "选择起病时间"
sleep 1
if [ “$text” = “选择起病时间” ] ; then
#选择时间框
adb -s $ip shell input tap 372 243
#选择确定
sleep 1
adb -s $ip shell input tap 981 250
sleep 1
adb -s $ip shell input tap 827 528

					else
						echo "失败"
					fi
					k=1
					while [ $t -le 38 ]
					do
							#选择第一个选项
						sleep 3
						adb -s $ip shell input tap 532 220
							#选择题,选择点击下一题
						sleep 1
						adb -s $ip shell input tap 827 528
						let t++
					done
	else
		echo 失败
					'''
else if [ "$i" = "2" ] ; then
					echo $i"进入肛瘘复诊成功"
					adb -s $ip shell input tap 392 204
else [ "$i" = "3" ]	
					echo $i"进入痔病复诊成功"
					adb -s $ip shell input tap 632 204
else [ "$i" = "4" ]
					echo $i"进入初诊成功"
					adb -s $ip shell input tap 877 204
'''
	fi
	adb -s $ip shell input tap 722 432
	sleep 15
	#let i++

#done
}
function zhibinfuzheng()
{
#问卷痔病复诊
i=1
#while [ $i -le 4 ]
#do
adb -s i p s h e l l u i a u t o m a t o r d u m p / d a t a / l o c a l / t m p / a p p . u i x i f [ " ip shell uiautomator dump /data/local/tmp/app.uix if [ " ipshelluiautomatordump/data/local/tmp/app.uixif["i" = “1” ] ; then
sleep 1
echo $i"进入痔病复诊成功"
adb -s $ip shell input tap 632 204
sleep 1
adb -s $ip shell uiautomator dump /data/local/tmp/app.uix
sleep 1
text=adb -s $ip shell cat /data/local/tmp/app.uix |cut -c 2982-2993|grep -ai "自诊说明"
if [ “$text” = “自诊说明” ] ; then
echo “进入选择症状成功”
#选择症状,自诊说明页,点击开始填写
adb -s $ip shell input tap 512 528
sleep 3
#选择题,选择有
t=1
while [ $t -le 8 ]
do
adb -s $ip shell input tap 532 301
#选择题,选择点击下一题
sleep 1
adb -s $ip shell input tap 827 528
let t++
done
else
echo “失败”
fi
#点击选择起病时间:
sleep 3
adb -s $ip shell uiautomator dump /data/local/tmp/app.uix
sleep 2
text=adb -s $ip shell cat /data/local/tmp/app.uix |cut -c 5549-5566|grep -ai "选择起病时间"
sleep 1
if [ “$text” = “选择起病时间” ] ; then
#选择时间框
adb -s $ip shell input tap 372 243
#选择确定
sleep 1
adb -s $ip shell input tap 981 250
sleep 1
adb -s $ip shell input tap 827 528

					else
						echo "失败"
					fi
					k=1
					while [ $t -le 41 ]
					do
							#选择第一个选项
						sleep 3
						adb -s $ip shell input tap 532 220
							#选择题,选择点击下一题
						sleep 1
						adb -s $ip shell input tap 827 528
						let t++
					done
	else
		echo 失败
					'''
else if [ "$i" = "2" ] ; then
					echo $i"进入肛瘘复诊成功"
					adb -s $ip shell input tap 392 204
else [ "$i" = "3" ]	
					echo $i"进入痔病复诊成功"
					adb -s $ip shell input tap 632 204
else [ "$i" = "4" ]
					echo $i"进入初诊成功"
					adb -s $ip shell input tap 877 204
'''
	fi
	adb -s $ip shell input tap 722 432
	sleep 15
	#let i++

#done
}
function chuzheng()
{
#问卷初诊
i=1
#while [ $i -le 4 ]
#do
adb -s i p s h e l l u i a u t o m a t o r d u m p / d a t a / l o c a l / t m p / a p p . u i x i f [ " ip shell uiautomator dump /data/local/tmp/app.uix if [ " ipshelluiautomatordump/data/local/tmp/app.uixif["i" = “1” ] ; then
sleep 1
echo $i"进入问卷初诊成功"
adb -s $ip shell input tap 877 204
sleep 1
adb -s $ip shell uiautomator dump /data/local/tmp/app.uix
sleep 1
text=adb -s $ip shell cat /data/local/tmp/app.uix |cut -c 2982-2993|grep -ai "自诊说明"
if [ “$text” = “自诊说明” ] ; then
echo “进入选择症状成功”
#选择症状,自诊说明页,点击开始填写
adb -s $ip shell input tap 512 528
sleep 3
#选择题,选择有
t=1
while [ $t -le 8 ]
do
adb -s $ip shell input tap 532 301
#选择题,选择点击下一题
sleep 1
adb -s $ip shell input tap 827 528
let t++
done
else
echo “失败”
fi
#点击选择起病时间:
sleep 3
adb -s $ip shell uiautomator dump /data/local/tmp/app.uix
sleep 2
text=adb -s $ip shell cat /data/local/tmp/app.uix |cut -c 5549-5566|grep -ai "选择起病时间"
sleep 1
if [ “$text” = “选择起病时间” ] ; then
#选择时间框
adb -s $ip shell input tap 372 243
#选择确定
sleep 1
adb -s $ip shell input tap 981 250
sleep 1
adb -s $ip shell input tap 827 528

					else
						echo "失败"
					fi
					k=1
					while [ $t -le 45 ]
					do
							#选择第一个选项
						sleep 3
						adb -s $ip shell input tap 532 220
							#选择题,选择点击下一题
						sleep 1
						adb -s $ip shell input tap 827 528
						let t++
					done
	else
		echo 失败
					'''
else if [ "$i" = "2" ] ; then
					echo $i"进入肛瘘复诊成功"
					adb -s $ip shell input tap 392 204
else [ "$i" = "3" ]	
					echo $i"进入痔病复诊成功"
					adb -s $ip shell input tap 632 204
else [ "$i" = "4" ]
					echo $i"进入初诊成功"
					adb -s $ip shell input tap 877 204
'''
	fi
	adb -s $ip shell input tap 722 432
	sleep 15
	#let i++

#done
}
case $NUM in
1)
card
;;
2)
phonenumber
;;
3)
jijian
;;
esac

q=1
while [ $q -le 100 ]
do
phonenumber
zhenqiancheck
sleep 4
gangliefuzheng
sleep 4
phonenumber
zhenqiancheck
sleep 4
echo “gangloufuzheng成功”
gangloufuzheng
sleep 4
phonenumber
zhenqiancheck
sleep 4
echo “zhibinfuzheng成功”
zhibinfuzheng
sleep 4
phonenumber
zhenqiancheck
sleep 4
echo “chuzheng成功”
chuzheng
let q++
done

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值