1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

By Rafaela Azevedo
How can I do a select in a list of elements with some attributes in equal. This is simple, like a query in SQL:
First you have to create a enumerable of WebElements:
Enumerable list = from item in bsaNavigator.FindElements(By.TagName(“span“)).ToList() // the list of elements are span or td, or whatever you want. With Xpath, or id… you will decide .
where item.GetAttribute(“class“).Contains(“rmText“) && item.Text.Equals(“TextElement“.ToString()) //this is the condition that you will make, like every elements of span who have the attribute of the class have contains the text “rmText” and the Text is equals a something you need.
select item; // select the item with the conditions

WebElement Element = list.FirstOrDefault(); // catch the first element of the list with selects.Element.Click(); // the action or whatever you want do with the element.

Simple and very usefull !!

Bye bye !


Category: Programming, QA, Test and Automation Stuffs, conditions in select, enumerable, enumerables, list, list with condition, list with select, list with where, select in list, select in list of webelements, select in list with conditions, webelements list

Você também pode querer ler

Comments are off for this post.