forked from selendroid/selendroid.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgestures.html.haml
64 lines (63 loc) · 2.5 KB
/
gestures.html.haml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
layout: base
title: Mobile Gestures
author: Dominik Dary
---
.container-fluid
.row-fluid
.span3
#sidebar
%ul.nav.nav-tabs.nav-stacked
%li
%a{:href=>'#elementInteractions'} Supported Interactions
%li
%a{:href=>'#ruby'} Ruby Example
%li
%a{:href=>'#python'} Python Example
%li
%a{:href=>'#java'} Java Example
.span9
%h1 Mobile Gestures
%p Selendroid is implementing the <a href="http://code.google.com/p/selenium/wiki/AdvancedUserInteractions">Advanced User Interactions API</a>. This is a new, more comprehensive API for describing actions a user can perform on an app. This includes actions such as drag and drop or clicking multiple elements while holding down the Control key.
%h2#elementInteractions Supported Interactions
%ul
%li <code>doubleTap(WebElement onElement)</code>
%li <code>down(int x, int y)</code>
%li <code>flick(int xSpeed, int ySpeed)</code>
%li <code>flick(WebElement onElement, int xOffset, int yOffset, int speed)</code>
%li <code>longPress(WebElement onElement)</code>
%li <code>move(int x, int y)</code>
%li <code>singleTap(WebElement onElement)</code>
%li <code>up(int x, int y)</code>
%h2 Examples
%p How to swipe from right to left
%h3#ruby Ruby:
%pre
%code.ruby
= preserve do
:escaped
#Please include the touch screen:
#include Selenium::WebDriver::DriverExtensions::HasTouchScreen
pages = driver.find_element(:id,'vp_pages')
driver.touch.flick(pages,-100,0,:normal).perform
%h3#python Python:
%pre
%code.python
= preserve do
:escaped
#import
from selenium import webdriver
from selenium.webdriver.common.touch_actions import TouchActions
# Gestures code
pages = driver.find_element_by_id("vp_pages")
touch_actions = TouchActions(driver)
touch_actions.flick_element(pages,0,-100,0).perform()
%h3#java Java:
%pre
%code.java
= preserve do
:escaped
#Please import: org.openqa.selenium.interactions.touch.TouchActions
WebElement pages = driver.findElement(By.id("vp_pages"));
TouchActions flick = new TouchActions(driver).flick(pages, -100, 0, 0);
flick.perform();