Skip to content

Instantly share code, notes, and snippets.

@johnmmoss
Created March 13, 2015 16:29
Show Gist options
  • Save johnmmoss/8ae6afe7260a42cf12d6 to your computer and use it in GitHub Desktop.
Save johnmmoss/8ae6afe7260a42cf12d6 to your computer and use it in GitHub Desktop.
Selenium API Test if a component is visible
// Check if the provided value exists in an html table cell
public bool RowExists(string value)
{
try
{
var rowXPath = string.Format("//tr[td[normalize-space(text())='{0}']]", value);
webDriver.FindElement(By.XPath(rowXPath));
return true;
}
catch (NoSuchElementException)
{
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment