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.



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

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.



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

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.



40
41
42
43
# File 'lib/selenium/webdriver/common/mouse.rb', line 40

def context_click(element = nil)
  move_if_needed element
  @bridge.context_click
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.



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

def double_click(element = nil)
  move_if_needed element
  @bridge.double_click
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.



45
46
47
48
# File 'lib/selenium/webdriver/common/mouse.rb', line 45

def down(element = nil)
  move_if_needed element
  @bridge.mouse_down
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.



70
71
72
# File 'lib/selenium/webdriver/common/mouse.rb', line 70

def move_by(right_by, down_by)
  @bridge.mouse_move_to nil, Integer(right_by), Integer(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)


64
65
66
67
68
# File 'lib/selenium/webdriver/common/mouse.rb', line 64

def move_to(element, right_by = nil, down_by = nil)
  assert_element element

  @bridge.mouse_move_to 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.



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

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