I am using:
- selenium 3.0.0
- Appium : 1.7.2
Requirement: Scroll in the mobile browser and click the button which will open new url.
Code:
Point loc =Driver.findElement(By.xpath("//div[@id='button']")).getLocation();
System.out.println(loc);
JavascriptExecutor js = (JavascriptExecutor)Driver;
js.executeScript("javascript:window.scrollBy(0,"+loc.y+")");
Thread.sleep(4000);
//Actions actions = new Actions(Driver);
//actions.sendKeys(Keys.PAGE_UP).perform();
Driver.findElement(By.xpath(//div[@id='button']")).click();
Getting exception:
org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value' at this line : js.executeScript("javascript:window.scrollBy(0,"+loc.y+")");
Note: but element is scrolled to that point