How to count the number of elements are matching with for the given xpath expression
xpath: driver.findElement(By.xpath(\"//div[contains(@id,\'richedittext_insta
Not working in Selenium, which only allows to return nodes from XPath, not primitives like the number returned by count(...)
. Kept for reference and is valid for most other tools offering a more complete XPath API.
You should only return least possible amount of data from the query. count(//div[contains(@id,'richedittext_instance')])
counts the number of results within XPath and thus is faster as all the elements do not have to be passed from the XPath engine to Selenium.
I can't help you with how to fetch this as n int
out of selenium, but this should be easy stuff.