Can someone help me with the below HTML:
<div id="ext-156" class="menuBar">
<a id="ext-234" href="javascript:void(0);" class="active">
<i id="ext-365" class="menuItem"></i>
</a>
</div>
I am looking for the element with class "menuItem" and only from inside the div with class "menuBar" in Selenium.
Well, depending on what language you're using, the method call will be different, but the selector should be the same across language bindings:
css:
"div.menuBar .menuItem"
xpath:
"//div[@class='menuBar']//*[@class='menuItem']"
In java, the call would look like this:
driver.find(By.cssSelector("div.menuBar .menuItem"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With