Reputation: 1551
Ok I am missing something here. My assert is failing but looking at locals, my value and return match. Tired of looking at this. What am I missing?
Code:
List<String> item = new List<string>();
// grab the cells that contain the popsockets you want to sort
IReadOnlyList<IWebElement> cells = Driver.FindElements_byXpath("//h2[@class='link']/a");
// loop through the popsockets and assign the price into the ArrayList
foreach (IWebElement cell in cells)
{
item.Add(cell.Text);
Assert.IsTrue(item.Contains(value));
}
Locals:
Upvotes: 1
Views: 106
Reputation: 421
You're calling .contains()
on the list itself, not the items in the list. So it's looking for the reference to the value rather than the word.
Assert.IsTrue(item.Any(itm => itm.Contains(value)));
See List.Contains()
Upvotes: 4