首页 > 移动平台 > 详细

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

时间:2015-06-08 16:33:30      阅读:449      评论:0      收藏:0      [点我收藏+]

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();

...

 

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!