cheezy / page-object

Gem to implement PageObject pattern in watir-webdriver and selenium-webdriver
MIT License
653 stars 220 forks source link

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

Closed taolinqu closed 5 years ago

taolinqu commented 5 years ago

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.

jkotests commented 5 years ago

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

taolinqu commented 5 years ago

:+1: Thank you @jkotests Waiting for the merge of your PR

soumyaray commented 5 years ago

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

jkotests commented 5 years ago

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