Sha256: e9548fe60a4618f4393696e29e95c45cc80a1cd8d291a8d35995597df11e6b5a

Contents?: true

Size: 1.38 KB

Versions: 64

Compression:

Stored size: 1.38 KB

Contents

module Selenium
  module WebDriver
    class TouchActionBuilder < ActionBuilder

      #
      # @api private
      #

      def initialize(mouse, keyboard, touch_screen)
        super(mouse, keyboard)
        @devices[:touch_screen] = touch_screen
      end

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

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

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

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

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

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

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

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

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

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

    end
  end
end

Version data entries

64 entries across 64 versions & 4 rubygems

Version Path
selenium-webdriver-2.45.0 lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.45.0.dev3 lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.45.0.dev2 lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.45.0.dev lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.44.0 lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.44.0.dev lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.43.0 lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.42.0 lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.41.0 lib/selenium/webdriver/common/touch_action_builder.rb
browserstack-webdriver-2.40.1 lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.40.0 lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.40.0.rc2 lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.40.0.rc1 lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.39.0 lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.38.0 lib/selenium/webdriver/common/touch_action_builder.rb
browserstack-webdriver-0.0.22 lib/selenium/webdriver/common/touch_action_builder.rb
browserstack-webdriver-0.0.1 lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.37.0 lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.35.1 lib/selenium/webdriver/common/touch_action_builder.rb
selenium-webdriver-2.35.0 lib/selenium/webdriver/common/touch_action_builder.rb