Class: Selenium::WebDriver::Mouse Private

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/common/mouse.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

See Also:

Instance Method Summary collapse

Constructor Details

#initialize(bridge) ⇒ Mouse

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Mouse


11
12
13
# File 'lib/selenium/webdriver/common/mouse.rb', line 11

def initialize(bridge)
  @bridge = bridge
end

Instance Method Details

#click(element = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


15
16
17
18
# File 'lib/selenium/webdriver/common/mouse.rb', line 15

def click(element = nil)
  move_if_needed element
  @bridge.click
end

#context_click(element = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


25
26
27
28
# File 'lib/selenium/webdriver/common/mouse.rb', line 25

def context_click(element = nil)
  move_if_needed element
  @bridge.contextClick
end

#double_click(element = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


20
21
22
23
# File 'lib/selenium/webdriver/common/mouse.rb', line 20

def double_click(element = nil)
  move_if_needed element
  @bridge.doubleClick
end

#down(element = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


30
31
32
33
# File 'lib/selenium/webdriver/common/mouse.rb', line 30

def down(element = nil)
  move_if_needed element
  @bridge.mouseDown
end

#move_by(right_by, down_by) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


57
58
59
# File 'lib/selenium/webdriver/common/mouse.rb', line 57

def move_by(right_by, down_by)
  @bridge.mouseMoveTo nil, right_by, down_by
end

#move_to(element, right_by = nil, down_by = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Move the mouse.

Examples:

driver.mouse.move_to(element)
driver.mouse.move_to(element, 5, 5)

49
50
51
52
53
54
55
# File 'lib/selenium/webdriver/common/mouse.rb', line 49

def move_to(element, right_by = nil, down_by = nil)
  unless element.kind_of? Element
    raise TypeError, "expected #{Element}, got #{element.inspect}:#{element.class}"
  end

  @bridge.mouseMoveTo element.ref, right_by, down_by
end

#up(element = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


35
36
37
38
# File 'lib/selenium/webdriver/common/mouse.rb', line 35

def up(element = nil)
  move_if_needed element
  @bridge.mouseUp
end