I need to identify "X" (cancel) button. HTML looks like this:
<div class="ingredients-container-header">
<div class="ingredients-container-header-name">Ingredients:</div>
<div class="ingredients-container-header-close">
<span class="material-icons cancel-icon " style="color: rgba(0, 0, 0, 0.87); position: relative; font-size: 24px; display: inline-block; user-select: none; transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;">cancel</span></div></div>
Tried doing it directly by span but it does not work (the problem might be that, it's not unique (many cancel button has the same span)
driver.FindElement(By.XPath("//span[@class ='material-icons cancel-icon')]"));
The thing which needs to be done, is to go by the class: "ingredients-container-header-close" and then somehow "go down" to the span. Can someone tell me how it can be done? (1 parent element and than few child elements, choosing that child one)