TestProject Forum
Powered by leading experts in the test automation community

Css and xpath selectors

why css selector is much faster than xpath ?

Xpath engines are different in each browser, hence make them inconsistent.

The main reason is that tests which intensively use XPath work extremely slow under IE and this feature is the cause of huge variety of problems related to execution speed as well as quality of the tests itself especially during operations with dynamic content.

Naturally, CSS locators have some limitations such as: problems to locate objects by index, problem to locate objects higher in the object hierarchy or so. Either way, if you are interested in your tests performance you’d better try to use CSS locators prior to XPath. XPath is needed in case all other locators aren’t capable.

if xpath engines are different in each browser,then will the same xpath expression works in different ways? And also why the quality of test cases change with xpath