0
我無法使用xpath找到元素「Inventory」。我不確定我是否正確使用它。我目前無權添加alt標籤。使用xpath找不到元素
// C#
IWebElement dropdown = driver.FindElement(By.XPath("//a[@class='dropdown-toggle']"));
IWebElement inventory = dropdown.FindElement(By.XPath("//a[text()='Inventory'] /@href"));
//html
<li class="dropdown open">
<a class="dropdown-toggle" data-toggle="dropdown">
Inventory
<i class="caret"></i>
</a>
<ul class="dropdown-menu">
<li>
<a href="/government/product-categories">Product Categories</a>
</li>
</ul>
</li>