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

io.appium.java_client.flutter.options.SupportsFlutterElementWaitTimeoutOption Maven / Gradle / Ivy

The newest version!
package io.appium.java_client.flutter.options;

import io.appium.java_client.internal.CapabilityHelpers;
import io.appium.java_client.remote.options.BaseOptions;
import io.appium.java_client.remote.options.CanSetCapability;
import org.openqa.selenium.Capabilities;

import java.time.Duration;
import java.util.Optional;

public interface SupportsFlutterElementWaitTimeoutOption> extends
        Capabilities, CanSetCapability {
    String FLUTTER_ELEMENT_WAIT_TIMEOUT_OPTION = "flutterElementWaitTimeout";

    /**
     * Sets the Flutter element wait timeout.
     * Defaults to 5 seconds.
     *
     * @param timeout The duration to wait for Flutter elements during findElement method
     * @return self instance for chaining.
     */
    default T setFlutterElementWaitTimeout(Duration timeout) {
        return amend(FLUTTER_ELEMENT_WAIT_TIMEOUT_OPTION, timeout.toMillis());
    }

    /**
     * Retrieves the current Flutter element wait timeout if set.
     *
     * @return An {@link Optional} containing the duration of the Flutter element wait timeout, or empty if not set.
     */
    default Optional getFlutterElementWaitTimeout() {
        return Optional.ofNullable(
                CapabilityHelpers.toDuration(getCapability(FLUTTER_ELEMENT_WAIT_TIMEOUT_OPTION))
        );
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy