Hi friends,
I am opening Gallery App in my Android Phone and clicking an an Image.
I am actually trying to Zoom IN on the Image with 2 fingers.
Test is getting PASSED. But, Zoom IN Action is NOT happening.
Below is the code:
WebElement ele2=driver.findElement(By.xpath(“(//android.widget.FrameLayout[@resource-id="com.sec.android.gallery3d:id/deco_view_layout"])[1]”));
ele2.click();
WebElement ele3=driver.findElement(By.xpath("//android.view.ViewGroup[@resource-id=\"com.sec.android.gallery3d:id/top_center_decor_layout\"]"));
Point point=ele3.getLocation();
Dimension dimension=ele3.getSize();
Point pt2=getCenterOfElement(point, dimension);
PointerInput finger1=new PointerInput(PointerInput.Kind.TOUCH,"finger1");
PointerInput finger2=new PointerInput(PointerInput.Kind.TOUCH,"finger2");
Sequence sequence1=new Sequence(finger1,1)
.addAction(finger1.createPointerMove(Duration.ZERO, PointerInput.Origin.viewport(), pt2))
.addAction(finger1.createPointerDown(PointerInput.MouseButton.LEFT.asArg()))
.addAction(new Pause(finger1,Duration.ofMillis(200)))
.addAction(finger1.createPointerMove(Duration.ofMillis(200),PointerInput.Origin.viewport(),pt2.getX()+100,pt2.getY()-100))
.addAction(finger1.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));
Sequence sequence2=new Sequence(finger2,1)
.addAction(finger2.createPointerMove(Duration.ZERO, PointerInput.Origin.viewport(), pt2))
.addAction(finger2.createPointerDown(PointerInput.MouseButton.LEFT.asArg()))
.addAction(new Pause(finger2,Duration.ofMillis(200)))
.addAction(finger2.createPointerMove(Duration.ofMillis(200), PointerInput.Origin.viewport(), pt2))
.addAction(finger2.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));
driver.perform(Arrays.asList(sequence1,sequence2));
Thread.sleep(3000);
Please help.
Thank you.