mardi 12 janvier 2016

Selenium - How to find element containing strict text

I'm trying to find element using Selenium which text value must be strict match, not just contain the text.

Right now my XPath looks like that:

IWebElement elem = driver.FindElement(By.XPath("//div[text()[contains(.,'" + textToBeFound + "')]]"));

however it finds all elements containing dedicated text not elements containing strictly this text.

I would be grateful for help solving this problem.

Aucun commentaire:

Enregistrer un commentaire