spriteCloud / lapis-lazuli

Cucumber helper functions and scaffolding for easier test automation suite development.
Other
7 stars 7 forks source link

Unable to find Checkbox #17

Closed osteenbergen closed 7 years ago

osteenbergen commented 9 years ago

Have no idea why, but :checkbox doesn't map to the function .checkbox in Watir.

irb(main):025:0> browser.checkbox.present?
=> true
irb(main):026:0> browser.find(:checkbox)
E, [2015-05-27T14:20:00.937706 #23585] ERROR -- #<IO:0x000000017a9558>: Error in find - Cannot find elements with selectors: {:pick=>:first, :mode=>:match_one, :selectors=>[{:like=>{:element=>:checkbox}}]} (http://calliope.pro:88/)
RuntimeError: Error in find - Cannot find elements with selectors: {:pick=>:first, :mode=>:match_one, :selectors=>[{:like=>{:element=>:checkbox}}]} (http://calliope.pro:88/)
    from /var/lib/gems/2.2.0/gems/lapis_lazuli-0.7.0/lib/lapis_lazuli/browser/find.rb:488:in `dispatch_call'
    from /var/lib/gems/2.2.0/gems/lapis_lazuli-0.7.0/lib/lapis_lazuli/browser/find.rb:59:in `find_all'
    from /var/lib/gems/2.2.0/gems/lapis_lazuli-0.7.0/lib/lapis_lazuli/browser/find.rb:83:in `find'
    from (irb):26
    from /usr/bin/irb:11:in `<main>'
irb(main):027:0> browser.find_all(:checkbox)
E, [2015-05-27T14:20:18.123653 #23585] ERROR -- #<IO:0x000000017a9558>: Error in find - Cannot find elements with selectors: {:pick=>:first, :mode=>:match_one, :selectors=>[{:like=>{:element=>:checkbox}}]} (http://calliope.pro:88/)
RuntimeError: Error in find - Cannot find elements with selectors: {:pick=>:first, :mode=>:match_one, :selectors=>[{:like=>{:element=>:checkbox}}]} (http://calliope.pro:88/)
    from /var/lib/gems/2.2.0/gems/lapis_lazuli-0.7.0/lib/lapis_lazuli/browser/find.rb:488:in `dispatch_call'
    from /var/lib/gems/2.2.0/gems/lapis_lazuli-0.7.0/lib/lapis_lazuli/browser/find.rb:59:in `find_all'
    from (irb):27
    from /usr/bin/irb:11:in `<main>'
irb(main):029:0> browser.find(:input => {:type => "checkbox"}).html
=> "<input class=\"ng-untouched ng-dirty ng-valid-parse ng-valid ng-valid-required\" name=\"complete_all\" required=\"\" ng-model=\"Users.register_data.complete_all\" type=\"checkbox\">"
irb(main):030:0> browser.find(:checkbox => {:id => "test"})
TypeError: expected one of [String, Regexp], got {:id=>"test"}:Hash
    from /var/lib/gems/2.2.0/gems/watir-webdriver-0.7.0/lib/watir-webdriver/locators/element_locator.rb:164:in `check_type'
    from /var/lib/gems/2.2.0/gems/watir-webdriver-0.7.0/lib/watir-webdriver/locators/element_locator.rb:68:in `find_all_by_one'
    from /var/lib/gems/2.2.0/gems/watir-webdriver-0.7.0/lib/watir-webdriver/locators/element_locator.rb:47:in `locate_all'
    from /var/lib/gems/2.2.0/gems/watir-webdriver-0.7.0/lib/watir-webdriver/element_collection.rb:95:in `elements'
    from /var/lib/gems/2.2.0/gems/watir-webdriver-0.7.0/lib/watir-webdriver/element_collection.rb:39:in `length'
    from /var/lib/gems/2.2.0/gems/lapis_lazuli-0.7.0/lib/lapis_lazuli/browser/find.rb:338:in `block in find_lambda'
    from /var/lib/gems/2.2.0/gems/lapis_lazuli-0.7.0/lib/lapis_lazuli/browser/find.rb:359:in `call'
    from /var/lib/gems/2.2.0/gems/lapis_lazuli-0.7.0/lib/lapis_lazuli/browser/find.rb:359:in `block in find_lambda_filtered'
    from /var/lib/gems/2.2.0/gems/lapis_lazuli-0.7.0/lib/lapis_lazuli/browser/find.rb:485:in `call'
    from /var/lib/gems/2.2.0/gems/lapis_lazuli-0.7.0/lib/lapis_lazuli/browser/find.rb:485:in `dispatch_call'
    from /var/lib/gems/2.2.0/gems/lapis_lazuli-0.7.0/lib/lapis_lazuli/browser/find.rb:59:in `find_all'
    from /var/lib/gems/2.2.0/gems/lapis_lazuli-0.7.0/lib/lapis_lazuli/browser/find.rb:83:in `find'
    from (irb):35
    from /usr/bin/irb:11:in `<main>'
barzilay commented 7 years ago

Solved by using :type => :checkbox