← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #677007]: ADBScreen#aTap() not working on new release

 

Question #677007 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/677007

RaiMan proposed the following answer:
Just checked (looking into the implementation code - I cannot test with
more than one device currently).

--- ADBScreen#getDevices() 
indeed is defined, but not yet implemented (returns an empty list).
use getDevice(), to get the first or only attached device

... but this is not needed for aTap and other Region::a..Methods.

Generally you have to follow
https://sikulix-2014.readthedocs.io/en/latest/screen.html#connecting-to-an-android-device-or-emulator-adbscreen
to get the android-support working and access to the first attached device in the row or emulator.

ascr = ADBScreen.start()
ascr.aTap(someSpot)

where someRegion is either a Region or Location dedicated to the Android device:
someSpot = ascr.newRegion(x, y, w, h) # taps the center of the region
someSpot = ascr.newLocation(x, y) # taps  the location on the android
someSpot = ascr.find(someImage) # taps the center of the match-region

If you have more than one device/emulator attached, they are recognised,
but  there is no list currently.

You can get one device in the row as:
ascrN = ascr.getScreenWithDevice(n)

So with 2 devices attached:
ascr1 = ascr.getScreenWithDevice(1) 

now you can do the same things with ascr1 as with ascr.

BE AWARE: not all Region/Location features automatically know, that they
are on an android, especially those created from scratch.

in doubt use the ascr.newRegion()/newLocation() features to dedicate
one to an android.

Matches resulting from find ops on an android automatically are
dedicated to the android.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.