0

I got one scenario where I need to tap on the screen to take a photo in Samsung Note device. Can someone provide me an idea like how can I perform single tap in the centre of the screen.

enter image description here

Vignesh
  • 165
  • 4
  • 15

2 Answers2

0

Well i took the centre , x and y coordinate of the entire screen and tapped , it worked fine.

            int startx, int starty;
    Point p = entireLayout.getCenter();
            startx = p.getX();
            starty = p.getY();
            starty = p.getY() + (p.getY()) / 2;
            getDriver().tap(1, startx, starty, 3000);
Vignesh
  • 165
  • 4
  • 15
  • So you basically didn't bother trying anything, posted a vague question, then answered it once you tried the first obvious solution? This is why I voted to close. – Mad Physicist Mar 18 '16 at 13:35
0
  1. What you might be looking for is probably an appropriate way of doing it in all resolution devices using :

    public static final int KEYCODE_CAMERA // constant value 27

One way of sending it to the device is :

adb shell input keyevent 27

further details over this could be found on developer.android.com and SO-7789826

  1. Another way of doing it would be accessing the capture button of the camera(using any possible locator strategy) and performing a .click() on it.
Community
  • 1
  • 1
Naman
  • 27,789
  • 26
  • 218
  • 353
  • Thats is the issue , appium inspector or UI automator does not inspect the capture button at all. – Vignesh Mar 21 '16 at 06:13
  • probably the camera activity is not allowed to be debugged, but still adb commands could be send over – Naman Mar 21 '16 at 06:27