-1

Hi I'm fairly new to web automation and I'm testing new things out. I'm having trouble getting the list of elements as shown in the picture. i have selected the Xpath of the highlighted code but still no success.

    WebDriver driver = DriverFactory.getWebDriver()
    WebElement LauncheddAppTest = driver.findElement(By.xpath(Xpath))

    List<WebElement> DLauncheddAppTest = LauncheddAppTest.findElements(By.tagName('li'))

    println("\n\nIm inside search and click")
    println("\n\n Size is: "+DLauncheddAppTest.size())

the size returned is 0 so the tag "li" was not found.

Screenshot 1

Screenshot 2 Code block

Any. poiters would be greatly appreciated

Christian
  • 1
  • 1

1 Answers1

0

You can try the below xpath :

//div[@class='DivFiles']/li

and Use it like below :

List<WebElement> DLauncheddAppTest = driver.findElements(By.xpath("//div[@class='DivFiles']/li"))

and print the size like this :

println("\n\n Size is: "+DLauncheddAppTest.size())

This answer assumes that A div has unique class DivFiles

cruisepandey
  • 28,520
  • 6
  • 20
  • 38