Hi guys
I have a query. I want to get the TOTAL count of the drop-down values but in the count, I want to skip the Heading part.
For Example:
DropDown
Value 1 = Project (Heading)
Value 2 = B
Value 3 = C
With the XPath, it will show the count of 3 but I want to show it as 2, excluding the Value 1. Is that possible?
Please see the Screenshots for further understanding:
This is my code: For now, it is showing The count with the heading part
//Get the total count of the Projects
List<WebElement> elems = WebUiCommonHelper.findWebElements(Projects_Count_In_Same_Page_Global, 30)
println ("Getting all the values: " + "\n" + elems.text )
println('No of Projects with the: ' + ProjectName + " name are "+ elems.size())
I was tempted to suggest the same, since is the most trivial for count.
But the user may later ask :i need to access element[idx]
Because, why not?
For this, idx may work, but is not a guarantee,no matter zero or one based index
Yes, only the last 3 lines have class so as the Heading part doesn’t have class I made some changings in my xPath!
This is the Xpath that I made
//li[@class=“hover:underline pointer ml-3”]
before I was accessing it through div so it was showing the data count with the heading. but now its showing the count without the HEADING Part I just hope this approach is correct.