我需要按类和它包含的文本来查找元素。我想这样的,但毫无效果,请帮助(对我来说是更好的使用CSS来选择,但XPath是也没关系):如何通过两个属性查找元素? c#webdriver
Driver.FindElement(By.XPath("//td[contains(@class,'TestClass') and .//text()='TestText']"))
Driver.FindElement(By.CssSelector("td.TestClass:contains('TestText')"))
元素:
<td class="TestClass"> TestText</td>
<td class="TestClass"> TestText1</td>
<td class="TestClass"> TestText2</td>...