O'Reilly logo

Selenium 2 Testing Tools Beginner's Guide by David Burns

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Finding elements using a more generic method

We have had a look at using helper methods to find elements on the page. The downside to using them is that if something changes, you need to change the entire method that you are using to find the element. This can increase the maintenance costs for doing this.

The other approach is to use the findElement() method, pass in the By abstract class, and call static methods on that class.

Let's see this in action.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required