Selenium's Actions API animates every pointer move to make it somewhat realistic. Capybara uses this for
hoverdrag_toright_clickdouble_click-
clickwith an offset (x:,y:) or modifier keys
Each of these waits 250 ms for a test-only animation which we usually try to disable anyway. You can make it instant if you want:
# spec/support/instant_pointer_moves.rb
if Gem::Version.new(Capybara::VERSION) > Gem::Version.new('3.40.0')
raise 'Please check if Capybara::Selenium::Node#browser_action still builds every action chain (InstantPointerMoves)'
end
module InstantPointerMoves
private
# Capybara builds every action chain here
def browser_action
super.tap { |action| action.default_move_duration = 0 }
end
end
Capybara::Selenium::Node.prepend(InstantPointerMoves)
Posted by Michael Leimstädtner to makandra dev (2026-10-19 11:58)