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
An exception will occur when trying to get the adjacent elements:
class MyPage
include PageObject
label(:abc, id: 'abc')
end
page = MyPage.new(browser)
page.abc_element.following_siblings
#=> C:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-6.16.5/lib/watir/elements/element.rb:844:in `method_missing': undefined method `type' for #<Watir::Label: located: true; {:id=>"abc", :tag_name=>"label"}> (NoMethodError)
#=> from C:/Ruby23/lib/ruby/gems/2.3.0/gems/page-object-2.2.5/lib/page-object/elements/element.rb:185:in `pageobject_wrapper'
#=> from C:/Ruby23/lib/ruby/gems/2.3.0/gems/page-object-2.2.5/lib/page-object/elements/element.rb:131:in `block in following_siblings'
#=> from C:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-6.16.5/lib/watir/element_collection.rb:32:in `each'
#=> from C:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-6.16.5/lib/watir/element_collection.rb:32:in `each'
#=> from C:/Ruby23/lib/ruby/gems/2.3.0/gems/page-object-2.2.5/lib/page-object/elements/element.rb:131:in `collect'
#=> from C:/Ruby23/lib/ruby/gems/2.3.0/gems/page-object-2.2.5/lib/page-object/elements/element.rb:131:in `following_siblings'
The text was updated successfully, but these errors were encountered:
Verified with Page-Object v2.2.5 and Watir v6.16.5. From code inspection, would have existed since Page-Object v2.2.3.
The problem appears to be in the pageobject_wrapper:
def pageobject_wrapper(watir_object)
type = element.type if watir_object.tag_name.to_sym == :input
cls = ::PageObject::Elements.element_class_for(watir_object.tag_name, type)
cls.new(watir_object.to_subtype)
end
Notice that we are retrieving the type of the base element rather than the watir_object.
For example, given the following page, which has an
input
adjacent to adiv
:An exception will occur when trying to get the adjacent elements:
The text was updated successfully, but these errors were encountered: