I've been experimenting with different locators, but I'm struggling to find a straightforward solution for identifying the dynamic number within this span using C# Selenium. Initially, my focus is just on locating the span itself.
<span inventory="Livecount">129</span>
Every time I attempt to locate the element, I receive a NoSuchElement exception, indicating that it cannot be found.
One additional piece of context: The span and its associated number are contained within a widget which I can successfully identify. However, the widget lacks a unique class or ID, so my only reliable method of locating it is through FindElement(By.TagName("inventorySearch")), which has been effective. If there was a way to use a CSS selector to start at the widget element (the parent) and then navigate down to the enclosed span (since each instance only contains one span), my issue would be resolved. My challenge lies in not knowing how to specify a tagname within a CSS selector in C# Selenium - similar to how classes and IDs utilize symbols like . and #. Is there an equivalent for tagnames in C# Selenium? Thank you.