How to loop through a menu list on a webpage using Selenium?

How to loop through a menu list on a webpage using Selenium?

Hey Tom-dale,

You can use the following code snippet to loop through a menu list on a webpage:

List<WebElement> menuItems = Driver.findElements(By.xpath(""//ul[@id='ListViewInner']/li""));
  
  for( WebElement item: menuItems){
   
     System.out.println(item.getText());
   
     System.out.println(""*********************************************************************"");
  }