Android 中旋转屏幕,触摸,滚动

时间:2015-06-08 16:33:30   收藏:0   阅读:449

package com.learingselenium.android;

import junit.framework.TestCase

import org.openqa.selenium.Rotatable;

 import org.openqa.selenium.ScreenOrientation;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.android.AndroidDriver;

import org.openqa.selenium.interactions.touch.TouchActions;

...

WebDriver driver = new AndroidDriver("http://localhost:8888/wd/hub");

((Rotatable) driver).rotate(ScreenOrientation.LANDSCAPE);  //旋转屏幕

driver.get("http://1.com");

driver.close();

...

WebDriver driver = new AndroidDriver("http://localhost:8888/wd/hub");

driver.get("http://1.com");

((Rotatable) driver).rotate(ScreenOrientation.PORTRAIT); //确保屏幕方向为 PORTRAIT

//向下滚动400个像素偏移量

TouchActions touch = new TouchActions(driver);

touch.scroll(0, 400).build().perform();  

driver.close();

...

 

原文:http://www.cnblogs.com/feifeidxl/p/4560965.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!