Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 C# 中的 Selenium Webdriver 查找并单击元素“Test 123”。我已经尝试了所有我能想到的方法,但没有任何好处。我认为这些值在被选择之前是隐藏的,但不确定。请问有什么想法吗?
在此处输入图像描述
简单的 Xpath 定位器可以解决问题:
public void ClickElementByXpath(string text) { IWebElement element = Driver.FindElement(By.XPath("//li[contains(text(), '${text}')]"); element.Click(); } ClickElementByXpath("Test 123");