Problem:-
I was using the following code to scroll to an element which is not visible.
I am getting below error when I use above method for scrolling:-
Solution:-
I was using the following code to scroll to an element which is not visible.
WebElement element = driver.findElementByName("text"); JavascriptExecutor js = (JavascriptExecutor) driver; HashMap scrollObjects = new HashMap(); scrollObjects.put("element", ((RemoteWebElement) element).getId()); js.executeScript("mobile: scrollTo", scrollObjects);
I am getting below error when I use above method for scrolling:-
Unknown command, all the mobile commands except scroll have been removed.
Solution:-
WebElement element = driver.findElementByName("text");
JavascriptExecutor js = (JavascriptExecutor) driver; HashMap scrollObjects = new HashMap(); scrollObjects.put("element", ((RemoteWebElement) element).getId()); scrollObjects.put("direction", "down"); driver.executeScript("mobile: scroll", scrollObjects );
No comments:
Post a Comment