Reputation: 2527
I have a list of records. How I can verify the sorting order using Selenium?
List<WebElement> tableRowCollection = webTableElement .findElements(By.xpath("/table"));
I am getting an error in the above statement "The type List is not generic; it cannot be parameterized with arguments ". I am not sure how to read the records since findElements only returns WebElemt.
Upvotes: 0
Views: 6205
Reputation: 10463
Fix your imports, you most likely are not importing java.util.List
The following code will add the text of a whole row to the collection elements
:
List<WebElement> tableRowCollection = webTableElement.findElements(By.xpath("/table"))
List<String> elements = new LinkedList<String>();
for (WebElement e : tableRowCollection) {
elements.add(e.getText());
}
This should get you started, but I really recommend you to read some documentation related to Java collections.
Upvotes: 1