Q:

How can I click on this child node / descendant using C# Selenium?

TL;DR: The developer had bound the jQuery click listener to the parent div, not the child span that I had been trying to click.

I'm trying to click the delete button that is in the span tag.
HTML:
<div class="user j isotope-item" data-id="5362" style="position: absolute; left: 0px; top: 0px; transform: translate3d(0px, 0px, 0px);">
    <div class="delete-x">
        <span title="Delete">x</span>
    </div>
    <div class="name longText" title="Edit Location">
        Jkogo Rqrqn
    </div>
</div>

C#:
    public void DeleteUser(IWebDriver webDriver, long userId)
    {
        var deleteButton =
            webDriver.FindElement(
                By.CssSelector($"#userlist-container > div[data-id='{userId}'] > div.delete-x > span"));
        deleteButton.Click(webDriver);
    }

I printed to Console and it looks right/is getting the id at least:
#userlist-container > div[data-id='5362'] > div.delete-x > span

I'm stumped on how to click on this child element! Any help appreciated.

A:

Try this:
webDriver.FindElement(By.xpath($".//div[@data-id='{userId}']/div/span")).Click(webDriver);

but possibly delete action is calling not by span click. In this case nothing happens after the click and you need to find more correct element for this. Somethimes this is parent element, sometimes parent-of-parent.

