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

别来无恙 提交于 2020-01-16 11:32:13

问题


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 and
  • radio_button_elements for all matches.


来源:https://stackoverflow.com/questions/59077348/where-is-the-list-of-the-cheezy-page-object-dynamic-element-finders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!