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

com.seleniumtests.browserfactory.WindowsAppCapabilitiesFactory Maven / Gradle / Ivy

There is a newer version: 5.1.13
Show newest version
package com.seleniumtests.browserfactory;

import com.seleniumtests.customexception.ConfigurationException;
import com.seleniumtests.driver.DriverConfig;
import org.openqa.selenium.MutableCapabilities;

import java.util.Map;

public class WindowsAppCapabilitiesFactory extends ICapabilitiesFactory {

    public WindowsAppCapabilitiesFactory(DriverConfig webDriverConfig) {
        super(webDriverConfig);
    }

    @Override
    public MutableCapabilities createCapabilities() {
        MutableCapabilities capabilities = new MutableCapabilities((Map.of("platformName", "windows",
                "appium:automationName", "FlaUI")));

        // path to the app that will be started
        if (webDriverConfig.getApp() != null && !webDriverConfig.getApp().isEmpty()) {
            capabilities.setCapability("appium:app", webDriverConfig.getApp());

        // name of the application window
        } else if (webDriverConfig.getAppActivity() != null && !webDriverConfig.getAppActivity().isEmpty()) {
            capabilities.setCapability("appium:appTopLevelWindowTitleMatch", webDriverConfig.getAppActivity());
        } else {
            throw new ConfigurationException("Either 'app' or 'appActivity' must be provided");
        }

        return capabilities;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy