Search in sources :

Example 11 with MobileElement

use of io.appium.java_client.MobileElement in project opentest by mcdcorp.

the class AssertElementEnabled method run.

@Override
public void run() {
    super.run();
    By locator = readLocatorArgument("locator");
    this.swipeAndCheckElementVisible(locator, this.getSwipeOptions());
    MobileElement element = getElement(locator);
    if (!element.isEnabled()) {
        throw new RuntimeException(String.format("Element %s was not enabled", locator));
    }
}
Also used : MobileElement(io.appium.java_client.MobileElement) By(org.openqa.selenium.By)

Example 12 with MobileElement

use of io.appium.java_client.MobileElement in project opentest by mcdcorp.

the class AssertElementNotEnabled method run.

@Override
public void run() {
    super.run();
    By locator = this.readLocatorArgument("locator");
    this.swipeAndCheckElementVisible(locator, this.getSwipeOptions());
    MobileElement element = this.getElement(locator);
    if (element.isEnabled()) {
        throw new RuntimeException(String.format("Element %s was enabled", locator));
    }
}
Also used : MobileElement(io.appium.java_client.MobileElement) By(org.openqa.selenium.By)

Example 13 with MobileElement

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

the class MobileElementState method focus.

/**
     * Moves the focus to the specified element. Currently issued with tap
     */
@PublicAtsApi
public void focus() {
    try {
        MobileElement mobileElement = (MobileElement) MobileElementFinder.findElement(appiumDriver, element);
        mobileElement.tap(1, 100);
    } catch (Exception se) {
        throw new MobileOperationException("Error trying to set the focus to " + getElementDescription(), se);
    }
}
Also used : MobileElement(io.appium.java_client.MobileElement) MobileOperationException(com.axway.ats.uiengine.exceptions.MobileOperationException) UnreachableBrowserException(org.openqa.selenium.remote.UnreachableBrowserException) MobileOperationException(com.axway.ats.uiengine.exceptions.MobileOperationException) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 14 with MobileElement

use of io.appium.java_client.MobileElement in project java-client by appium.

the class AndroidAbilityToUseSupplierTest method horizontalSwipingWithSupplier.

@Test
public void horizontalSwipingWithSupplier() {
    Activity activity = new Activity("io.appium.android.apis", ".view.Gallery1");
    driver.startActivity(activity);
    AndroidElement gallery = driver.findElementById("io.appium.android.apis:id/gallery");
    List<MobileElement> images = gallery.findElementsByClassName("android.widget.ImageView");
    int originalImageCount = images.size();
    horizontalSwipe.get().perform();
    assertNotEquals(originalImageCount, gallery.findElementsByClassName("android.widget.ImageView").size());
}
Also used : MobileElement(io.appium.java_client.MobileElement) Point(org.openqa.selenium.Point) Test(org.junit.Test)

Example 15 with MobileElement

use of io.appium.java_client.MobileElement in project java-client by appium.

the class AndroidElementTest method scrollingToSubElement.

@Test
public void scrollingToSubElement() {
    driver.findElementByAccessibilityId("Views").click();
    AndroidElement list = driver.findElement(By.id("android:id/list"));
    MobileElement radioGroup = list.findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(" + "new UiSelector().text(\"Radio Group\"));"));
    assertNotNull(radioGroup.getLocation());
}
Also used : MobileElement(io.appium.java_client.MobileElement) Test(org.junit.Test)

Aggregations

MobileElement (io.appium.java_client.MobileElement)27 Test (org.junit.Test)12 By (org.openqa.selenium.By)11 Point (org.openqa.selenium.Point)7 TouchAction (io.appium.java_client.TouchAction)6 Dimension (org.openqa.selenium.Dimension)6 MultiTouchAction (io.appium.java_client.MultiTouchAction)4 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)3 PublicAtsApi (com.axway.ats.common.PublicAtsApi)1 MobileOperationException (com.axway.ats.uiengine.exceptions.MobileOperationException)1 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)1 AndroidElement (io.appium.java_client.android.AndroidElement)1 IOSDriver (io.appium.java_client.ios.IOSDriver)1 ElementOption (io.appium.java_client.touch.offset.ElementOption)1 PointOption.point (io.appium.java_client.touch.offset.PointOption.point)1 Rectangle (java.awt.Rectangle)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 AppiumHelper.getCapabilityAsString (org.getopentest.appium.core.AppiumHelper.getCapabilityAsString)1 Config (org.getopentest.util.Config)1