Unable to get text in a list

Hi! I try to get the text from the elements of a list without success. This is the html source code from the webpage:

View the full list of Sign-In Partners
  • Affinity Credit Union
  • Alberta Treasury Branches
  • BMO Financial Group
  • ...

    And this is my attempt to get the text from it:
    WebDriver driver = DriverFactory.getWebDriver()
    List list = driver.findElements(By.xpath("/html/body/main/div[2]/div/div[1]/div[3]/div/div/details/ul/li"))
    for (element in list)
    {
    System.out.println(element.getText())
    }

    This code results in 16 empty strings in the console since there are 16 elements in the list.
    Thank you for your help!

To get the HTML source code on Chrome, right click by your element and select “Inspect” (do this twice). If we get to see the actual HTML, then we may be able to assist better.

While reviewing your HTML pathway, is there any static id or name tag closer to the end of your xpath //details/ul/li. You currently have such a long pathway that it is likely to get broken.

To display your code properly, put three back ticks (found on the same key as the tilde) above and below, like ```

WebDriver driver = DriverFactory.getWebDriver()
List<WebElement> list = driver.findElements(By.xpath("//html/body/main/div[2]/div/div[1]/div[3]/div/div/details/ul/li"))
for (element in list)
{
    System.out.println(element.getText())
}