ruby - Why does the deprecation warning appear when using the label method? -


reveal a rejection warning when I run the following code:

  Classes MatchingPage PageObject the Watir div (: choose_competitor_dialog ,: class = & gt; 'dijitDialogPaneContentArea PF matching entrants dlg') def competitor_name_select (name) self.choose_competitor_dialog_element.label (: text = & gt; name) .parent.checkbox (: class = & Gt; 'Submit Reset Digit Checkbox Input'). Setting on End and Matching Page. Match_page | matching_page.competitor_name_select 'shop.com' end  

say Warning:

* Deprecation warning If you're calling There is a method name label `competitor_name_select '/home/spoonest/workspace/csv_ui_checker/pages.rb:77:in. This method is not present in the page-object, so it is being given to the driver. This feature will be removed in the near future. Please change your code to call the correct code-item method. * If you are using the functionality that is not present in the Page Item, add it.

How can I locate the label element without this warning?

A page object element is called a method, do not know in this case, the Label , the method has been handed down to the underlying water (or selenium) element, when this happens, you will receive warnings.

Head detection label element method is called label in the water. However, to avoid warning in page object gem, it should be label_element :

  def competitor_name_select (name) self.choose_competitor_dialog_element.label_element (: text = & gt; ; Name). Parent.checkbox (: class => 'dijitReset dijitCheckBoxInput'). Set End  

Comments