Skip to content

Commit

Permalink
[rb] allow specifying which button gets clicked in pointer action cla…
Browse files Browse the repository at this point in the history
…ss methods
  • Loading branch information
titusfortner committed Jun 1, 2022
1 parent 60bf8e4 commit b0057b5
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions rb/lib/selenium/webdriver/common/interactions/pointer_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ def move_to_location(x, y, device: nil, duration: default_move_duration, **opts)
# @return [ActionBuilder] A self reference.
#

def click_and_hold(element = nil, device: nil)
def click_and_hold(element = nil, button: nil, device: nil)
move_to(element, device: device) if element
pointer_down(:left, device: device)
pointer_down(button || :left, device: device)
self
end

Expand All @@ -211,8 +211,8 @@ def click_and_hold(element = nil, device: nil)
# @return [ActionBuilder] A self reference.
#

def release(device: nil)
pointer_up(:left, device: device)
def release(button: nil, device: nil)
pointer_up(button || :left, device: device)
self
end

Expand All @@ -238,10 +238,10 @@ def release(device: nil)
# @return [ActionBuilder] A self reference.
#

def click(element = nil, device: nil)
def click(element = nil, button: nil, device: nil)
move_to(element, device: device) if element
pointer_down(:left, device: device)
pointer_up(:left, device: device)
pointer_down(button || :left, device: device)
pointer_up(button || :left, device: device)
self
end

Expand Down Expand Up @@ -296,10 +296,7 @@ def double_click(element = nil, device: nil)
#

def context_click(element = nil, device: nil)
move_to(element, device: device) if element
pointer_down(:right, device: device)
pointer_up(:right, device: device)
self
click(element, button: :right, device: device)
end

#
Expand Down

0 comments on commit b0057b5

Please sign in to comment.