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.
Asked
Active
Viewed 428 times
0
-
What code have you tried? – Aaron Christiansen Mar 18 '16 at 12:43
-
haha, @MadPhysicist, and where he has to put it, can you elaborate? :) – Farside Mar 18 '16 at 12:50
-
@Farside Hmm. You could write a program to figure that out... – Mad Physicist Mar 18 '16 at 13:00
-
@MadPhysicist - awesome idea :P – Vignesh Mar 18 '16 at 13:33
2 Answers
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
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
- 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.
-
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