本文整理汇总了Java中org.openqa.selenium.ScreenOrientation类的典型用法代码示例。如果您正苦于以下问题:Java ScreenOrientation类的具体用法?Java ScreenOrientation怎么用?Java ScreenOrientation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ScreenOrientation类属于org.openqa.selenium包,在下文中一共展示了ScreenOrientation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
//Appium setup for the app
//needs to be installed on target device before the test
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appPackage", "jp.co.hit_point.nekoatsume");
capabilities.setCapability("appActivity", "jp.co.hit_point.nekoatsume.GActivity");
capabilities.setCapability("deviceName", "Android Emulator");
capabilities.setCapability("platformVersion", "5.0.1");
driver = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
wait = new WebDriverWait(driver, 10);
//Sikuli settings
OCR = new OCR(driver);
//location of screenshots
File classpathRoot = new File(System.getProperty("user.dir"));
imgDir = new File(classpathRoot, "src/main/resources");
//switch to native app + portrait mode
driver.context("NATIVE_APP");
driver.rotate(ScreenOrientation.PORTRAIT);
}
示例2: openLegalStuffFromPortraitAndLandscapeMode
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
/**
* Open all the legal stuff webiews
* @throws InterruptedException
*/
@Test(dataProvider="SearchProvider",dataProviderClass=DataproviderClass.class,groups="1driver_android")
public void openLegalStuffFromPortraitAndLandscapeMode(String items, String expectedTitle) throws InterruptedException{
RiotHomePageTabObjects homePage=new RiotHomePageTabObjects(appiumFactory.getAndroidDriver1());
appiumFactory.getAndroidDriver1().rotate(ScreenOrientation.PORTRAIT);
homePage.contextMenuButton.click();
homePage.getItemMenuByName(items).click();
RiotLegalStuffViewPageObject copyrightPolicyView= new RiotLegalStuffViewPageObject(appiumFactory.getAndroidDriver1());
Assert.assertTrue(copyrightPolicyView.isPresentTryAndCatch(), "Copyright Policy view isn't open");
Assert.assertEquals(copyrightPolicyView.secondTitle.getAttribute("name"), expectedTitle);
copyrightPolicyView.okButton.click();
//open it again and turn the device in landscape mode : the panel should be still displayed
homePage.contextMenuButton.click();Thread.sleep(1000);
homePage.openCopyrightButton.click();
copyrightPolicyView= new RiotLegalStuffViewPageObject(appiumFactory.getAndroidDriver1());
driver.rotate(ScreenOrientation.LANDSCAPE);
Thread.sleep(1500);
Assert.assertTrue(copyrightPolicyView.isPresentTryAndCatch(), items+" view isn't open");
//copyrightPolicyView.okButton.click();
driver.rotate(ScreenOrientation.PORTRAIT);
}
示例3: before
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
private void before() throws MalformedURLException {
String platform = System.getProperty(PLATFORM_KEY);
if (TextUtils.isEmpty(platform)) {
platform = PLATFORM_ANDROID;
//throw new IllegalArgumentException("Platform key (" + PLATFORM_KEY + ") was not set!");
}
URL remoteURL = new URL(remoteAddress);
switch (platform) {
case PLATFORM_ANDROID:
driver = AppiumAndroidDriver.create(remoteURL, fullReset);
break;
case PLATFORM_IOS:
driver = AppiumIOSDriver.create(remoteURL, fullReset);
break;
default:
throw new IllegalArgumentException("Unknown platform key :" + platform);
}
driver.rotate(ScreenOrientation.PORTRAIT);
decorator = new AppiumFieldDecorator(driver, timeOutDuration);
app = new FlashcardsApp(decorator);
}
示例4: getOrientation
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
@Override public ScreenOrientation getOrientation() {
Response response = execute(DriverCommand.GET_SCREEN_ORIENTATION);
String orientation = response.getValue().toString().toLowerCase();
if (orientation.equals(ScreenOrientation.LANDSCAPE.value())) {
return ScreenOrientation.LANDSCAPE;
} else if (orientation.equals(ScreenOrientation.PORTRAIT.value())) {
return ScreenOrientation.PORTRAIT;
} else {
throw new WebDriverException("Unexpected orientation returned: " + orientation);
}
}
示例5: beforeRotation
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
@Before(EXECUTION_ROTATE)
public void beforeRotation(JoinPoint joinPoint) throws Throwable {
try {
listener.beforeRotation(driver, (ScreenOrientation) castArgument(joinPoint, 0));
} catch (Throwable t) {
throw getRootCause(t);
}
}
示例6: afterRotation
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
@After(EXECUTION_ROTATE)
public void afterRotation(JoinPoint joinPoint) throws Throwable {
try {
listener.afterRotation(driver, (ScreenOrientation) castArgument(joinPoint, 0));
} catch (Throwable t) {
throw getRootCause(t);
}
}
示例7: switchOrientationMode
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
@Test(groups="1driver_android")
public void switchOrientationMode() throws InterruptedException{
appiumFactory.getAndroidDriver1().rotate(ScreenOrientation.LANDSCAPE);//Thread.sleep(2000);
(new WebDriverWait(appiumFactory.getAndroidDriver1(), 15)).until(ExpectedConditions.presenceOfElementLocated(By.className("android.widget.FrameLayout")));
scrollWindowDown();
appiumFactory.getAndroidDriver1().rotate(ScreenOrientation.PORTRAIT);//Thread.sleep(2000);
(new WebDriverWait(appiumFactory.getAndroidDriver1(), 15)).until(ExpectedConditions.presenceOfElementLocated(By.className("android.widget.FrameLayout")));
scrollWindowDown();
appiumFactory.getAndroidDriver1().rotate(ScreenOrientation.LANDSCAPE);//Thread.sleep(2000);
(new WebDriverWait(appiumFactory.getAndroidDriver1(), 15)).until(ExpectedConditions.presenceOfElementLocated(By.className("android.widget.FrameLayout")));
scrollWindowDown();
}
示例8: rotateSafely
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
public static void rotateSafely(AppiumDriver<?> driver, ScreenOrientation orientation) {
try {
driver.rotate(orientation);
} catch (Exception ignored) {
// For some reason, even though screen is rotated it's reported as error
}
}
示例9: setOrientationToLandscapeTest
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
@Test
public void setOrientationToLandscapeTest() {
wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.id("android:id/action_bar_title"))));
((AndroidDriver<WebElement>)driver).startActivity("io.appium.android.apis", ".app.ScreenOrientation");
setOrientation("LANDSCAPE");
ScreenOrientation currentOrientation = driver.getOrientation();
assertThat(currentOrientation, is(ScreenOrientation.LANDSCAPE));
}
示例10: setOrientationToPortraitTest
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
@Test
public void setOrientationToPortraitTest() {
wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.id("android:id/action_bar_title"))));
((AndroidDriver<WebElement>)driver).startActivity("io.appium.android.apis", ".app.ScreenOrientation");
setOrientation("PORTRAIT");
ScreenOrientation currentOrientation = driver.getOrientation();
assertThat(currentOrientation, is(ScreenOrientation.PORTRAIT));
}
示例11: rotate
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
@Override
@Monitor
@RetryFailure(retryCount=3)
public AppiumDriverController rotate(ScreenOrientation e) {
webDriver().rotate(e);
return this;
}
示例12: shouldRotate
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
@Test
public void shouldRotate() throws Exception {
openWebdriverTestPage(HtmlTestData.ABOUT_BLANK);
Assert.assertEquals(ScreenOrientation.PORTRAIT, driver().getOrientation());
driver().rotate(ScreenOrientation.LANDSCAPE);
Assert.assertEquals(ScreenOrientation.LANDSCAPE, driver().getOrientation());
driver().rotate(ScreenOrientation.PORTRAIT);
Assert.assertEquals(ScreenOrientation.PORTRAIT, driver().getOrientation());
}
示例13: getOrientation
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
@Override
public ScreenOrientation getOrientation() {
return ((Rotatable) super.getWrappedDriver()).getOrientation();
}
示例14: rotate
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
@Override
public void rotate(ScreenOrientation screenOrientation) {
((Rotatable) super.getWrappedDriver()).rotate(screenOrientation);
}
示例15: setParameters
import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
public void setParameters( Object[] parameterArray )
{
setOrientation( (ScreenOrientation) parameterArray[ 0 ] );
}