Reputation: 1
I'm trying to build automation alone for my company with no past in automation at all. I'm stuck in trying to make an list of rows from table. Its not the same num of rows in this table (is depends on the choice of values before)
for example I have the table:
ID Name Age
1 Ori 20
2 Dan 16
3 Or 24
I need to select one row, never-mind which one, and press on continue button
Please help me to figure it out
Thanks a lot
Upvotes: -1
Views: 116
Reputation: 336
Find a collection of rows using the FindElements
driver method.
Then take the random element of the collection.
public static T TakeRandom<T>(this IEnumerable<T> source)
{
IEnumerable<T> enumerable = source as T[] ?? source.ToArray();
return enumerable.ElementAt(new Random(Guid.NewGuid().GetHashCode()).Next(0, enumerable.Count()));
}
Click on it.
Upvotes: 0