Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have another requirement like this in my c# selenium application. Since there are so many content in my webpage table, it will be quite nice to sort it based on the app name. I have content like this:

Description     App Name    Information
Some Desc1       App1         Some Info
Some Desc2       App2         Some Info
Some Desc3       App2         Some Info
Some Desc4       App3         Some Info
Some Desc5       App4         Some Info

And next to App Name, I have a sort button which lists the app names.I can click on the sort button and I could view all those app names.But I cant click on a particular app name, which I needed.

I have tried some thing like this:

var elems = driver.FindElements(By.TagName("SPAN")); //SPAN is the only attribute I could see and it is also unique for all the app names provided in the list. So, used driver.FindElements
IList<IWebElement> list = elems; //Converts it as a list
var elem= list.Equals(text); // text represents an app name provided by the user in a textbox at the start of the application. Storing that appname into a variable elem.
string targetele = elem.ToString(); //Converting it into a string
if (list.Equals(text))
{
driver.FindElement(By.Name(targetele)).Click(); //Click on a particular app name to filter
}

Hope you got an idea on what I have tried. Any comments or ideas are really appreciated..

share|improve this question
add comment (requires an account with 50 reputation)

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.