Skip to content

Find the right element

Most steps act on an element of the page: a button to click, a field to fill in, a text to check. Under The element, you tell Allgreen how to recognize it, the way you would describe it to a colleague: “the Sign in button”, “the field labelled Email”.

A step open with its element fields

The quickest way is to click the element in the page: choose Choose in the page and click it. See Choose in the page. If Allgreen cannot name the element, describe it yourself, as below.

Choose one way in Recognize it by:

Way Use it for Example
Its kind and name Buttons, links, headings, checkboxes… In Kind of element, choose the kind; in Name shown, type its visible text or label. Kind Button, name Add to cart
Its label A form field, by the label shown next to it. Email
Its visible text Any text on the page: a message, a price, a title. Order confirmed
Its hint text (inside the empty field) A field with no label, by the grey hint it shows while empty. Search the shop
Its image description (alternative text) An image, by the description written for people who cannot see it. Company logo
Its tooltip An element by the small text that shows when the mouse rests on it. Close
Its test id (given by the developers) An element your developers marked for tests. Ask them for the id. checkout-button
Its code in the page (advanced) The last resort, when nothing else names the element. Ask a developer. #cart .total

The most common kinds are listed first in Kind of element: Button, Link, Text box, Checkbox, Radio button, Drop-down list, Heading, Region, Window, Navigation, Image, List item. More kinds has the others.

With Its kind and name, you can leave Name shown empty to accept any name: for example, “the dialog window”, whatever its title.

By default, the text you type only needs to be part of the element’s text, and capitals do not matter: add to cart finds a button named “Add to cart (2)”. Tick Exact text only when the whole text must match, capitals included.

A page often has several “Add to cart” buttons. If more than one element matches, the step fails and the report says how many matched. Say which one you mean:

  • Which one: 1 for the first, 2 for the second, in the order of the page.
  • The last one: the last of them, however many there are.
  • That contains the text: the one that contains a text somewhere inside. Useful for rows and cards: the “Remove” button in the row that contains “Blue mug”.
  • Only look inside an area: look only inside another element, such as a region, a form, a window or a product card. You describe the area the same way as an element. An area can itself be inside another area, up to three levels. Remove the area takes it away.

The sentence of the step shows your choice, for example: Click the 2nd “Add to cart” button in the “Product B” region.

Some parts of a page are another page embedded inside it: a payment form, a map, a video player. Allgreen cannot see inside them unless you say so. In Where is it?:

  • In the page: the usual case.
  • In an embedded frame, by its title: type the frame’s Title of the frame.
  • In an embedded frame, by its position: type Which frame (1 = the first of the page).

A plan should still pass when the site changes a little. Pick the way of recognizing an element that a visitor would use, because it changes least:

  • Prefer Its kind and name and Its label. They follow what a visitor sees and reads.
  • Use Its visible text for messages and content, not for buttons (a text can appear in several places).
  • Use Its test id when your developers add them: they are made to stay the same.
  • Avoid Its code in the page (advanced): it breaks when developers change the page’s layout, even if nothing visible changed.
  • Avoid Which one when you can: positions change when content is added. That contains the text or Only look inside an area usually lasts longer.
  • Keep names short and stable. Add to cart lasts longer than Add to cart (only 3 left!).