问题
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?
回答1:
The dynamic locators are included:
- For the PageObject by ElementLocators
- For the Elements by NestedElements
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 andradio_button_elements
for all matches.
来源:https://stackoverflow.com/questions/59077348/where-is-the-list-of-the-cheezy-page-object-dynamic-element-finders