我正在尝试使用 XPath 定位元素,但我的代码不正确,并且我不确定写入语法。
我在下面输入了不起作用的代码。
IWebElement customizeButton = driver.FindElement(By.XPath("//*[@id='container']/div/div[1]/div[1]/div[2]/button[2]"));
该元素的 HTML 代码如下
<button class="button u-space-ls js-customize-button button--primary " data-tooltip="{"placement":"left","title":"Customize"}" data-reactid=".0.0.0.3.3"><span class="icon icon-gear" data-reactid=".0.0.0.3.3.0"></span><span class="u-small-hidden u-medium-hidden" data-reactid=".0.0.0.3.3.1"> Customize</span></button>
你能告诉我应该如何更正我的代码吗?
谢谢