Reputation: 1330
I have a test code that works with Browserstack and basically plays a video on a page.
playBackButton = _webDriver.findElement(By.xpath("//*[@aria-label='Start Playback']"))
try{
playBackButton.click();
}
Which works fine except on mobile devices it logs a click in the log, but the video doesn't start. No exception, just doesn't play.
Can someone show a working example of sending taps to mobile devices running in Browserstack?
Upvotes: 1
Views: 2552
Reputation: 1411
When running tests on ios devices, please ensure you are using the capability:
caps.setCapability("nativeWebTap",true);
and the driver should be an instance of IOSDriver
IOSDriver driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), caps);
Similarly, for Android, ensure you are using AndroidDriver
AndroidDriver<AndroidElement> driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), caps);
Working sample for iOS with xpath:
caps.setCapability("nativeWebTap",true);
IOSDriver driver = null;
try {
driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), caps);
} catch (MalformedURLException e) {
e.printStackTrace();
}
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
driver.get("http://stackoverflow.com");
WebElement ele = driver.findElement(By.xpath("(//div[@class='-details'])[1]"));
ele.click();
driver.quit();
Upvotes: 2