Skip to content

Commit

Permalink
Made the send_keys helper work in selenium as well as cuprite (#3328)
Browse files Browse the repository at this point in the history
A few of the test helpers use the `type` helper method but in selenium it raises this error:

     NoMethodError:
       undefined method `keyboard' for #<Selenium::WebDriver::Chrome::Driver:0x000000013ebbb950>

I've changed this to check if the `keyboard` property exists and if it does not, try sending keys to the page instead (which works in selenium).
  • Loading branch information
iainbeeston authored Oct 14, 2024
1 parent 7a4046a commit c0d852d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/avo/test_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,11 @@ def tag_suggestions(field:, input:)
end

def type(...)
page.driver.browser.keyboard.type(...)
if page.driver.browser.respond_to?(:keyboard)
page.driver.browser.keyboard.type(...)
else
page.send_keys(...)
end
end

def accept_custom_alert(&block)
Expand Down

0 comments on commit c0d852d

Please sign in to comment.