Namespace: webdriver
View Source

# class TouchSequence

Class for defining sequences of user touch interactions. Each sequence will not be executed until `#perform` is called.

Example:

    new webdriver.TouchSequence(driver).
        tapAndHold({x: 0, y: 0}).
        move({x: 3, y: 4}).
        release({x: 10, y: 10}).
        perform();

## new TouchSequence(driver)

Parameters

driver`webdriver.WebDriver`

  The driver instance to use.

## Instance Methods

### doubleTap(elem)code »

Double taps an element.

Parameters

elem`webdriver.WebElement`

  The element to double tap.

Returns

`webdriver.TouchSequence`

  A self reference.

### flick(speed)code »

Flick, starting anywhere on the screen, at speed xspeed and yspeed.

Parameters

speed`{xspeed: number, yspeed: number}`

  The speed to flick in each direction, in pixels per second.

Returns

`webdriver.TouchSequence`

  A self reference.

### flickElement(elem, offset, speed)code »

Flick starting at elem and moving by x and y at specified speed.

Parameters

elem`webdriver.WebElement`

  The element where flick starts.

offset`{x: number, y: number}`

  The offset to flick to.

speed`number`

  The speed to flick at in pixels per second.

Returns

`webdriver.TouchSequence`

  A self reference.

### longPress(elem)code »

Long press on an element.

Parameters

elem`webdriver.WebElement`

  The element to long press.

Returns

`webdriver.TouchSequence`

  A self reference.

### move(location)code »

Move a held touch to the specified location.

Parameters

location`{x: number, y: number}`

  The location to move to.

Returns

`webdriver.TouchSequence`

  A self reference.

### perform()code »

Executes this action sequence.

Returns

`webdriver.promise.Promise`

  A promise that will be resolved once this sequence has completed.

### release(location)code »

Release a held touch at the specified location.

Parameters

location`{x: number, y: number}`

  The location to release at.

Returns

`webdriver.TouchSequence`

  A self reference.

### scroll(offset)code »

Scrolls the touch screen by the given offset.

Parameters

offset`{x: number, y: number}`

  The offset to scroll to.

Returns

`webdriver.TouchSequence`

  A self reference.

### scrollFromElement(elem, offset)code »

Scrolls the touch screen, starting on `elem` and moving by the specified offset.

Parameters

elem`webdriver.WebElement`

  The element where scroll starts.

offset`{x: number, y: number}`

  The offset to scroll to.

Returns

`webdriver.TouchSequence`

  A self reference.

### tap(elem)code »

Taps an element.

Parameters

elem`webdriver.WebElement`

  The element to tap.

Returns

`webdriver.TouchSequence`

  A self reference.

### tapAndHold(location)code »

Touch down at the given location.

Parameters

location`{x: number, y: number}`

  The location to touch down at.

Returns

`webdriver.TouchSequence`

  A self reference.