Bug? Local MS Edge on Intel Mac meets Ruby 3 with button.click

14 views
Skip to first unread message

Brian Bayer

unread,
Dec 21, 2022, 5:03:43 PM12/21/22
to Capybara
Greetings,

I am suspecting this is related to the Separation of positional and keyword arguments in Ruby 3.0 (see https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/).

I am happy to create an issue BUT https://github.com/teamcapybara/capybara/blob/master/CONTRIBUTING.md suggested that I come here first.

TL;DR:
  • Capybara latest 3.38.0
  • MS Edge Browser (latest Version 108.0.1462.54 (Official build) (x86_64)) on Intel Mac (mid 2012 macOS 10.15.7)
  • Visit external site
  • Issue with click_button 'Login'
  • It works fine in Ruby 2 (2.7.7) 
  • Throws exception in Ruby 3 (3.0.1 - 3.1.3)
    ...rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/selenium/node.rb:108:in `click': wrong number of arguments (given 2, expected 0..1) (ArgumentError)
TMI:
This is only occurring with local MS Edge with Ruby 3.  Local Chrome, Firefox, Safari all work fine in Ruby 3.  The (remote) selenium/standalone-edge container also works fine with Ruby 3.

TO REPRODUCE:
Prerequisites:
  • MS Edge installed locally
  • EdgeDriver installed locally and configured in path (or use gem 'webdrivers')
  • Maybe? (Intel) Mac
Sample Script: (capybara_edge_external_page.rb)
# --- START SCRIPT ---
require 'capybara'
require 'selenium/webdriver'

# --- Capybara Selenium Webdriver with Edge Browser Setup ---
Capybara.register_driver :selenium_edge do |app|
edge_options = Selenium::WebDriver::Options.edge
Capybara::Selenium::Driver.new(app, browser: :edge, options: edge_options).tap do |driver|
driver.browser
end
end
Capybara.default_driver = :selenium_edge

# --- Capybara Selenium/Edge Session ---
sess = Capybara::Session.new(:selenium_edge)

sess.within("#login") do
sess.fill_in 'Username', with: 'tomsmith'
sess.fill_in 'Password', with: 'SuperSecretPassword!'

begin
sess.click_button 'Login'
rescue => exception
puts exception.backtrace
raise
end
end
# --- END SCRIPT ---

STACK TRACE:
/Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/selenium/node.rb:108:in `click'
/Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/selenium/nodes/edge_node.rb:42:in `click'
/Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:172:in `block in click'
/Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:608:in `block in perform_click_action'
/Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/node/base.rb:84:in `synchronize'
/Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:608:in `perform_click_action'
/Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:171:in `click'
/Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/node/actions.rb:58:in `click_button'
/Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/session.rb:773:in `click_button'
capybara_edge_external_page.rb:22:in `block in <main>'
/Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/session.rb:365:in `within'
capybara_edge_external_page.rb:17:in `<main>'
/Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/selenium/node.rb:108:in `click': wrong number of arguments (given 2, expected 0..1) (ArgumentError)
    from /Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/selenium/nodes/edge_node.rb:42:in `click'
    from /Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:172:in `block in click'
    from /Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:608:in `block in perform_click_action'
    from /Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/node/base.rb:84:in `synchronize'
    from /Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:608:in `perform_click_action'
    from /Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/node/element.rb:171:in `click'
    from /Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/node/actions.rb:58:in `click_button'
    from /Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/session.rb:773:in `click_button'
    from capybara_edge_external_page.rb:22:in `block in <main>'
    from /Users/nunya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/capybara-3.38.0/lib/capybara/session.rb:365:in `within'
    from capybara_edge_external_page.rb:17:in `<main>'

Reply all
Reply to author
Forward
0 new messages