Reputation: 49
Please have a look for the screenshots & HTML code, where I need to scroll down the scroller & click on logout which is the last module among this list of 10 modules.As the element is not visible here, i need to scroll down to select that element.
Note that i have tried all possible commands of draganddrop,clickandhold,action,keydown etc., But by using this it scrolls down the current screen & not the sidebar!
I tried with this,
Actions builder = new Actions(driver);
Actions dragAndDrop = builder.clickAndHold(driver.findElement(By.cssSelector("div.slimScrollBar")));
// bulder.moveToElement(otherElement)
builder.release(driver.findElement(By.xpath("id('sidebar')/div/div[1]/ul/li[10]/a"))).build();
dragAndDrop.perform();
Please provide me possible solutions using java!
Upvotes: 0
Views: 2806
Reputation: 831
Please use JavaScript executor in Selenium which will scroll until element is not found.
Check below article and let me know if still facing some issues.
http://learn-automation.com/how-to-scroll-into-view-in-selenium-webdriver/
Upvotes: 2