Selenium objects out of the screen -
i have selenium test runs smooth on 1920 * 1080 resolution. have task make test on different common resolutions such 1366 *768.
problem when run selenium test on smaller resolutions 1920 * 1080 can't find elements below window (as expected) how solve this?
i've tried javascriptexecutor jse = (javascriptexecutor)driver; jse.executescript("window.scrollto(0,math.max(document.documentelement.scrollheight,document.body.scrollheight,document.documentelement.clientheight));");
to scroll bottom of page no success. appreciate loads. using java, selenium, testng , pom.
hi scroll please use below
scrolling bottom of page
driver.navigate().to(url); ((javascriptexecutor) driver) .executescript("window.scrollto(0, document.body.scrollheight)");
scrolling element on page
driver.navigate().to(url); webelement element = driver.findelement(by.id("id")); ((javascriptexecutor) driver).executescript( "arguments[0].scrollintoview();", element);
scrolling coordinates
driver.navigate().to(url); ((javascriptexecutor) driver).executescript("window.scrollby(0,500)");
Comments
Post a Comment