Search code examples
pythoninputenvironment-variablesformatadb

adb shell input variable right format


In my VTS host-side Python test script I can't seem to find the right format to input a touchscreen tap at a variable. For input text it worked with .format but that didn't really work well this time too

x = 528
y = 1270
coord = 528 1270

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

I tried by using a single variable, or defining each x and y, but that doesn't get me anywhere if the formatting is wrong.


Solution

  • The right format is an f string:

    adb.shell(f'input touchscreen tap {Center_x} {Center_y}')