All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sitoolkit.wt.domain.evidence.appium.IOSHybridElementPositionStrategy Maven / Gradle / Ivy

There is a newer version: 2.3
Show newest version
package org.sitoolkit.wt.domain.evidence.appium;

import org.openqa.selenium.Point;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.sitoolkit.wt.domain.evidence.ElementPositionStrategy;
import org.sitoolkit.wt.domain.evidence.selenium.ElementPositionSupport2;

import io.appium.java_client.AppiumDriver;

public class IOSHybridElementPositionStrategy implements ElementPositionStrategy {

    @SuppressWarnings("unchecked")
    @Override
    public void init(ElementPositionSupport2 eps, WebDriver driver) {
        AppiumDriver appiumDriver = (AppiumDriver) driver;

        String context = appiumDriver.getContext();

        appiumDriver.context("NATIVE_APP");
        WebElement baseElement = appiumDriver.findElementByClassName("UIAWebView");
        eps.setBasePosition(baseElement.getLocation());

        appiumDriver.context(context);

    }

    @Override
    public Point getCurrentBasePosition(WebDriver driver, WebElement currentFrame) {
        return new Point(0, 0);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy