When automating the iOS applications running on iPad or iPhone in Safari, you encounter exceptions like element is not visible. But the same code works fine on other browsers like chrome and firefox.
So what is causing the issue in safari?
To fix this issue, you need to scroll to element and then work on that element.
Below method will accept the element and scroll to it.
public void scrollToElement(WebElement element){
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView();",element)
((JavascriptExecutor) driver).executeScript("window.scrollBy(0,-100)")
What do you think on above selenium topic. Please provide your inputs and comments. You can write to me at reply2sagar@gmail.com
So what is causing the issue in safari?
To fix this issue, you need to scroll to element and then work on that element.
Below method will accept the element and scroll to it.
public void scrollToElement(WebElement element){
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView();",element)
((JavascriptExecutor) driver).executeScript("window.scrollBy(0,-100)")
}
What do you think on above selenium topic. Please provide your inputs and comments. You can write to me at reply2sagar@gmail.com
hey..u hv good knowledge on selenium..but i wonder y ur blog is not that much popular :P
ReplyDeleteThanks mate! I am trying to increase the ranking of my blog! I hope it happens soon!
DeleteYou are doing a good job. These questions are mostly asked in the interviews. Keep going.
ReplyDelete