Pregunta de entrevista de Wipro

What is Difference between XPath and CSS Selectors in Selenium WebDriver

Respuestas de entrevistas

Anónimo

19 ene 2020

Major Difference I see is CSS Selector is faster then Relative Xpath. Relative XPath tends to find multiple elements and used in special case only. He asked like there is one major difference can you tell that. I couldn't answer that as I told I have used id and name selector more than CSS selector.

2

Anónimo

12 jun 2021

In Xpath you can traverse backward and forward as per your need but in CSS you can only move forward. Also Xpath can be created by using text() but there is no such way of finding element in CSS CSS is faster comparatively.

1