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

org.sitoolkit.wt.domain.operation.appium.StartAppOperation Maven / Gradle / Ivy

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

import org.sitoolkit.wt.domain.operation.selenium.OpenOperation;
import org.sitoolkit.wt.domain.operation.selenium.SeleniumOperationContext;
import org.sitoolkit.wt.domain.testscript.TestStep;
import org.springframework.stereotype.Component;

import io.appium.java_client.AppiumDriver;

@Component
public class StartAppOperation extends OpenOperation {

    @Override
    public void execute(TestStep testStep, SeleniumOperationContext ctx) {

        if (seleniumDriver instanceof AppiumDriver) {
            AppiumDriver appiumDriver = (AppiumDriver) seleniumDriver;
            for (String contextHandle : appiumDriver.getContextHandles()) {
                if (contextHandle.startsWith("WEBVIEW")) {
                    appiumDriver.context(contextHandle);
                }
            }
        } else {
            super.execute(testStep, ctx);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy