adb shell 输入变量正确格式

问题描述 投票:0回答:1

在我的 VTS 主机端 Python 测试脚本中,我似乎找不到在变量上输入触摸屏点击的正确格式。对于输入文本,它可以使用 .format,但这次也效果不佳

x = 528
y = 1270
coord = 528 1270

device.shell('input touchscreen tap x y')
device.shell('input touchscreen tap coord')

我尝试使用单个变量,或定义每个 x 和 y,但如果格式错误,这对我没有任何帮助。

python input environment-variables format adb
1个回答
0
投票

正确的格式是 f 字符串:

adb.shell(f'input touchscreen tap {Center_x} {Center_y}')
© www.soinside.com 2019 - 2024. All rights reserved.