Java - Selenium - Use contains with list of elements

0

I have on a site the products that have been added to the cart. I want to verify that the product "Test T-Shirt" was added successfully. For this, I have a string where this value (Test T-Shirt) is defined. Ex: String _product1 = "Camiseta Teste" .

However, the products added to the cart have the same id (name). In this ID, when I use a gettext(); the name of each product is returned.

I want to do the following:

Verify that the string _product1 is equal to the text of any of these id name products.

So my code needs to get this list of elements (name). Check the first product in the cart, see what it contains, if it is equal to the _product1 variable, if it is, pass the test. If it is not, continue to the last existing element in the list. If any of these elements is equal to _product1, ok. Otherwise, the test fails.

    
asked by anonymous 04.11.2015 / 18:03

0 answers