Hey Guys,
If you people have ever written any selenium scripts, you must be aware of XPath and CSS selectors. They are the most used selectors in Selenium especially XPath. There are other selectors like ID,Class Name, Name, Link Text though exist and you can use them but XPath and CSS gives you an edge while finding an element in complex HTML structure. Ok so which one is better? XPath or CSS????
In my experience so far, I have used XPath selectors/locators in selenium but in recent times they are my last options to use, Yes I mean, I prefer CSS before XPath. Reason is very simple, XPath is slow. I do write all my tests for IE browser and IE does not support XPath natively and it is damn slow in IE. But as I said, It is my last option that mean, i know when no other selectors finds me an element, XPath is the saviour.
Here I am posting a video by Sauce which is showing a comparison between XPath and CSS, a really nice video to watch.
Watch the video, and share your experiences with XPath and CSS selectors in Selenium also. Please give your valuable comments to improve the blog.
Thanks!!
If you people have ever written any selenium scripts, you must be aware of XPath and CSS selectors. They are the most used selectors in Selenium especially XPath. There are other selectors like ID,Class Name, Name, Link Text though exist and you can use them but XPath and CSS gives you an edge while finding an element in complex HTML structure. Ok so which one is better? XPath or CSS????
In my experience so far, I have used XPath selectors/locators in selenium but in recent times they are my last options to use, Yes I mean, I prefer CSS before XPath. Reason is very simple, XPath is slow. I do write all my tests for IE browser and IE does not support XPath natively and it is damn slow in IE. But as I said, It is my last option that mean, i know when no other selectors finds me an element, XPath is the saviour.
Here I am posting a video by Sauce which is showing a comparison between XPath and CSS, a really nice video to watch.
Watch the video, and share your experiences with XPath and CSS selectors in Selenium also. Please give your valuable comments to improve the blog.
Thanks!!