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

- (Mouse) initialize(bridge)

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

- (Object) click(element = nil)

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

- (Object) context_click(element = nil)

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

- (Object) double_click(element = nil)

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

- (Object) down(element = nil)

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

- (Object) move_by(right_by, down_by)

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(right_by, down_by)
  @bridge.mouseMoveTo nil, right_by, down_by
end

- (Object) move_to(element, right_by = nil, down_by = nil)

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, 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

- (Object) up(element = nil)

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