Hi @jlipps, @willosser, @bhaskar, @Appium_Master
I’m Trying to automate my application in Android Chrome browser… I need click on an element below the screen. I’ve tried Touch Actions(press, release, moveTo, Tap) to scroll. But didn’t worked. My questions
- Didn’t appium automatically scroll to the element like selenium
- if not, how can i scroll to particular element
I’ve tried TouchActions using coordinates but no avail
below is my code
@Test
public void webView() throws Exception{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, BrowserType.CHROME);
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,“Android”);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,“ZY22232RXB”);
capabilities.setCapability(“appPackage”,“com.android.chrome”);
capabilities.setCapability(“appActivity”,“com.google.android.apps.chrome.Main”);
mobileDriver= new AndroidDriver(new URL(“http://127.0.0.1:4445/wd/hub”), capabilities);
mobileDriver.get(url);
TouchAction action = new TouchAction(mobileDriver);
WebElement el = mobileDriver.findElement(By.xpath("//h4"));
WebElement e2 = mobileDriver.findElement(By.xpath("//div[text()=‘View All’]"));
int x = el.getLocation().getX();
int y = el.getLocation().getY();
int x1 = e2.getLocation().getX();
int y1 = e2.getLocation().getY();
mobileDriver.context("NATIVE_APP");
action.press(x1,y1).moveTo(x,y).release().perform().wait(500);
el.click();
mobileDriver.context("CHROMIUM");
}
it is not pressing the intended button and move to is not happening . Please help
Appium 1.6.4
Java-client 1.5.0
Android API-23
Chrome version: 61.0
ChromeDriver 2.25