Collections in Robot Framework
Introduction
Find an element by its class name
To find an element by its class name you need to use Get Elements because there can be many elements
belonging to the same class.
Then from the list of found elements you can pick the one you need by its index and then, with Get Property
get the text.
To work with the list you need to include the Collections library
*** Settings *** … Library Collections … *** Variables *** ${elements} = Get Elements .className ${elem} = Get From List ${elements} 0 ${elem_text}= Get Property ${elem} innerText
As a result, the variable elem_text holds the text of the element of class className with index 0
In practice, this is the text of the first element of that class on the page.
Article author: Andrei Olegovich