Reputation: 181
I am not able to find the element "Inventory" using xpath. I am not sure if I am using it correctly. I currently do not have access to add alt tags.
// 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>
Upvotes: 0
Views: 233
Reputation: 38712
There is some whitespace around the term "Inventory". User contains(...)
to perform a substring search:
//a[contains(., 'Inventory')]
Upvotes: 1