私の c# セレン アプリケーションには、このような別の要件があります。Web ページ テーブルには非常に多くのコンテンツがあるため、アプリ名に基づいて並べ替えると便利です。次のようなコンテンツがあります。
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
アプリ名の横には、アプリ名を一覧表示する並べ替えボタンがあります。並べ替えボタンをクリックすると、それらのアプリ名をすべて表示できます。しかし、必要な特定のアプリ名をクリックすることはできません。
私はこのようなことを試しました:
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
}