Untitled
unknown
csharp
2 years ago
670 B
8
Indexable
public bool IsSessionShownInList(string sessionName)
{
try
{
IWebElement listViewContainer = Driver.FindElement(By.Id("listViewContainer"));
IEnumerable<IWebElement> sessionList = GetListViewDisplayedRows();
return SessionExists(sessionList, sessionName);
}
catch (NoSuchElementException)
{
// Handle NoSuchElementException if needed
}
return false; // No matching session found
}
// Separate method to check if the session exists in the list
private bool SessionExists(IEnumerable<IWebElement> sessionList, string sessionName)
{
return sessionList.Any(session => session.Text.Contains(sessionName));
}Editor is loading...
Leave a Comment