Below is a screen shot of html containing two lists of span tags under nested div tags. Both sets of span lists are identical. How do I get the count of span tags of one or the other? Notice that only the top most div has an id. I can’t rely on jQuery(“#resultsContainer span”).length because I’ll get the total span tags in the entire container.

=====================
2/24/2012 – final answer
long pageCountText = (long)Element.GetLongValueFromJQuery(driver, "$('#resultsContainer .pagination').first().children('span').length");
public static long GetLongValueFromJQuery(IWebDriver driver, string jQueryCode)
{
IJavaScriptExecutor js = driver as IJavaScriptExecutor;
return (long)js.ExecuteScript("return " + jQueryCode);
}
will give you the count of the first collection.