Simple Selectors

UTAM JSON grammar uses CSS selectors, which are the same selectors you use in any CSS file.

Let's learn how to select things in a page.

In a real page object, you model only what you want to test. This page object is just a simple example to show how to use a few basic CSS selectors.

Take a look at the DOM Tree Viewer. To get the <div class="soup">, use a class selector in the JSON on line 11. To specify a class, use a . before its name, .soup.

You can combine selectors as well. To combine selectors, use a space between them, .list li. Line 18 selects the element with the .list class and then all li elements inside it.

To select an element with a specific attribute, specify the attribute in []s. Line 26 selects the li element with the title attribute broccoli.

Click Run Test.