JavaScript scrolling methods are working fine in portrait mode but, in landscape mode scrolling methods are not working for IOS.
Appium Version: 1.7.1
IOS Version: 11.2
Simulator / Real Device: Simulator - IPhone SE
Below are the codes used for scrolling:
@Test
public void ScrollWithElementByName(RemoteWebDriver driver, String Name) throws InterruptedException
{
RemoteWebElement elements = (RemoteWebElement) driver.findElement(By.name(Name));
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put(“element”, ((RemoteWebElement) elements).getId());
scrollObject.put(“toVisible”, “true”);
js.executeScript(“mobile: scroll”, scrollObject);
}
@Test
public void ScrollWithoutElement(RemoteWebDriver driver) throws InterruptedException
{
Dimension size = driver.manage().window().getSize();
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put(“direction”, “down”);
js.executeScript(“mobile: scroll”, scrollObject);
scrollObject.put(“direction”, “up”);
js.executeScript(“mobile: scroll”, scrollObject);
}
Please help!!