当前位置: 首页>>代码示例>>Java>>正文


Java ScreenOrientation类代码示例

本文整理汇总了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);
}
 
开发者ID:Simon-Kaz,项目名称:AppiumFindByImage,代码行数:26,代码来源:OCRNekoAtsumeTestSuite.java

示例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);
}
 
开发者ID:vector-im,项目名称:riot-automated-tests,代码行数:26,代码来源:RiotMiscTests.java

示例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);
}
 
开发者ID:TriangleLeft,项目名称:Flashcards,代码行数:22,代码来源:AppiumRule.java

示例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);
    }
}
 
开发者ID:JoeUtt,项目名称:menggeqa,代码行数:12,代码来源:AppiumDriver.java

示例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);
    }

}
 
开发者ID:JoeUtt,项目名称:menggeqa,代码行数:10,代码来源:DefaultAspect.java

示例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);
    }
}
 
开发者ID:JoeUtt,项目名称:menggeqa,代码行数:9,代码来源:DefaultAspect.java

示例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();
}
 
开发者ID:vector-im,项目名称:riot-automated-tests,代码行数:13,代码来源:RiotMiscTests.java

示例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
    }
}
 
开发者ID:TriangleLeft,项目名称:Flashcards,代码行数:8,代码来源:TestUtils.java

示例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));
}
 
开发者ID:Simon-Kaz,项目名称:AppiumSauce,代码行数:11,代码来源:NativeAndroidTest.java

示例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));
}
 
开发者ID:Simon-Kaz,项目名称:AppiumSauce,代码行数:10,代码来源:NativeAndroidTest.java

示例11: rotate

import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
@Override
@Monitor
@RetryFailure(retryCount=3)
public AppiumDriverController rotate(ScreenOrientation e) {
    webDriver().rotate(e);
    return this;
}
 
开发者ID:GiannisPapadakis,项目名称:seletest,代码行数:8,代码来源:AppiumDriverController.java

示例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());
}
 
开发者ID:selendroid,项目名称:selendroid,代码行数:10,代码来源:OrientationTest.java

示例13: getOrientation

import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
@Override
public ScreenOrientation getOrientation() {
  return ((Rotatable) super.getWrappedDriver()).getOrientation();
}
 
开发者ID:Cognifide,项目名称:bobcat,代码行数:5,代码来源:WebDriverWrapper.java

示例14: rotate

import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
@Override
public void rotate(ScreenOrientation screenOrientation) {
  ((Rotatable) super.getWrappedDriver()).rotate(screenOrientation);
}
 
开发者ID:Cognifide,项目名称:bobcat,代码行数:5,代码来源:WebDriverWrapper.java

示例15: setParameters

import org.openqa.selenium.ScreenOrientation; //导入依赖的package包/类
public void setParameters( Object[] parameterArray )
{
	setOrientation( (ScreenOrientation) parameterArray[ 0 ] );
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:5,代码来源:AbstractRotateGesture.java


注:本文中的org.openqa.selenium.ScreenOrientation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。