0
votes

Here is the HTML code1 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!

1
Issue not clear. Screenshot gives no hints. Please provide a part of html code for target elementsAndersson

1 Answers

2
votes

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/