Bmoe
Bmoe

Reputation: 978

Where is the list of the cheezy page-object dynamic element finders?

As a reference I am referring to this post.

It basically says instead of saying text_field(:tf_elem, id:'id1'). We can do text_field_element(id: 'id1'). I definitely prefer the latter. It also works for multiple elements so text_field_elements. I can't seem to figure out how to do it for radio buttons. I'm trying radio_elements but not working. Undefined method. Frustratingly enough I can't find this information documented anywhere else. How do I get it to work for radio buttons and is there a "cheat sheat" for future reference for all the elements using the text_field_element/text_field_elements style?

Upvotes: 0

Views: 77

Answers (1)

Justin Ko
Justin Ko

Reputation: 46836

The dynamic locators are included:

For the bulk of the methods, they use the shared LocatorGenerator. In there, the list of BASIC_ELEMENTS and ADVANCED_ELEMENTS suffixed by "_element" and "elements" are the dynamic locator methods.

As an example, for radio elements, there is a "radio_button" in the ADVANCED_ELEMENTS array. The dynamic methods would then be:

  • radio_button_element for the first match and
  • radio_button_elements for all matches.

Upvotes: 2

Related Questions