Search in sources :

Example 1 with AndroidDriver

use of io.appium.java_client.android.AndroidDriver in project selenium-tests by Wikia.

the class AndroidBrowser method setOptions.

@Override
public void setOptions() {
    DesiredCapabilities destCaps = new DesiredCapabilities();
    destCaps.setCapability("deviceName", Configuration.getDeviceName());
    URL url = null;
    try {
        url = new URL("http://" + Configuration.getAppiumIp() + "/wd/hub");
    } catch (MalformedURLException e) {
        PageObjectLogging.log("getAndroindInstance", e, false);
    }
    mobileDriver = new AndroidDriver(url, destCaps);
}
Also used : MalformedURLException(java.net.MalformedURLException) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) AndroidDriver(io.appium.java_client.android.AndroidDriver) URL(java.net.URL)

Example 2 with AndroidDriver

use of io.appium.java_client.android.AndroidDriver in project ats-framework by Axway.

the class MobileCheckBox method unCheck.

/**
     * Uncheck the check box
     */
@Override
@PublicAtsApi
public void unCheck() {
    new MobileElementState(this).waitToBecomeExisting();
    try {
        WebElement checkboxElement = MobileElementFinder.findElement(appiumDriver, this);
        if (checkboxElement.isSelected()) {
            if (appiumDriver instanceof AndroidDriver) {
                // checkboxElement.click(); // throwing exception (on Android) with message: Element is not clickable at point (x,y). Other element would receive the click
                new Actions(appiumDriver).moveToElement(checkboxElement).click().perform();
            } else {
                checkboxElement.click();
            }
        }
    } catch (Exception se) {
        throw new MobileOperationException(this, "unCheck", se);
    }
    UiEngineUtilities.sleep();
}
Also used : Actions(org.openqa.selenium.interactions.Actions) MobileOperationException(com.axway.ats.uiengine.exceptions.MobileOperationException) AndroidDriver(io.appium.java_client.android.AndroidDriver) WebElement(org.openqa.selenium.WebElement) MobileOperationException(com.axway.ats.uiengine.exceptions.MobileOperationException) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) MobileElementState(com.axway.ats.uiengine.utilities.mobile.MobileElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 3 with AndroidDriver

use of io.appium.java_client.android.AndroidDriver in project android by owncloud.

the class Common method setUpCommonDriver.

protected AndroidDriver setUpCommonDriver() throws Exception {
    File rootPath = new File(System.getProperty("user.dir"));
    File appDir = new File(rootPath, "src/test/resources");
    File app = new File(appDir, "ownCloud.apk");
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("platformName", "Android");
    capabilities.setCapability("deviceName", "test");
    capabilities.setCapability("app", app.getAbsolutePath());
    capabilities.setCapability("appPackage", "com.owncloud.android");
    capabilities.setCapability("appActivity", ".ui.activity.FileDisplayActivity");
    capabilities.setCapability("appWaitActivity", ".authentication.AuthenticatorActivity");
    driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    driver.manage().timeouts().implicitlyWait(waitingTime, TimeUnit.SECONDS);
    wait = new WebDriverWait(driver, waitingTime, 50);
    return driver;
}
Also used : DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) AndroidDriver(io.appium.java_client.android.AndroidDriver) File(java.io.File) URL(java.net.URL)

Example 4 with AndroidDriver

use of io.appium.java_client.android.AndroidDriver in project ats-framework by Axway.

the class MobileCheckBox method check.

/**
     * Check the check box
     */
@Override
@PublicAtsApi
public void check() {
    new MobileElementState(this).waitToBecomeExisting();
    try {
        WebElement checkboxElement = MobileElementFinder.findElement(appiumDriver, this);
        if (!checkboxElement.isSelected()) {
            if (appiumDriver instanceof AndroidDriver) {
                // checkboxElement.click(); // throwing exception (on Android) with message: Element is not clickable at point (x,y). Other element would receive the click
                new Actions(appiumDriver).moveToElement(checkboxElement).click().perform();
            } else {
                checkboxElement.click();
            }
        }
    } catch (Exception se) {
        throw new MobileOperationException(this, "check", se);
    }
    UiEngineUtilities.sleep();
}
Also used : Actions(org.openqa.selenium.interactions.Actions) MobileOperationException(com.axway.ats.uiengine.exceptions.MobileOperationException) AndroidDriver(io.appium.java_client.android.AndroidDriver) WebElement(org.openqa.selenium.WebElement) MobileOperationException(com.axway.ats.uiengine.exceptions.MobileOperationException) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) MobileElementState(com.axway.ats.uiengine.utilities.mobile.MobileElementState) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

AndroidDriver (io.appium.java_client.android.AndroidDriver)4 PublicAtsApi (com.axway.ats.common.PublicAtsApi)2 MobileOperationException (com.axway.ats.uiengine.exceptions.MobileOperationException)2 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)2 MobileElementState (com.axway.ats.uiengine.utilities.mobile.MobileElementState)2 URL (java.net.URL)2 WebElement (org.openqa.selenium.WebElement)2 Actions (org.openqa.selenium.interactions.Actions)2 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)2 File (java.io.File)1 MalformedURLException (java.net.MalformedURLException)1 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)1