Skip to content

Instantly share code, notes, and snippets.

@angelovstanton
Last active December 11, 2017 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelovstanton/c377ae3ecf9165859c0e225042edbb7b to your computer and use it in GitHub Desktop.
Save angelovstanton/c377ae3ecf9165859c0e225042edbb7b to your computer and use it in GitHub Desktop.
[TestClass]
public class XpathExpressions
{
private IWebDriver _driver;
[TestInitialize]
public void SetupTest()
{
_driver = new FirefoxDriver();
_driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30);
}
[TestCleanup]
public void TeardownTest()
{
_driver.Quit();
}
[TestMethod]
public void Find_Column_Table_XPath()
{
_driver.Navigate().GoToUrl(@"tutorialspointCom/html/html_tables.htm");
var element = _driver.FindElement(By.XPath("//td[contains(text(), '5000')]/preceding-sibling::td[1]"));
Assert.AreEqual("Ramesh Raman", element.Text);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment