Example on Pinch and Zoom

Hi Guys,

I’m trying to find an example application to try pinch and zoom … can someone suggest one.

You can copy any pdf/ word document file in u r mobile.
Using script tap download app
and click document to open it
now try pinch and zoom gestures

  @Test
public void ZoomInZoomOut() throws InterruptedException{

	Thread.sleep(1000);
	
	// Press Home Key
	_driver.sendKeyEvent(AndroidKeyCode.HOME);
	Thread.sleep(3000);
	_driver.findElementByAccessibilityId("Apps").click();
    _driver.findElement(By.name("ES File Explorer")).click();
    Thread.sleep(2000);
	_driver.findElement(By.name("Download")).click();
	_driver.findElement(By.name("coming.pdf")).click();
	Thread.sleep(1000);
	
	int scrHeight = _driver.manage().window().getSize().getHeight(); //To get the mobile screen height
	int scrWidth = _driver.manage().window().getSize().getWidth();//To get the mobile screen width
	MultiTouchAction multiTouch = new MultiTouchAction(_driver);
	TouchAction tAction0 = new TouchAction(_driver);
	TouchAction tAction1 = new TouchAction(_driver);
	System.out.println("scrWidth/2,scrHeight/2 ::::::  " + scrWidth/2 +","+ scrHeight/2);
	tAction0.press(scrWidth/4,scrHeight/4).waitAction(1000).moveTo(scrWidth/4,60).release();//press finger center of the screen and then move y axis
	tAction1.press(scrWidth/4,(scrHeight/4)+40).waitAction(1000).moveTo(scrWidth/4,80).release();// press thumb slightly down on the center of the screen and then move y axis
	multiTouch.add(tAction0).add(tAction1);
	multiTouch.perform();// now perform both the actions simultaneously (tAction0 and tAction1)
	Thread.sleep(10000);
}

@amitjaincoer191 thanks a lot . Isn’t there any android application that can b used to perform zoom and pinch?

any maps application will allow you to zoom/pinch. Use the pre-installed google maps one p.e.

@Telmo_Cardoso how do i give the x and y axis in driver.zoom(intx,inty) ?

@amitjaincoer191 your code didnt zoom when using the google maps.

@saikrishna321

Did you debug the code where issue is coming in code ?
Since it is working on a word/pdf doc which have zoom in and out feature.

@amitjaincoer191 yah i did… i dont see any issues … can u pls try with google maps n see if it works

But this perform() method is not working in visual studio 2015 for mobile web application.
Is there any other way for zoom in and zoom out for mobile web application.