Class: Selenium::WebDriver::Mouse Private

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

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.

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.



7
8
9
# File 'lib/selenium/webdriver/common/mouse.rb', line 7

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.



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

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.



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

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.



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

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.



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

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

#move_by(down_by, right_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.



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

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

#move_to(element, down_by = nil, right_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)


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

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

  @bridge.mouseMoveTo element.ref, down_by, right_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.



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

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