cheezy/page-object

Differnt present? methods are called when using element.present? and element.when_present

Closed this issue ยท 4 comments

I am using the follwing lines in my PageObject class:

radio_button(:your_name, :id => 'an_id')

def do_work
your_name_element.present?
your_name_element.when_present
end

I was confused when when_present is always timed out but present? always returns true.

I debugged and found out that:
your_name_element.present? is using the present? method defined in C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/core_ext/object/blank.rb.

In your_name_element.when_present call, there is a call to present? method as well. But the present? method is defined in C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/watir-6.14.0/lib/watir/elements/element.rb

I am using latest PageObject gem which is 2.2.4.

This is caused by ActiveSupport adding Object#present?. PR #466 has been opened to address this.

๐Ÿ‘
Thank you @jkotests
Waiting for the merge of your PR

This is a great gem but no commits or PRs accepted in a year โ€” is this project still maintained?

@taolinqu , @soumyaray , PR #466 is now merged. A release will go out in the next day or two.