O'Reilly logo

Selenium 1.0 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

Time for action - finding elements by CSS

So finding Elements by XPath can be an extremely costly exercise. A way around this is to use CSS selectors to find the objects that you need. Selenium is compatible with CSS 1.0, CSS 2.0, and CSS 3.0 selectors. There are a number of items that are supported such as namespace in CSS 3.0 and some pseudo classes and pseudo elements.

The syntax of your locator will look like css=cssSelector. Let's create our first selector to find an element on our page.

  1. Open the Selenium IDE.
  2. Open Firebug and click on the Firefinder tab.
  3. We are going to look at one of the buttons in the div with the ID divontheleft. The CSS Selector for the buttons would be div.leftdiv input. Place that into Firefinder and click on the Filter ...

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