Counting the number of elements
I need to count the number of elements which in this case the number of products held by each customer. My attempt for solving this is by counting the number of "li" tag, then accessing "ticket-type". Any suggestion on how this can be achieved?: List<WebElement> labels = driver.findElements(By.xpath("//label[@class='ticket-type']")); int ProdNum = labels.size(); String strI1 = Integer.toString(ProdNum); System.out.print("Number of products on this card:" + strI1); // getting the name of the last product String LastProd = labels.get(labels.size() - 1).getText(); System.out.print("The last order
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.