You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you have a custom widget which has a base_element_tag :checkbox the multiple accessor is not working.
Example widget:
class Toggle < PageObject::Elements::CheckBox
def self.accessor_methods(accessor, name)
// some accessor methods
end
end
PageObject.register_widget :toggle, Toggle, :checkbox
When you define a multiple accessor:
class MyPage
include PageObject
toggles :my_toggle, id: 'some_id'
end
When you call it in you test, you get the following error:
NoMethodError: undefined method `checkboxs' for #<Watir::Browser:0x2e3e1221eca4e1fc url="https://some_url" title="xxx">
Did you mean? checkboxes
checkbox
from (eval):1:in `find_watir_elements'
Issue is coming from this line of code: as the base_element_tag is :checkbox, the_call we pass to find_watir_elements is "checkboxs" which is incorrect - it should be "checkboxes".
Possible solution: define_widget_multiple_accessor can be changed to something like:
def self.define_widget_multiple_accessor(base_element_tag, widget_class, widget_tag)
send(:define_method, "#{widget_tag}s_for") do |identifier|
call_keyword = base_element_tag == :checkbox ? 'checkboxe' : base_element_tag
find_watir_elements("#{call_keyword}s(identifier)", widget_class, identifier, base_element_tag)
end
end
The text was updated successfully, but these errors were encountered:
When you have a custom widget which has a base_element_tag :checkbox the multiple accessor is not working.
Example widget:
When you define a multiple accessor:
When you call it in you test, you get the following error:
Issue is coming from this line of code: as the
base_element_tag
is:checkbox
, the_call we pass tofind_watir_elements
is "checkboxs" which is incorrect - it should be "checkboxes".Possible solution:
define_widget_multiple_accessor
can be changed to something like:The text was updated successfully, but these errors were encountered: