活泼的页面对象动态元素查找器的列表在哪里? [英] Where is the list of the cheezy page-object dynamic element finders?

查看:130
本文介绍了活泼的页面对象动态元素查找器的列表在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为参考,我指的是帖子

As a reference I am referring to this post.

基本上说而不是说text_field(:tf_elem, id:'id1').我们可以做text_field_element(id: 'id1').我绝对更喜欢后者.它也适用于多个元素,因此text_field_elements.我似乎不知道如何为单选按钮做到这一点.我正在尝试radio_elements,但无法正常工作.未定义的方法.令人沮丧的是,我在其他任何地方都找不到该信息.如何使它适用于单选按钮,并且使用text_field_element/text_field_elements样式为所有元素提供欺骗表"以供将来参考?

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?

推荐答案

包含动态定位符:

  • 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.

例如,对于单选元素,ADVANCED_ELEMENTS数组中有一个"radio_button".动态方法将是:

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进行第一场比赛,
  • radio_button_elements用于所有比赛.
  • radio_button_element for the first match and
  • radio_button_elements for all matches.

这篇关于活泼的页面对象动态元素查找器的列表在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆