best way to detect an element on a web page for seleniumRC in java

0
0

What is the best way to detect an element on a webpage for automated testing using SeleniumRC using Java?. I know that there are XPath elements and CSS elements, but which one is best?

thanks!
Nitin

  • You must to post comments
0
0

In my opinion, the most accurate way is XPath as you can use XPath’s to describe the exact position of an element within the DOM, however there are some instances where CSS locators work better than XPaths.

Using selenium’s ID locator is the most simple, but unless the element you are looking for has an ID not always useful.

The biggest negative when using XPath’s is the performance with Selenium RC and browsers with bad JavaScript rendering engines (Think IE6/IE7). Quite a bit of work has been dome to try and rectify this so if you use well formed XPath’s that only search specific parts of the DOM this problem should be minimal. The Selenium webdriver implementation is much faster.

The summary is really there is no one answer it depends what you want out of a locator, and which browsers you are testing. I personally use XPath in 99% of instances.

I personally use XPath almost exclusively with the occasional CSS locator.

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website