Class: Selenium::WebDriver::TouchActionBuilder

Inherits:
ActionBuilder show all
Defined in:
lib/selenium/webdriver/common/touch_action_builder.rb

Instance Method Summary collapse

Methods inherited from ActionBuilder

#click, #click_and_hold, #context_click, #double_click, #drag_and_drop, #drag_and_drop_by, #key_down, #key_up, #move_by, #move_to, #perform, #release, #send_keys

Constructor Details

#initialize(mouse, keyboard, touch_screen) ⇒ TouchActionBuilder

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 TouchActionBuilder.



27
28
29
30
31
# File 'lib/selenium/webdriver/common/touch_action_builder.rb', line 27

def initialize(mouse, keyboard, touch_screen)
  WebDriver.logger.deprecate(self.class.name)
  super(mouse, keyboard)
  @devices[:touch_screen] = touch_screen
end

Instance Method Details

#double_tap(element) ⇒ Object



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

def double_tap(element)
  @actions << [:touch_screen, :double_tap, [element]]
  self
end

#down(x, y = nil) ⇒ Object



62
63
64
65
# File 'lib/selenium/webdriver/common/touch_action_builder.rb', line 62

def down(x, y = nil)
  @actions << [:touch_screen, :down, [x, y]]
  self
end

#flick(*args) ⇒ Object

Raises:

  • (ArgumentError)


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

def flick(*args)
  raise ArgumentError, "wrong number of arguments, expected 2 or 4, got #{args.size}" unless [2, 4].include? args.size

  @actions << [:touch_screen, :flick, args]
  self
end

#long_press(element) ⇒ Object



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

def long_press(element)
  @actions << [:touch_screen, :long_press, [element]]
  self
end

#move(x, y = nil) ⇒ Object



72
73
74
75
# File 'lib/selenium/webdriver/common/touch_action_builder.rb', line 72

def move(x, y = nil)
  @actions << [:touch_screen, :move, [x, y]]
  self
end

#scroll(*args) ⇒ Object

Raises:

  • (ArgumentError)


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

def scroll(*args)
  raise ArgumentError, "wrong number of arguments, expected 2..3, got #{args.size}" unless [2, 3].include? args.size

  @actions << [:touch_screen, :scroll, args]
  self
end

#single_tap(element) ⇒ Object



47
48
49
50
# File 'lib/selenium/webdriver/common/touch_action_builder.rb', line 47

def single_tap(element)
  @actions << [:touch_screen, :single_tap, [element]]
  self
end

#up(x, y = nil) ⇒ Object



67
68
69
70
# File 'lib/selenium/webdriver/common/touch_action_builder.rb', line 67

def up(x, y = nil)
  @actions << [:touch_screen, :up, [x, y]]
  self
end