--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Count is not valid as a locator, you are trying to do something that is not possible.
A By object is a locator used to find an element in the DOM, returning a number as an element location is nonsense and will not work
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/BWARSWFrr_IJ.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I was stating that without using a By object you CANNOT locate an element using WebDriver APIs.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Having said that, you could try using JavascriptExecutor.executeScript() to call document.evaluate() on your document. That code would look something like this:
// WARNING: Untested code written from
// memory without benefit of an IDE! May
// not run or compile without modification.
int count = (int)((JavascriptExecutor)driver).executeScript("return document.evaluate('count(//tr)');");
HOWEVER, and this is a big however, this code will only work for browsers that have a native XPath-over-HTML engine. At the moment, that specifically excludes IE, and may also exclude others.
--Jim