diff --git a/build.gradle b/build.gradle index db49632fd..9ebb33a3f 100644 --- a/build.gradle +++ b/build.gradle @@ -112,6 +112,7 @@ checkstyle { javadoc { options.addStringOption('encoding', 'UTF-8') + options.addBooleanOption('Xwerror', true) } ext.configureCommonPom = { MavenPom pom -> diff --git a/config/checkstyle/appium-style.xml b/config/checkstyle/appium-style.xml index 6521c6a64..412a72bc7 100755 --- a/config/checkstyle/appium-style.xml +++ b/config/checkstyle/appium-style.xml @@ -174,9 +174,7 @@ - - - + diff --git a/selenium-bridge/build.gradle b/selenium-bridge/build.gradle index 7744b920f..9ae7e9a08 100644 --- a/selenium-bridge/build.gradle +++ b/selenium-bridge/build.gradle @@ -58,6 +58,7 @@ checkstyle { javadoc { options.addStringOption('encoding', 'UTF-8') + options.addBooleanOption('Xwerror', true) } publishing { diff --git a/src/main/java/io/appium/java_client/AppiumBy.java b/src/main/java/io/appium/java_client/AppiumBy.java index a7547d85b..0874769ce 100644 --- a/src/main/java/io/appium/java_client/AppiumBy.java +++ b/src/main/java/io/appium/java_client/AppiumBy.java @@ -32,6 +32,9 @@ import static io.appium.java_client.internal.Strings.isNullOrEmpty; +/** + * The base class of the locator strategies supported by Appium. + */ @EqualsAndHashCode(callSuper = true) public abstract class AppiumBy extends By implements Remotable { @@ -39,6 +42,13 @@ public abstract class AppiumBy extends By implements Remotable { private final Parameters remoteParameters; private final String locatorName; + /** + * Creates a new locator. + * + * @param selector the name of the locator strategy + * @param locatorString the locator value; must not be empty + * @param locatorName the name of the factory method, used in the string representation + */ protected AppiumBy(String selector, String locatorString, String locatorName) { Preconditions.checkArgument(!isNullOrEmpty(locatorString), "Must supply a not empty locator value."); this.remoteParameters = new Parameters(selector, locatorString); @@ -304,87 +314,205 @@ public static FlutterBy flutterAncestor(final FlutterBy of, final FlutterBy matc return flutterAncestor(of, matching, false); } + /** + * Locates elements by their accessibility id. + */ public static class ByAccessibilityId extends AppiumBy implements Serializable { + /** + * Creates a new instance for the given accessibility id. + * + * @param accessibilityId the accessibility id + */ public ByAccessibilityId(String accessibilityId) { super("accessibility id", accessibilityId, "accessibilityId"); } } + /** + * Locates elements by an Espresso data matcher (Espresso driver only). + */ public static class ByAndroidDataMatcher extends AppiumBy implements Serializable { + /** + * Creates a new instance for the given locator. + * + * @param locatorString the locator string + */ protected ByAndroidDataMatcher(String locatorString) { super("-android datamatcher", locatorString, "androidDataMatcher"); } } + /** + * Locates elements by an Android UIAutomator expression. + */ public static class ByAndroidUIAutomator extends AppiumBy implements Serializable { + /** + * Creates a new instance for the given locator. + * + * @param uiautomatorText the UIAutomator expression + */ public ByAndroidUIAutomator(String uiautomatorText) { super("-android uiautomator", uiautomatorText, "androidUIAutomator"); } } + /** + * Locates elements by an Espresso view matcher (Espresso driver only). + */ public static class ByAndroidViewMatcher extends AppiumBy implements Serializable { + /** + * Creates a new instance for the given locator. + * + * @param locatorString the locator string + */ protected ByAndroidViewMatcher(String locatorString) { super("-android viewmatcher", locatorString, "androidViewMatcher"); } } + /** + * Locates elements by an Android view tag (Espresso driver only). + */ public static class ByAndroidViewTag extends AppiumBy implements Serializable { + /** + * Creates a new instance for the given tag. + * + * @param tag the view tag + */ public ByAndroidViewTag(String tag) { super("-android viewtag", tag, "androidViewTag"); } } + /** + * Locates elements by the id (the name on iOS, the resource id on Android). + */ public static class ById extends AppiumBy implements Serializable { + /** + * Creates a new instance for the given id. + * + * @param selector the element id + */ protected ById(String selector) { super("id", selector, "id"); } } + /** + * Locates elements by the name. + */ public static class ByName extends AppiumBy implements Serializable { + /** + * Creates a new instance for the given name. + * + * @param selector the element name + */ protected ByName(String selector) { super("name", selector, "name"); } } + /** + * Locates elements by the class name. + */ public static class ByClassName extends AppiumBy implements Serializable { + /** + * Creates a new instance for the given class name. + * + * @param selector the class name + */ protected ByClassName(String selector) { super("class name", selector, "className"); } } + /** + * Locates elements using a custom element finding plugin. + */ public static class ByCustom extends AppiumBy implements Serializable { + /** + * Creates a new instance for the given selector. + * + * @param selector the selector to pass to the plugin + */ protected ByCustom(String selector) { super("-custom", selector, "custom"); } } + /** + * Locates elements by an image template. + */ public static class ByImage extends AppiumBy implements Serializable { + /** + * Creates a new instance for the given template. + * + * @param b64Template the base64-encoded template image + */ protected ByImage(String b64Template) { super("-image", b64Template, "image"); } } + /** + * Locates elements by an iOS class chain (XCUITest driver only). + */ public static class ByIosClassChain extends AppiumBy implements Serializable { + /** + * Creates a new instance for the given locator. + * + * @param locatorString the locator string + */ protected ByIosClassChain(String locatorString) { super("-ios class chain", locatorString, "iOSClassChain"); } } + /** + * Locates elements by an iOS NSPredicate string (XCUITest driver only). + */ public static class ByIosNsPredicate extends AppiumBy implements Serializable { + /** + * Creates a new instance for the given locator. + * + * @param locatorString the locator string + */ protected ByIosNsPredicate(String locatorString) { super("-ios predicate string", locatorString, "iOSNsPredicate"); } } + /** + * The base class of the locator strategies of the Flutter integration driver. + */ public abstract static class FlutterBy extends AppiumBy { + /** + * Creates a new Flutter locator. + * + * @param selector the name of the locator strategy + * @param locatorString the locator value + * @param locatorName the name of the factory method, used in the string representation + */ protected FlutterBy(String selector, String locatorString, String locatorName) { super(selector, locatorString, locatorName); } } + /** + * The base class of the Flutter locators that combine two other Flutter locators. + */ public abstract static class FlutterByHierarchy extends FlutterBy { private static final Gson GSON = new Gson(); + /** + * Creates a new hierarchical Flutter locator. + * + * @param selector the name of the locator strategy + * @param of the base widget locator + * @param matching the related widget locator to match + * @param properties the additional locator parameters + * @param locatorName the name of the factory method, used in the string representation + */ protected FlutterByHierarchy( String selector, FlutterBy of, @@ -408,37 +536,88 @@ static String formatLocator(FlutterBy of, FlutterBy matching, Map the type of the input object + */ @NullMarked public class AppiumFluentWait extends FluentWait { @Nullable @@ -42,6 +47,9 @@ public class AppiumFluentWait extends FluentWait { private static final Duration DEFAULT_POLL_DELAY_DURATION = Duration.ZERO; private Duration pollDelay = DEFAULT_POLL_DELAY_DURATION; + /** + * The information about the current polling iteration. + */ public static class IterationInfo { /** * The current iteration number. @@ -117,30 +125,65 @@ public AppiumFluentWait withPollDelay(Duration pollDelay) { return this; } + /** + * Gets the clock. + * + * @return the clock used for the time measurements + */ protected Clock getClock() { return clock; } + /** + * Gets the timeout. + * + * @return the maximum time to wait for the condition + */ protected Duration getTimeout() { return timeout; } + /** + * Gets the polling interval. + * + * @return the default time between the condition checks + */ protected Duration getInterval() { return interval; } + /** + * Gets the sleeper. + * + * @return the sleeper used to pause between the condition checks + */ protected Sleeper getSleeper() { return sleeper; } + /** + * Gets the ignored exceptions. + * + * @return the exception types that are ignored while waiting + */ protected List> getIgnoredExceptions() { return ignoredExceptions; } + /** + * Gets the message supplier. + * + * @return the supplier of the timeout message + */ protected Supplier<@Nullable String> getMessageSupplier() { return messageSupplier; } + /** + * Gets the input. + * + * @return the input value the condition is applied to + */ protected T getInput() { return (T) input; } @@ -286,6 +329,12 @@ private void sleepInterruptibly(Duration duration) { } } + /** + * Rethrows the exception unless it is one of the ignored ones. + * + * @param e the exception to check + * @return the exception if it is ignored + */ protected Throwable propagateIfNotIgnored(Throwable e) { for (Class ignoredException : getIgnoredExceptions()) { if (ignoredException.isInstance(e)) { diff --git a/src/main/java/io/appium/java_client/CommandExecutionHelper.java b/src/main/java/io/appium/java_client/CommandExecutionHelper.java index e996a7e95..e6882d608 100644 --- a/src/main/java/io/appium/java_client/CommandExecutionHelper.java +++ b/src/main/java/io/appium/java_client/CommandExecutionHelper.java @@ -24,11 +24,22 @@ import static io.appium.java_client.remote.DriverCommand.EXECUTE_SCRIPT; +/** + * The helper that simplifies the execution of the Appium commands and extension scripts. + */ public final class CommandExecutionHelper { private CommandExecutionHelper() { } + /** + * Executes the given command and converts its result. + * + * @param the type of the returned value + * @param executesMethod the command executor + * @param keyValuePair the command name and its parameters + * @return the command result or null + */ @Nullable public static T execute( ExecutesMethod executesMethod, Map.Entry> keyValuePair @@ -36,6 +47,14 @@ public static T execute( return handleResponse(executesMethod.execute(keyValuePair.getKey(), keyValuePair.getValue())); } + /** + * Executes the given command without parameters and converts its result. + * + * @param the type of the returned value + * @param executesMethod the command executor + * @param command the command name + * @return the command result or null + */ @Nullable public static T execute(ExecutesMethod executesMethod, String command) { return handleResponse(executesMethod.execute(command)); @@ -47,6 +66,14 @@ private static T handleResponse(Response response) { return response == null ? null : (T) response.getValue(); } + /** + * Executes the given extension script without arguments. + * + * @param the type of the returned value + * @param executesMethod the command executor + * @param scriptName the extension script name + * @return the script execution result + */ @Nullable public static T executeScript(ExecutesMethod executesMethod, String scriptName) { return executeScript(executesMethod, scriptName, null); @@ -55,6 +82,7 @@ public static T executeScript(ExecutesMethod executesMethod, String scriptNa /** * Simplifies arguments preparation for the script execution command. * + * @param the type of the returned value * @param executesMethod Method executor instance. * @param scriptName Extension script name. * @param args Extension script arguments (if present). diff --git a/src/main/java/io/appium/java_client/ComparesImages.java b/src/main/java/io/appium/java_client/ComparesImages.java index 4f44d6e0a..aa25fa321 100644 --- a/src/main/java/io/appium/java_client/ComparesImages.java +++ b/src/main/java/io/appium/java_client/ComparesImages.java @@ -33,6 +33,9 @@ import static io.appium.java_client.MobileCommand.compareImagesCommand; +/** + * The interface for the drivers that can compare images and find image occurrences. + */ public interface ComparesImages extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/ErrorCodesMobile.java b/src/main/java/io/appium/java_client/ErrorCodesMobile.java index 02ba75aa6..a6c52e234 100644 --- a/src/main/java/io/appium/java_client/ErrorCodesMobile.java +++ b/src/main/java/io/appium/java_client/ErrorCodesMobile.java @@ -29,7 +29,13 @@ * @author jonahss@gmail.com (Jonah Stiennon) */ public class ErrorCodesMobile extends ErrorCodes { + /** + * Creates a new instance. + */ + public ErrorCodesMobile() { + } + /** The status code of the "no such context" error. */ public static final int NO_SUCH_CONTEXT = 35; private static Map statusToState = Map.of(NO_SUCH_CONTEXT, "No such context found"); diff --git a/src/main/java/io/appium/java_client/ExecuteCDPCommand.java b/src/main/java/io/appium/java_client/ExecuteCDPCommand.java index de423a399..bedd2aa7d 100644 --- a/src/main/java/io/appium/java_client/ExecuteCDPCommand.java +++ b/src/main/java/io/appium/java_client/ExecuteCDPCommand.java @@ -26,6 +26,9 @@ import static io.appium.java_client.MobileCommand.EXECUTE_GOOGLE_CDP_COMMAND; import static java.util.Objects.requireNonNull; +/** + * The interface for the drivers that can execute Chrome DevTools Protocol commands. + */ public interface ExecuteCDPCommand extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/ExecutesDriverScript.java b/src/main/java/io/appium/java_client/ExecutesDriverScript.java index 4fdee70be..323704f2c 100644 --- a/src/main/java/io/appium/java_client/ExecutesDriverScript.java +++ b/src/main/java/io/appium/java_client/ExecutesDriverScript.java @@ -27,6 +27,9 @@ import static io.appium.java_client.MobileCommand.EXECUTE_DRIVER_SCRIPT; import static java.util.Objects.requireNonNull; +/** + * The interface for the drivers that can execute driver scripts on the server side. + */ public interface ExecutesDriverScript extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/ExecutesMethod.java b/src/main/java/io/appium/java_client/ExecutesMethod.java index 54644c933..95558f3a4 100644 --- a/src/main/java/io/appium/java_client/ExecutesMethod.java +++ b/src/main/java/io/appium/java_client/ExecutesMethod.java @@ -20,6 +20,9 @@ import java.util.Map; +/** + * The interface for the objects that can execute Appium commands. + */ public interface ExecutesMethod { /** * Executes the given command and returns a response. diff --git a/src/main/java/io/appium/java_client/HasAppStrings.java b/src/main/java/io/appium/java_client/HasAppStrings.java index 3fe9c9879..3369604a3 100644 --- a/src/main/java/io/appium/java_client/HasAppStrings.java +++ b/src/main/java/io/appium/java_client/HasAppStrings.java @@ -18,6 +18,9 @@ import java.util.Map; +/** + * The interface for the drivers that can retrieve the localized strings of the app under test. + */ public interface HasAppStrings extends ExecutesMethod { /** * Get all defined Strings from an app for the default language. diff --git a/src/main/java/io/appium/java_client/HasBrowserCheck.java b/src/main/java/io/appium/java_client/HasBrowserCheck.java index 056e634d7..4467e74ad 100644 --- a/src/main/java/io/appium/java_client/HasBrowserCheck.java +++ b/src/main/java/io/appium/java_client/HasBrowserCheck.java @@ -10,7 +10,11 @@ import static java.util.Locale.ROOT; import static java.util.Objects.requireNonNull; +/** + * The interface for the drivers that can check whether they are in a web browser context. + */ public interface HasBrowserCheck extends ExecutesMethod, HasCapabilities { + /** The name of the native app context. */ String NATIVE_CONTEXT = "NATIVE_APP"; /** diff --git a/src/main/java/io/appium/java_client/HasDeviceTime.java b/src/main/java/io/appium/java_client/HasDeviceTime.java index e450f28f1..d19d08619 100644 --- a/src/main/java/io/appium/java_client/HasDeviceTime.java +++ b/src/main/java/io/appium/java_client/HasDeviceTime.java @@ -18,6 +18,9 @@ import java.util.Map; +/** + * The interface for the drivers that can retrieve the device date and time. + */ public interface HasDeviceTime extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/HasOnScreenKeyboard.java b/src/main/java/io/appium/java_client/HasOnScreenKeyboard.java index aeeb80054..517b1fd47 100644 --- a/src/main/java/io/appium/java_client/HasOnScreenKeyboard.java +++ b/src/main/java/io/appium/java_client/HasOnScreenKeyboard.java @@ -2,6 +2,9 @@ import static java.util.Objects.requireNonNull; +/** + * The interface for the drivers that can check whether the on-screen keyboard is displayed. + */ public interface HasOnScreenKeyboard extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/HasSettings.java b/src/main/java/io/appium/java_client/HasSettings.java index ea1e55298..cb5d0af3a 100644 --- a/src/main/java/io/appium/java_client/HasSettings.java +++ b/src/main/java/io/appium/java_client/HasSettings.java @@ -26,6 +26,9 @@ import static io.appium.java_client.MobileCommand.getSettingsCommand; import static io.appium.java_client.MobileCommand.setSettingsCommand; +/** + * The interface for the drivers that can read and change the Appium settings of the session. + */ public interface HasSettings extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/HidesKeyboard.java b/src/main/java/io/appium/java_client/HidesKeyboard.java index b53af5c9a..a861ac82c 100644 --- a/src/main/java/io/appium/java_client/HidesKeyboard.java +++ b/src/main/java/io/appium/java_client/HidesKeyboard.java @@ -16,6 +16,9 @@ package io.appium.java_client; +/** + * The interface for the drivers that can hide the on-screen keyboard. + */ public interface HidesKeyboard extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/HidesKeyboardWithKeyName.java b/src/main/java/io/appium/java_client/HidesKeyboardWithKeyName.java index b2c58bd93..f9ec983f2 100644 --- a/src/main/java/io/appium/java_client/HidesKeyboardWithKeyName.java +++ b/src/main/java/io/appium/java_client/HidesKeyboardWithKeyName.java @@ -19,6 +19,9 @@ import java.util.List; import java.util.Map; +/** + * The interface for the drivers that can hide the on-screen keyboard by pressing a named key. + */ public interface HidesKeyboardWithKeyName extends HidesKeyboard { /** diff --git a/src/main/java/io/appium/java_client/InteractsWithApps.java b/src/main/java/io/appium/java_client/InteractsWithApps.java index 79025d5a9..f026c2529 100644 --- a/src/main/java/io/appium/java_client/InteractsWithApps.java +++ b/src/main/java/io/appium/java_client/InteractsWithApps.java @@ -31,6 +31,9 @@ import static java.util.Objects.requireNonNull; import static java.util.Optional.ofNullable; +/** + * The interface for the drivers that can install, launch and manage the apps on the device. + */ @SuppressWarnings({"rawtypes", "unchecked"}) public interface InteractsWithApps extends ExecutesMethod { diff --git a/src/main/java/io/appium/java_client/LocksDevice.java b/src/main/java/io/appium/java_client/LocksDevice.java index 04f8aa89b..42db880de 100644 --- a/src/main/java/io/appium/java_client/LocksDevice.java +++ b/src/main/java/io/appium/java_client/LocksDevice.java @@ -21,6 +21,9 @@ import static java.util.Objects.requireNonNull; +/** + * The interface for the drivers that can lock and unlock the device. + */ public interface LocksDevice extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/LogsEvents.java b/src/main/java/io/appium/java_client/LogsEvents.java index bbf4e6ecd..7b3a89580 100644 --- a/src/main/java/io/appium/java_client/LogsEvents.java +++ b/src/main/java/io/appium/java_client/LogsEvents.java @@ -30,6 +30,9 @@ import static io.appium.java_client.MobileCommand.GET_EVENTS; import static io.appium.java_client.MobileCommand.LOG_EVENT; +/** + * The interface for the drivers that can log and retrieve the server events. + */ public interface LogsEvents extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/MobileCommand.java b/src/main/java/io/appium/java_client/MobileCommand.java index ff3cd76aa..f42accf9a 100644 --- a/src/main/java/io/appium/java_client/MobileCommand.java +++ b/src/main/java/io/appium/java_client/MobileCommand.java @@ -35,40 +35,70 @@ */ @SuppressWarnings({"checkstyle:HideUtilityClassConstructor", "checkstyle:ConstantName"}) public class MobileCommand { + /** + * Creates a new instance. + */ + public MobileCommand() { + } + + /** The command that gets the session details. */ @Deprecated protected static final String GET_SESSION; + /** The command that logs a custom event on the server. */ protected static final String LOG_EVENT; + /** The command that gets the server events. */ protected static final String GET_EVENTS; // The file transfer commands of the drivers that have no `mobile:` extensions for them, e.g. Windows + /** The command that pulls a file from the device. */ public static final String PULL_FILE; + /** The command that pulls a folder from the device. */ public static final String PULL_FOLDER; + /** The command that pushes a file to the device. */ public static final String PUSH_FILE; + /** The command that starts the screen recording. */ public static final String START_RECORDING_SCREEN; + /** The command that stops the screen recording. */ public static final String STOP_RECORDING_SCREEN; //Android + /** The command that gets the Appium settings. */ protected static final String GET_SETTINGS; + /** The command that changes the Appium settings. */ protected static final String SET_SETTINGS; + /** The command that compares images. */ protected static final String COMPARE_IMAGES; + /** The command that executes a driver script on the server side. */ protected static final String EXECUTE_DRIVER_SCRIPT; + /** The command that gets all the sessions. */ @Deprecated protected static final String GET_ALLSESSION; + /** The command that executes a Chrome DevTools Protocol command. */ protected static final String EXECUTE_GOOGLE_CDP_COMMAND; + /** The command that gets the screen orientation. */ public static final String GET_SCREEN_ORIENTATION = "getScreenOrientation"; + /** The command that sets the screen orientation. */ public static final String SET_SCREEN_ORIENTATION = "setScreenOrientation"; + /** The command that gets the screen rotation. */ public static final String GET_SCREEN_ROTATION = "getScreenRotation"; + /** The command that sets the screen rotation. */ public static final String SET_SCREEN_ROTATION = "setScreenRotation"; + /** The command that gets the available context handles. */ public static final String GET_CONTEXT_HANDLES = "getContextHandles"; + /** The command that gets the current context handle. */ public static final String GET_CURRENT_CONTEXT_HANDLE = "getCurrentContextHandle"; + /** The command that switches to the given context. */ public static final String SWITCH_TO_CONTEXT = "switchToContext"; + /** The command that gets the device location. */ public static final String GET_LOCATION = "getLocation"; + /** The command that sets the device location. */ public static final String SET_LOCATION = "setLocation"; + /** The repository of the Appium command definitions by the command name. */ public static final Map commandRepository; static { @@ -155,22 +185,52 @@ public static AppiumCommandInfo deleteC(String url) { return new AppiumCommandInfo(url, HttpMethod.DELETE); } + /** + * Creates the command that gets the Appium settings. + * + * @return key-value pairs + */ public static Map.Entry> getSettingsCommand() { return Map.entry(GET_SETTINGS, Map.of()); } + /** + * Creates the command that changes a single Appium setting. + * + * @param setting the setting name + * @param value the setting value + * @return key-value pairs + */ public static Map.Entry> setSettingsCommand(String setting, Object value) { return setSettingsCommand(Map.of(setting, value)); } + /** + * Creates the command that changes several Appium settings. + * + * @param settings the setting names mapped to their values + * @return key-value pairs + */ public static Map.Entry> setSettingsCommand(Map settings) { return Map.entry(SET_SETTINGS, Map.of("settings", settings)); } + /** + * Creates the command that starts the screen recording. + * + * @param opts the recording options + * @return key-value pairs + */ public static Map.Entry> startRecordingScreenCommand(BaseStartScreenRecordingOptions opts) { return Map.entry(START_RECORDING_SCREEN, Map.of("options", opts.build())); } + /** + * Creates the command that stops the screen recording. + * + * @param opts the recording options + * @return key-value pairs + */ public static Map.Entry> stopRecordingScreenCommand(BaseStopScreenRecordingOptions opts) { return Map.entry(STOP_RECORDING_SCREEN, Map.of("options", opts.build())); } diff --git a/src/main/java/io/appium/java_client/NoSuchContextException.java b/src/main/java/io/appium/java_client/NoSuchContextException.java index e59c06e89..21b2cfd6f 100644 --- a/src/main/java/io/appium/java_client/NoSuchContextException.java +++ b/src/main/java/io/appium/java_client/NoSuchContextException.java @@ -18,13 +18,27 @@ import org.openqa.selenium.NotFoundException; +/** + * Thrown when the requested context does not exist. + */ @SuppressWarnings("serial") public class NoSuchContextException extends NotFoundException { + /** + * Creates a new exception with the given reason. + * + * @param reason the reason of the failure + */ public NoSuchContextException(String reason) { super(reason); } + /** + * Creates a new exception with the given reason and cause. + * + * @param reason the reason of the failure + * @param cause the cause of the failure + */ public NoSuchContextException(String reason, Throwable cause) { super(reason, cause); } diff --git a/src/main/java/io/appium/java_client/PerformsActions.java b/src/main/java/io/appium/java_client/PerformsActions.java index 021425e6c..24594c745 100644 --- a/src/main/java/io/appium/java_client/PerformsActions.java +++ b/src/main/java/io/appium/java_client/PerformsActions.java @@ -16,7 +16,17 @@ package io.appium.java_client; +/** + * The interface for the objects that can perform the accumulated actions. + * + * @param the type of the implementing class, returned for chaining + */ public interface PerformsActions> { + /** + * Performs the accumulated actions. + * + * @return self instance for chaining + */ T perform(); } diff --git a/src/main/java/io/appium/java_client/PullsFiles.java b/src/main/java/io/appium/java_client/PullsFiles.java index 00552371d..295b423c1 100644 --- a/src/main/java/io/appium/java_client/PullsFiles.java +++ b/src/main/java/io/appium/java_client/PullsFiles.java @@ -22,6 +22,9 @@ import static java.util.Objects.requireNonNull; +/** + * The interface for the drivers that can pull files and folders from the device. + */ public interface PullsFiles extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/PushesFiles.java b/src/main/java/io/appium/java_client/PushesFiles.java index 49b1592cf..0fbff3aa0 100644 --- a/src/main/java/io/appium/java_client/PushesFiles.java +++ b/src/main/java/io/appium/java_client/PushesFiles.java @@ -23,6 +23,9 @@ import java.util.Base64; import java.util.Map; +/** + * The interface for the drivers that can push files to the device. + */ public interface PushesFiles extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/ScreenshotState.java b/src/main/java/io/appium/java_client/ScreenshotState.java index f51add334..349ea60c5 100644 --- a/src/main/java/io/appium/java_client/ScreenshotState.java +++ b/src/main/java/io/appium/java_client/ScreenshotState.java @@ -34,6 +34,9 @@ import static java.util.Objects.requireNonNull; import static java.util.Optional.ofNullable; +/** + * Verifies the similarity of the screenshots taken at different moments of time. + */ @Accessors(chain = true) public class ScreenshotState { private static final Duration DEFAULT_INTERVAL_MS = Duration.ofMillis(500); @@ -85,6 +88,12 @@ public ScreenshotState(ComparesImages comparator, Supplier stateP this.stateProvider = stateProvider; } + /** + * Creates a new instance without a screenshot provider. + * A custom initial state has to be set via {@link #remember(BufferedImage)}. + * + * @param comparator the image comparator + */ public ScreenshotState(ComparesImages comparator) { this(comparator, null); } @@ -114,6 +123,9 @@ public ScreenshotState remember(BufferedImage customInitialState) { return this; } + /** + * Thrown when the screenshots comparison fails. + */ public static class ScreenshotComparisonError extends RuntimeException { private static final long serialVersionUID = -7011854909939194466L; @@ -126,8 +138,12 @@ public static class ScreenshotComparisonError extends RuntimeException { } } + /** + * Thrown when the screenshots do not become similar within the given timeout. + */ public static class ScreenshotComparisonTimeout extends RuntimeException { private static final long serialVersionUID = 6336247721154252476L; + /** The similarity score of the last comparison. */ private final double currentScore; ScreenshotComparisonTimeout(String message, double currentScore) { @@ -135,6 +151,11 @@ public static class ScreenshotComparisonTimeout extends RuntimeException { this.currentScore = currentScore; } + /** + * Gets the similarity score of the last comparison. + * + * @return the similarity score + */ public double getCurrentScore() { return currentScore; } diff --git a/src/main/java/io/appium/java_client/Setting.java b/src/main/java/io/appium/java_client/Setting.java index cc1f44cd1..22200e415 100644 --- a/src/main/java/io/appium/java_client/Setting.java +++ b/src/main/java/io/appium/java_client/Setting.java @@ -25,38 +25,68 @@ public enum Setting { // Android + /** Whether to ignore the views that are not important for accessibility (Android). */ IGNORE_UNIMPORTANT_VIEWS("ignoreUnimportantViews"), + /** The time to wait for the app to become idle before an action (Android). */ WAIT_FOR_IDLE_TIMEOUT("waitForIdleTimeout"), + /** The time to wait for a selector to match an element (Android). */ WAIT_FOR_SELECTOR_TIMEOUT("waitForSelectorTimeout"), + /** The time to wait for the scroll action acknowledgment (Android). */ WAIT_SCROLL_ACKNOWLEDGMENT_TIMEOUT("scrollAcknowledgmentTimeout"), + /** The time to wait for the action acknowledgment (Android). */ WAIT_ACTION_ACKNOWLEDGMENT_TIMEOUT("actionAcknowledgmentTimeout"), + /** Whether invisible elements are included in the page source and lookups (Android). */ ALLOW_INVISIBLE_ELEMENTS("allowInvisibleElements"), + /** Whether to enable the notification (toast) listener (Android). */ ENABLE_NOTIFICATION_LISTENER("enableNotificationListener"), + /** Whether to normalize the tag names of the page source elements (Android). */ NORMALIZE_TAG_NAMES("normalizeTagNames"), + /** The delay between key injections while typing (Android). */ KEY_INJECTION_DELAY("keyInjectionDelay"), + /** Whether to shut down the server when the device power is disconnected (Android). */ SHUTDOWN_ON_POWER_DISCONNECT("shutdownOnPowerDisconnect"), + /** Whether to track the scroll events (Android). */ TRACK_SCROLL_EVENTS("trackScrollEvents"), // iOS + /** The quality of the screenshots in the MJPEG stream (iOS). */ MJPEG_SERVER_SCREENSHOT_QUALITY("mjpegServerScreenshotQuality"), + /** The frame rate of the MJPEG stream (iOS). */ MJPEG_SERVER_FRAMERATE("mjpegServerFramerate"), + /** The quality of the screenshots taken by the driver (iOS). */ SCREENSHOT_QUALITY("screenshotQuality"), + /** Whether web taps are converted into x/y taps (iOS). */ NATIVE_WEB_TAP("nativeWebTap"), + /** The scaling factor of the MJPEG stream screenshots (iOS). */ MJPEG_SCALING_FACTOR("mjpegScalingFactor"), + /** Whether to enable the keyboard autocorrection (iOS). */ KEYBOARD_AUTOCORRECTION("keyboardAutocorrection"), + /** Whether to enable the keyboard prediction (iOS). */ KEYBOARD_PREDICTION("keyboardPrediction"), + /** Whether to bind the elements by their index (iOS). */ BOUND_ELEMENTS_BY_INDEX("boundElementsByIndex"), // Android and iOS + /** Whether to return compact responses from the element lookups (Android and iOS). */ SHOULD_USE_COMPACT_RESPONSES("shouldUseCompactResponses"), + /** The element attributes included in the element lookup responses (Android and iOS). */ ELEMENT_RESPONSE_ATTRIBUTES("elementResponseAttributes"), // All platforms + /** The strategy used to tap the image elements. */ IMAGE_ELEMENT_TAP_STRATEGY("imageElementTapStrategy"), + /** The minimum similarity score of an image match. */ IMAGE_MATCH_THRESHOLD("imageMatchThreshold"), + /** Whether to fix the dimensions of the screenshot used for the image lookup. */ FIX_IMAGE_FIND_SCREENSHOT_DIMENSIONS("fixImageFindScreenshotDims"), + /** Whether to fix the size of the image template used for the image lookup. */ FIX_IMAGE_TEMPLATE_SIZE("fixImageTemplateSize"), + /** Whether to check the image elements for staleness. */ CHECK_IMAGE_ELEMENT_STALENESS("checkForImageElementStaleness"), + /** Whether to update the position of the image elements automatically. */ UPDATE_IMAGE_ELEMENT_POSITION("autoUpdateImageElementPosition"), + /** Whether to fix the scale of the image template. */ FIX_IMAGE_TEMPLATE_SCALE("fixImageTemplateScale"), + /** The default scale of the image template. */ DEFAULT_IMAGE_TEMPLATE_SCALE("defaultImageTemplateScale"), + /** Whether to return the matched image in the image lookup result. */ GET_MATCHED_IMAGE_RESULT("getMatchedImageResult"); private final String name; diff --git a/src/main/java/io/appium/java_client/android/AndroidBatteryInfo.java b/src/main/java/io/appium/java_client/android/AndroidBatteryInfo.java index 1c3ff2872..d0ee1158d 100644 --- a/src/main/java/io/appium/java_client/android/AndroidBatteryInfo.java +++ b/src/main/java/io/appium/java_client/android/AndroidBatteryInfo.java @@ -4,8 +4,14 @@ import java.util.Map; +/** Battery information of an Android device. */ public class AndroidBatteryInfo extends BatteryInfo { + /** + * Creates the battery info from the raw server response. + * + * @param input The raw battery info map. + */ public AndroidBatteryInfo(Map input) { super(input); } @@ -28,7 +34,17 @@ public BatteryState getState() { } } + /** Android battery charging state. */ public enum BatteryState { - UNKNOWN, CHARGING, DISCHARGING, NOT_CHARGING, FULL + /** The state is not known. */ + UNKNOWN, + /** The battery is charging. */ + CHARGING, + /** The battery is discharging. */ + DISCHARGING, + /** The device is plugged in, but the battery is not charging. */ + NOT_CHARGING, + /** The battery is fully charged. */ + FULL } } diff --git a/src/main/java/io/appium/java_client/android/AndroidStartScreenRecordingOptions.java b/src/main/java/io/appium/java_client/android/AndroidStartScreenRecordingOptions.java index dd6ee2b2f..8a2fad5b1 100644 --- a/src/main/java/io/appium/java_client/android/AndroidStartScreenRecordingOptions.java +++ b/src/main/java/io/appium/java_client/android/AndroidStartScreenRecordingOptions.java @@ -26,12 +26,24 @@ import static java.util.Optional.ofNullable; +/** Android-specific options for starting a screen recording. */ public class AndroidStartScreenRecordingOptions extends BaseStartScreenRecordingOptions { + /** + * Creates a new instance. + */ + public AndroidStartScreenRecordingOptions() { + } + private Integer bitRate; private String videoSize; private Boolean isBugReportEnabled; + /** + * Creates a new options instance. + * + * @return a new {@link AndroidStartScreenRecordingOptions} instance. + */ public static AndroidStartScreenRecordingOptions startScreenRecordingOptions() { return new AndroidStartScreenRecordingOptions(); } diff --git a/src/main/java/io/appium/java_client/android/AndroidStopScreenRecordingOptions.java b/src/main/java/io/appium/java_client/android/AndroidStopScreenRecordingOptions.java index 83b7ead33..b7f8f8287 100644 --- a/src/main/java/io/appium/java_client/android/AndroidStopScreenRecordingOptions.java +++ b/src/main/java/io/appium/java_client/android/AndroidStopScreenRecordingOptions.java @@ -18,9 +18,20 @@ import io.appium.java_client.screenrecording.BaseStopScreenRecordingOptions; +/** Android-specific options for stopping a screen recording. */ public class AndroidStopScreenRecordingOptions extends BaseStopScreenRecordingOptions { + /** + * Creates a new instance. + */ + public AndroidStopScreenRecordingOptions() { + } + /** + * Creates a new options instance. + * + * @return a new {@link AndroidStopScreenRecordingOptions} instance. + */ public static AndroidStopScreenRecordingOptions stopScreenRecordingOptions() { return new AndroidStopScreenRecordingOptions(); } diff --git a/src/main/java/io/appium/java_client/android/AuthenticatesByFinger.java b/src/main/java/io/appium/java_client/android/AuthenticatesByFinger.java index ac2209a13..c44828b15 100644 --- a/src/main/java/io/appium/java_client/android/AuthenticatesByFinger.java +++ b/src/main/java/io/appium/java_client/android/AuthenticatesByFinger.java @@ -5,6 +5,7 @@ import java.util.Map; +/** Provides fingerprint authentication on Android emulators. */ public interface AuthenticatesByFinger extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/android/CanReplaceElementValue.java b/src/main/java/io/appium/java_client/android/CanReplaceElementValue.java index 632a8e511..623058c4e 100644 --- a/src/main/java/io/appium/java_client/android/CanReplaceElementValue.java +++ b/src/main/java/io/appium/java_client/android/CanReplaceElementValue.java @@ -6,6 +6,7 @@ import java.util.Map; +/** Provides replacing of the whole value of an element. */ public interface CanReplaceElementValue extends ExecutesMethod { /** * Sends a text to the given element by replacing its previous content. diff --git a/src/main/java/io/appium/java_client/android/GsmCallActions.java b/src/main/java/io/appium/java_client/android/GsmCallActions.java index 443d85a09..ef411c9a5 100644 --- a/src/main/java/io/appium/java_client/android/GsmCallActions.java +++ b/src/main/java/io/appium/java_client/android/GsmCallActions.java @@ -1,5 +1,13 @@ package io.appium.java_client.android; +/** Actions that can be performed on an emulated GSM call. */ public enum GsmCallActions { - CALL, ACCEPT, CANCEL, HOLD + /** Initiates a call. */ + CALL, + /** Accepts an incoming call. */ + ACCEPT, + /** Cancels the call. */ + CANCEL, + /** Puts the call on hold. */ + HOLD } diff --git a/src/main/java/io/appium/java_client/android/GsmSignalStrength.java b/src/main/java/io/appium/java_client/android/GsmSignalStrength.java index a73513df2..217fc26c8 100644 --- a/src/main/java/io/appium/java_client/android/GsmSignalStrength.java +++ b/src/main/java/io/appium/java_client/android/GsmSignalStrength.java @@ -1,5 +1,15 @@ package io.appium.java_client.android; +/** Emulated GSM signal strength levels. */ public enum GsmSignalStrength { - NONE_OR_UNKNOWN, POOR, MODERATE, GOOD, GREAT + /** No signal or unknown strength. */ + NONE_OR_UNKNOWN, + /** Poor signal. */ + POOR, + /** Moderate signal. */ + MODERATE, + /** Good signal. */ + GOOD, + /** Great signal. */ + GREAT } diff --git a/src/main/java/io/appium/java_client/android/GsmVoiceState.java b/src/main/java/io/appium/java_client/android/GsmVoiceState.java index e92cde951..93396b92d 100644 --- a/src/main/java/io/appium/java_client/android/GsmVoiceState.java +++ b/src/main/java/io/appium/java_client/android/GsmVoiceState.java @@ -1,5 +1,19 @@ package io.appium.java_client.android; +/** Emulated GSM voice registration states. */ public enum GsmVoiceState { - ON, OFF, DENIED, SEARCHING, ROAMING, HOME, UNREGISTERED + /** Voice service is on. */ + ON, + /** Voice service is off. */ + OFF, + /** Registration is denied. */ + DENIED, + /** The device is searching for a network. */ + SEARCHING, + /** The device is roaming. */ + ROAMING, + /** The device is on its home network. */ + HOME, + /** The device is not registered. */ + UNREGISTERED } diff --git a/src/main/java/io/appium/java_client/android/HasAndroidClipboard.java b/src/main/java/io/appium/java_client/android/HasAndroidClipboard.java index 5f173c120..ccd8e641f 100644 --- a/src/main/java/io/appium/java_client/android/HasAndroidClipboard.java +++ b/src/main/java/io/appium/java_client/android/HasAndroidClipboard.java @@ -27,6 +27,7 @@ import static java.util.Locale.ROOT; import static java.util.Objects.requireNonNull; +/** Provides access to the clipboard of an Android device. */ public interface HasAndroidClipboard extends HasClipboard { /** * Set the content of device's clipboard. diff --git a/src/main/java/io/appium/java_client/android/HasAndroidDeviceDetails.java b/src/main/java/io/appium/java_client/android/HasAndroidDeviceDetails.java index 76c596b1a..dbb659883 100644 --- a/src/main/java/io/appium/java_client/android/HasAndroidDeviceDetails.java +++ b/src/main/java/io/appium/java_client/android/HasAndroidDeviceDetails.java @@ -5,6 +5,7 @@ import java.util.Map; +/** Provides Android device details, such as the display density and system bars. */ public interface HasAndroidDeviceDetails extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/android/HasAndroidSettings.java b/src/main/java/io/appium/java_client/android/HasAndroidSettings.java index 73900e050..d31e19f3d 100644 --- a/src/main/java/io/appium/java_client/android/HasAndroidSettings.java +++ b/src/main/java/io/appium/java_client/android/HasAndroidSettings.java @@ -21,6 +21,7 @@ import java.time.Duration; +/** Provides Android-specific driver settings. */ public interface HasAndroidSettings extends HasSettings { /** * Set the `ignoreUnimportantViews` setting. *Android-only method*. diff --git a/src/main/java/io/appium/java_client/android/HasNotifications.java b/src/main/java/io/appium/java_client/android/HasNotifications.java index 0911095be..f6220e5bb 100644 --- a/src/main/java/io/appium/java_client/android/HasNotifications.java +++ b/src/main/java/io/appium/java_client/android/HasNotifications.java @@ -3,6 +3,7 @@ import io.appium.java_client.CommandExecutionHelper; import io.appium.java_client.ExecutesMethod; +/** Provides access to the Android notifications drawer. */ public interface HasNotifications extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/android/HasSupportedPerformanceDataType.java b/src/main/java/io/appium/java_client/android/HasSupportedPerformanceDataType.java index bca5a4e29..a9f34e8ae 100644 --- a/src/main/java/io/appium/java_client/android/HasSupportedPerformanceDataType.java +++ b/src/main/java/io/appium/java_client/android/HasSupportedPerformanceDataType.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; +/** Provides Android performance data retrieval. */ public interface HasSupportedPerformanceDataType extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/android/ListensToLogcatMessages.java b/src/main/java/io/appium/java_client/android/ListensToLogcatMessages.java index 22df8951e..d3fcb5c7c 100644 --- a/src/main/java/io/appium/java_client/android/ListensToLogcatMessages.java +++ b/src/main/java/io/appium/java_client/android/ListensToLogcatMessages.java @@ -29,7 +29,13 @@ import static io.appium.java_client.service.local.AppiumServiceBuilder.DEFAULT_APPIUM_PORT; +/** Provides listening to logcat messages broadcast via web socket. */ public interface ListensToLogcatMessages extends ExecutesMethod { + /** + * Gets the web socket client used for receiving logcat messages. + * + * @return the logcat web socket client. + */ StringWebSocketClient getLogcatClient(); /** diff --git a/src/main/java/io/appium/java_client/android/NetworkSpeed.java b/src/main/java/io/appium/java_client/android/NetworkSpeed.java index 64cdc513d..794b81df7 100644 --- a/src/main/java/io/appium/java_client/android/NetworkSpeed.java +++ b/src/main/java/io/appium/java_client/android/NetworkSpeed.java @@ -1,5 +1,23 @@ package io.appium.java_client.android; +/** Emulated network speed profiles. */ public enum NetworkSpeed { - GSM, SCSD, GPRS, EDGE, UMTS, HSDPA, LTE, EVDO, FULL + /** GSM/CSD (up: 14.4, down: 14.4 kbps). */ + GSM, + /** HSCSD (up: 14.4, down: 43.2 kbps). */ + SCSD, + /** GPRS (up: 28.8, down: 57.6 kbps). */ + GPRS, + /** EDGE/EGPRS (up: 473.6, down: 473.6 kbps). */ + EDGE, + /** UMTS/3G (up: 384.0, down: 384.0 kbps). */ + UMTS, + /** HSDPA (up: 5760.0, down: 13,980.0 kbps). */ + HSDPA, + /** LTE (up: 58,000, down: 173,000 kbps). */ + LTE, + /** EVDO (up: 75,000, down: 280,000 kbps). */ + EVDO, + /** No limit, the default. */ + FULL } diff --git a/src/main/java/io/appium/java_client/android/PowerACState.java b/src/main/java/io/appium/java_client/android/PowerACState.java index ab845c925..0b53a5998 100644 --- a/src/main/java/io/appium/java_client/android/PowerACState.java +++ b/src/main/java/io/appium/java_client/android/PowerACState.java @@ -1,5 +1,9 @@ package io.appium.java_client.android; +/** Emulated AC power state. */ public enum PowerACState { - ON, OFF + /** AC power is connected. */ + ON, + /** AC power is disconnected. */ + OFF } diff --git a/src/main/java/io/appium/java_client/android/StartsActivity.java b/src/main/java/io/appium/java_client/android/StartsActivity.java index a49441b94..f40a7e54b 100644 --- a/src/main/java/io/appium/java_client/android/StartsActivity.java +++ b/src/main/java/io/appium/java_client/android/StartsActivity.java @@ -20,6 +20,7 @@ import io.appium.java_client.ExecutesMethod; import org.jspecify.annotations.Nullable; +/** Provides information about the current activity and package. */ public interface StartsActivity extends ExecutesMethod { /** * Get the current activity being run on the mobile device. diff --git a/src/main/java/io/appium/java_client/android/SupportsGpsStateManagement.java b/src/main/java/io/appium/java_client/android/SupportsGpsStateManagement.java index c300bc0a2..1c32bdd19 100644 --- a/src/main/java/io/appium/java_client/android/SupportsGpsStateManagement.java +++ b/src/main/java/io/appium/java_client/android/SupportsGpsStateManagement.java @@ -5,6 +5,7 @@ import static java.util.Objects.requireNonNull; +/** Provides GPS service state management. */ public interface SupportsGpsStateManagement extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/android/SupportsNetworkStateManagement.java b/src/main/java/io/appium/java_client/android/SupportsNetworkStateManagement.java index 86c4b4a7f..2faf5a82c 100644 --- a/src/main/java/io/appium/java_client/android/SupportsNetworkStateManagement.java +++ b/src/main/java/io/appium/java_client/android/SupportsNetworkStateManagement.java @@ -7,6 +7,7 @@ import static java.util.Objects.requireNonNull; +/** Provides network state management: Wi-Fi, airplane mode and mobile data. */ public interface SupportsNetworkStateManagement extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/android/SupportsSpecialEmulatorCommands.java b/src/main/java/io/appium/java_client/android/SupportsSpecialEmulatorCommands.java index e678fedd9..f62447623 100644 --- a/src/main/java/io/appium/java_client/android/SupportsSpecialEmulatorCommands.java +++ b/src/main/java/io/appium/java_client/android/SupportsSpecialEmulatorCommands.java @@ -7,6 +7,7 @@ import static java.util.Locale.ROOT; +/** Provides special Android emulator commands, such as SMS and GSM events. */ public interface SupportsSpecialEmulatorCommands extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/android/appmanagement/AndroidInstallApplicationOptions.java b/src/main/java/io/appium/java_client/android/appmanagement/AndroidInstallApplicationOptions.java index 360ee8395..127d863a4 100644 --- a/src/main/java/io/appium/java_client/android/appmanagement/AndroidInstallApplicationOptions.java +++ b/src/main/java/io/appium/java_client/android/appmanagement/AndroidInstallApplicationOptions.java @@ -27,8 +27,15 @@ import static java.util.Objects.requireNonNull; import static java.util.Optional.ofNullable; +/** Android-specific options for installing an application. */ public class AndroidInstallApplicationOptions extends BaseInstallApplicationOptions { + /** + * Creates a new instance. + */ + public AndroidInstallApplicationOptions() { + } + private Boolean replace; private Duration timeout; private Boolean allowTestPackages; diff --git a/src/main/java/io/appium/java_client/android/appmanagement/AndroidRemoveApplicationOptions.java b/src/main/java/io/appium/java_client/android/appmanagement/AndroidRemoveApplicationOptions.java index fe1cd3032..dba174f43 100644 --- a/src/main/java/io/appium/java_client/android/appmanagement/AndroidRemoveApplicationOptions.java +++ b/src/main/java/io/appium/java_client/android/appmanagement/AndroidRemoveApplicationOptions.java @@ -27,8 +27,15 @@ import static java.util.Objects.requireNonNull; import static java.util.Optional.ofNullable; +/** Android-specific options for removing an application. */ public class AndroidRemoveApplicationOptions extends BaseRemoveApplicationOptions { + /** + * Creates a new instance. + */ + public AndroidRemoveApplicationOptions() { + } + private Duration timeout; private Boolean keepData; diff --git a/src/main/java/io/appium/java_client/android/appmanagement/AndroidTerminateApplicationOptions.java b/src/main/java/io/appium/java_client/android/appmanagement/AndroidTerminateApplicationOptions.java index b4e8efaf6..c2624d219 100644 --- a/src/main/java/io/appium/java_client/android/appmanagement/AndroidTerminateApplicationOptions.java +++ b/src/main/java/io/appium/java_client/android/appmanagement/AndroidTerminateApplicationOptions.java @@ -27,8 +27,15 @@ import static java.util.Objects.requireNonNull; import static java.util.Optional.ofNullable; +/** Android-specific options for terminating an application. */ public class AndroidTerminateApplicationOptions extends BaseTerminateApplicationOptions { + /** + * Creates a new instance. + */ + public AndroidTerminateApplicationOptions() { + } + private Duration timeout; /** diff --git a/src/main/java/io/appium/java_client/android/connection/ConnectionState.java b/src/main/java/io/appium/java_client/android/connection/ConnectionState.java index 7b0134de6..2c8e0d9a3 100644 --- a/src/main/java/io/appium/java_client/android/connection/ConnectionState.java +++ b/src/main/java/io/appium/java_client/android/connection/ConnectionState.java @@ -16,17 +16,31 @@ package io.appium.java_client.android.connection; +/** Network connection state of an Android device, represented as a bit mask. */ public class ConnectionState { + /** Bit mask of the airplane mode flag. */ public static final long AIRPLANE_MODE_MASK = 0b001; + /** Bit mask of the Wi-Fi flag. */ public static final long WIFI_MASK = 0b010; + /** Bit mask of the mobile data flag. */ public static final long DATA_MASK = 0b100; private final long bitMask; + /** + * Gets the raw connection state bit mask. + * + * @return the bit mask combining the airplane mode, Wi-Fi and data flags. + */ public long getBitMask() { return bitMask; } + /** + * Creates a connection state from the given bit mask. + * + * @param bitMask the bit mask combining the airplane mode, Wi-Fi and data flags. + */ public ConnectionState(long bitMask) { this.bitMask = bitMask; } diff --git a/src/main/java/io/appium/java_client/android/connection/ConnectionStateBuilder.java b/src/main/java/io/appium/java_client/android/connection/ConnectionStateBuilder.java index 66bbed50e..66013d5f8 100644 --- a/src/main/java/io/appium/java_client/android/connection/ConnectionStateBuilder.java +++ b/src/main/java/io/appium/java_client/android/connection/ConnectionStateBuilder.java @@ -20,6 +20,9 @@ import static io.appium.java_client.android.connection.ConnectionState.DATA_MASK; import static io.appium.java_client.android.connection.ConnectionState.WIFI_MASK; +/** + * Builds {@link ConnectionState} instances. + */ public class ConnectionStateBuilder { private long bitMask; diff --git a/src/main/java/io/appium/java_client/android/connection/HasNetworkConnection.java b/src/main/java/io/appium/java_client/android/connection/HasNetworkConnection.java index b34c69af6..1e8ba165e 100644 --- a/src/main/java/io/appium/java_client/android/connection/HasNetworkConnection.java +++ b/src/main/java/io/appium/java_client/android/connection/HasNetworkConnection.java @@ -23,6 +23,7 @@ import static java.util.Objects.requireNonNull; +/** Provides network connection state management of an Android device. */ public interface HasNetworkConnection extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/android/geolocation/AndroidGeoLocation.java b/src/main/java/io/appium/java_client/android/geolocation/AndroidGeoLocation.java index 37d878642..e23e6779f 100644 --- a/src/main/java/io/appium/java_client/android/geolocation/AndroidGeoLocation.java +++ b/src/main/java/io/appium/java_client/android/geolocation/AndroidGeoLocation.java @@ -22,6 +22,7 @@ import static java.util.Optional.ofNullable; +/** Geo location with the extended parameters available on Android. */ public class AndroidGeoLocation { private Double longitude; private Double latitude; diff --git a/src/main/java/io/appium/java_client/android/geolocation/SupportsExtendedGeolocationCommands.java b/src/main/java/io/appium/java_client/android/geolocation/SupportsExtendedGeolocationCommands.java index 0472a5bab..35f1315ed 100644 --- a/src/main/java/io/appium/java_client/android/geolocation/SupportsExtendedGeolocationCommands.java +++ b/src/main/java/io/appium/java_client/android/geolocation/SupportsExtendedGeolocationCommands.java @@ -22,6 +22,7 @@ import java.util.Map; +/** Provides setting of the geo location with the extended Android parameters. */ public interface SupportsExtendedGeolocationCommands extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/android/nativekey/AndroidKey.java b/src/main/java/io/appium/java_client/android/nativekey/AndroidKey.java index 4138ea69f..8ec8b8a6e 100644 --- a/src/main/java/io/appium/java_client/android/nativekey/AndroidKey.java +++ b/src/main/java/io/appium/java_client/android/nativekey/AndroidKey.java @@ -1,5 +1,6 @@ package io.appium.java_client.android.nativekey; +/** Android native key codes. */ public enum AndroidKey { /** * Key code constant: Unknown key code. @@ -1285,6 +1286,11 @@ public enum AndroidKey { this.code = code; } + /** + * Gets the native Android key code. + * + * @return the integer key code. + */ public int getCode() { return code; } diff --git a/src/main/java/io/appium/java_client/android/nativekey/KeyEvent.java b/src/main/java/io/appium/java_client/android/nativekey/KeyEvent.java index 984c34cbf..b0dcbfb47 100644 --- a/src/main/java/io/appium/java_client/android/nativekey/KeyEvent.java +++ b/src/main/java/io/appium/java_client/android/nativekey/KeyEvent.java @@ -22,14 +22,21 @@ import static java.util.Optional.ofNullable; +/** Describes a native Android key event. */ public class KeyEvent { private Integer keyCode; private Integer metaState; private Integer flags; + /** Creates an empty key event. The key must be set before sending it. */ public KeyEvent() { } + /** + * Creates a key event for the given key. + * + * @param key Native Android key. + */ public KeyEvent(AndroidKey key) { this.keyCode = key.getCode(); } diff --git a/src/main/java/io/appium/java_client/android/nativekey/KeyEventFlag.java b/src/main/java/io/appium/java_client/android/nativekey/KeyEventFlag.java index 787264916..e39ed230f 100644 --- a/src/main/java/io/appium/java_client/android/nativekey/KeyEventFlag.java +++ b/src/main/java/io/appium/java_client/android/nativekey/KeyEventFlag.java @@ -1,5 +1,6 @@ package io.appium.java_client.android.nativekey; +/** Native Android key event flags. */ public enum KeyEventFlag { /** * This mask is set if the key event was generated by a software keyboard. @@ -88,6 +89,11 @@ public enum KeyEventFlag { this.value = value; } + /** + * Gets the native flag value. + * + * @return the integer flag value. + */ public int getValue() { return value; } diff --git a/src/main/java/io/appium/java_client/android/nativekey/KeyEventMetaModifier.java b/src/main/java/io/appium/java_client/android/nativekey/KeyEventMetaModifier.java index b32de52bc..96779cd16 100644 --- a/src/main/java/io/appium/java_client/android/nativekey/KeyEventMetaModifier.java +++ b/src/main/java/io/appium/java_client/android/nativekey/KeyEventMetaModifier.java @@ -1,5 +1,6 @@ package io.appium.java_client.android.nativekey; +/** Native Android key event meta modifiers. */ public enum KeyEventMetaModifier { /** * SHIFT key locked in CAPS mode. @@ -151,6 +152,11 @@ public enum KeyEventMetaModifier { this.value = value; } + /** + * Gets the native modifier value. + * + * @return the integer modifier value. + */ public int getValue() { return value; } diff --git a/src/main/java/io/appium/java_client/android/nativekey/PressesKey.java b/src/main/java/io/appium/java_client/android/nativekey/PressesKey.java index fb87a22e9..0da4b89fa 100644 --- a/src/main/java/io/appium/java_client/android/nativekey/PressesKey.java +++ b/src/main/java/io/appium/java_client/android/nativekey/PressesKey.java @@ -21,6 +21,7 @@ import java.util.HashMap; +/** Provides sending of native key events to an Android device. */ public interface PressesKey extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/android/options/EspressoOptions.java b/src/main/java/io/appium/java_client/android/options/EspressoOptions.java index da14a620e..86a8a6955 100644 --- a/src/main/java/io/appium/java_client/android/options/EspressoOptions.java +++ b/src/main/java/io/appium/java_client/android/options/EspressoOptions.java @@ -195,15 +195,30 @@ public class EspressoOptions extends BaseOptions implements // Other options: https://github.com/appium/appium-uiautomator2-driver#other SupportsDisableSuppressAccessibilityServiceOption, SupportsSkipLogCaptureOption { + /** + * Creates options with the default platform and automation names set. + */ public EspressoOptions() { setCommonOptions(); } + /** + * Creates options with the default platform and automation names set, + * and copies the capabilities from the given source. + * + * @param source Capabilities to copy. + */ public EspressoOptions(Capabilities source) { super(source); setCommonOptions(); } + /** + * Creates options with the default platform and automation names set, + * and copies the capabilities from the given map. + * + * @param source Capabilities map to copy. + */ public EspressoOptions(Map source) { super(source); setCommonOptions(); diff --git a/src/main/java/io/appium/java_client/android/options/UiAutomator2Options.java b/src/main/java/io/appium/java_client/android/options/UiAutomator2Options.java index 77115496f..9ed02775b 100644 --- a/src/main/java/io/appium/java_client/android/options/UiAutomator2Options.java +++ b/src/main/java/io/appium/java_client/android/options/UiAutomator2Options.java @@ -207,15 +207,30 @@ public class UiAutomator2Options extends BaseOptions implem SupportsDisableSuppressAccessibilityServiceOption, SupportsUserProfileOption, SupportsSkipLogCaptureOption { + /** + * Creates options with the default platform and automation names set. + */ public UiAutomator2Options() { setCommonOptions(); } + /** + * Creates options with the default platform and automation names set, + * and copies the capabilities from the given source. + * + * @param source Capabilities to copy. + */ public UiAutomator2Options(Capabilities source) { super(source); setCommonOptions(); } + /** + * Creates options with the default platform and automation names set, + * and copies the capabilities from the given map. + * + * @param source Capabilities map to copy. + */ public UiAutomator2Options(Map source) { super(source); setCommonOptions(); diff --git a/src/main/java/io/appium/java_client/android/options/adb/SupportsAdbExecTimeoutOption.java b/src/main/java/io/appium/java_client/android/options/adb/SupportsAdbExecTimeoutOption.java index 228ab056e..f3d2b0ffe 100644 --- a/src/main/java/io/appium/java_client/android/options/adb/SupportsAdbExecTimeoutOption.java +++ b/src/main/java/io/appium/java_client/android/options/adb/SupportsAdbExecTimeoutOption.java @@ -25,8 +25,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Provides getters and setters for the {@code adbExecTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAdbExecTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code adbExecTimeout} capability. + */ String ADB_EXEC_TIMEOUT_OPTION = "adbExecTimeout"; /** diff --git a/src/main/java/io/appium/java_client/android/options/adb/SupportsAdbPortOption.java b/src/main/java/io/appium/java_client/android/options/adb/SupportsAdbPortOption.java index 461e609ab..1323e4166 100644 --- a/src/main/java/io/appium/java_client/android/options/adb/SupportsAdbPortOption.java +++ b/src/main/java/io/appium/java_client/android/options/adb/SupportsAdbPortOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code adbPort} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAdbPortOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code adbPort} capability. + */ String ADB_PORT_OPTION = "adbPort"; /** diff --git a/src/main/java/io/appium/java_client/android/options/adb/SupportsAllowDelayAdbOption.java b/src/main/java/io/appium/java_client/android/options/adb/SupportsAllowDelayAdbOption.java index fc8ea3b80..92025dbd3 100644 --- a/src/main/java/io/appium/java_client/android/options/adb/SupportsAllowDelayAdbOption.java +++ b/src/main/java/io/appium/java_client/android/options/adb/SupportsAllowDelayAdbOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code allowDelayAdb} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAllowDelayAdbOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code allowDelayAdb} capability. + */ String ALLOW_DELAY_ADB_OPTION = "allowDelayAdb"; /** diff --git a/src/main/java/io/appium/java_client/android/options/adb/SupportsBuildToolsVersionOption.java b/src/main/java/io/appium/java_client/android/options/adb/SupportsBuildToolsVersionOption.java index df5b27f5a..5930b1454 100644 --- a/src/main/java/io/appium/java_client/android/options/adb/SupportsBuildToolsVersionOption.java +++ b/src/main/java/io/appium/java_client/android/options/adb/SupportsBuildToolsVersionOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code buildToolsVersion} capability. + * + * @param options type, used for chaining. + */ public interface SupportsBuildToolsVersionOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code buildToolsVersion} capability. + */ String BUILD_TOOLS_VERSION_OPTION = "buildToolsVersion"; /** diff --git a/src/main/java/io/appium/java_client/android/options/adb/SupportsClearDeviceLogsOnStartOption.java b/src/main/java/io/appium/java_client/android/options/adb/SupportsClearDeviceLogsOnStartOption.java index f48891388..d373a74f2 100644 --- a/src/main/java/io/appium/java_client/android/options/adb/SupportsClearDeviceLogsOnStartOption.java +++ b/src/main/java/io/appium/java_client/android/options/adb/SupportsClearDeviceLogsOnStartOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code clearDeviceLogsOnStart} capability. + * + * @param options type, used for chaining. + */ public interface SupportsClearDeviceLogsOnStartOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code clearDeviceLogsOnStart} capability. + */ String CLEAR_DEVICE_LOGS_ON_START_OPTION = "clearDeviceLogsOnStart"; /** diff --git a/src/main/java/io/appium/java_client/android/options/adb/SupportsIgnoreHiddenApiPolicyErrorOption.java b/src/main/java/io/appium/java_client/android/options/adb/SupportsIgnoreHiddenApiPolicyErrorOption.java index 29999e21d..7f559ca2a 100644 --- a/src/main/java/io/appium/java_client/android/options/adb/SupportsIgnoreHiddenApiPolicyErrorOption.java +++ b/src/main/java/io/appium/java_client/android/options/adb/SupportsIgnoreHiddenApiPolicyErrorOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code ignoreHiddenApiPolicyError} capability. + * + * @param options type, used for chaining. + */ public interface SupportsIgnoreHiddenApiPolicyErrorOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code ignoreHiddenApiPolicyError} capability. + */ String IGNORE_HIDDEN_API_POLICY_ERROR_OPTION = "ignoreHiddenApiPolicyError"; /** diff --git a/src/main/java/io/appium/java_client/android/options/adb/SupportsLogcatFilterSpecsOption.java b/src/main/java/io/appium/java_client/android/options/adb/SupportsLogcatFilterSpecsOption.java index f58076fe6..540bb495b 100644 --- a/src/main/java/io/appium/java_client/android/options/adb/SupportsLogcatFilterSpecsOption.java +++ b/src/main/java/io/appium/java_client/android/options/adb/SupportsLogcatFilterSpecsOption.java @@ -23,8 +23,16 @@ import java.util.List; import java.util.Optional; +/** + * Provides getters and setters for the {@code logcatFilterSpecs} capability. + * + * @param options type, used for chaining. + */ public interface SupportsLogcatFilterSpecsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code logcatFilterSpecs} capability. + */ String LOGCAT_FILTER_SPECS_OPTION = "logcatFilterSpecs"; /** diff --git a/src/main/java/io/appium/java_client/android/options/adb/SupportsLogcatFormatOption.java b/src/main/java/io/appium/java_client/android/options/adb/SupportsLogcatFormatOption.java index 98302419e..7aba405d4 100644 --- a/src/main/java/io/appium/java_client/android/options/adb/SupportsLogcatFormatOption.java +++ b/src/main/java/io/appium/java_client/android/options/adb/SupportsLogcatFormatOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code logcatFormat} capability. + * + * @param options type, used for chaining. + */ public interface SupportsLogcatFormatOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code logcatFormat} capability. + */ String LOGCAT_FORMAT_OPTION = "logcatFormat"; /** diff --git a/src/main/java/io/appium/java_client/android/options/adb/SupportsMockLocationAppOption.java b/src/main/java/io/appium/java_client/android/options/adb/SupportsMockLocationAppOption.java index e0b690f38..c496f3c66 100644 --- a/src/main/java/io/appium/java_client/android/options/adb/SupportsMockLocationAppOption.java +++ b/src/main/java/io/appium/java_client/android/options/adb/SupportsMockLocationAppOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code mockLocationApp} capability. + * + * @param options type, used for chaining. + */ public interface SupportsMockLocationAppOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code mockLocationApp} capability. + */ String MOCK_LOCATION_APP_OPTION = "mockLocationApp"; /** diff --git a/src/main/java/io/appium/java_client/android/options/adb/SupportsRemoteAdbHostOption.java b/src/main/java/io/appium/java_client/android/options/adb/SupportsRemoteAdbHostOption.java index 6e8c94a1d..13762d520 100644 --- a/src/main/java/io/appium/java_client/android/options/adb/SupportsRemoteAdbHostOption.java +++ b/src/main/java/io/appium/java_client/android/options/adb/SupportsRemoteAdbHostOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code remoteAdbHost} capability. + * + * @param options type, used for chaining. + */ public interface SupportsRemoteAdbHostOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code remoteAdbHost} capability. + */ String REMOTE_ADB_HOST_OPTION = "remoteAdbHost"; /** diff --git a/src/main/java/io/appium/java_client/android/options/adb/SupportsSkipLogcatCaptureOption.java b/src/main/java/io/appium/java_client/android/options/adb/SupportsSkipLogcatCaptureOption.java index 1bd0f6b42..ae7d9f6a6 100644 --- a/src/main/java/io/appium/java_client/android/options/adb/SupportsSkipLogcatCaptureOption.java +++ b/src/main/java/io/appium/java_client/android/options/adb/SupportsSkipLogcatCaptureOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code skipLogcatCapture} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSkipLogcatCaptureOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code skipLogcatCapture} capability. + */ String SKIP_LOGCAT_CAPTURE_OPTION = "skipLogcatCapture"; /** diff --git a/src/main/java/io/appium/java_client/android/options/adb/SupportsSuppressKillServerOption.java b/src/main/java/io/appium/java_client/android/options/adb/SupportsSuppressKillServerOption.java index daaa9666b..2da5f4e75 100644 --- a/src/main/java/io/appium/java_client/android/options/adb/SupportsSuppressKillServerOption.java +++ b/src/main/java/io/appium/java_client/android/options/adb/SupportsSuppressKillServerOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code suppressKillServer} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSuppressKillServerOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code suppressKillServer} capability. + */ String SUPPRESS_KILL_SERVER_OPTION = "suppressKillServer"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/ActivityOptions.java b/src/main/java/io/appium/java_client/android/options/app/ActivityOptions.java index 6a3db25d7..71f809c94 100644 --- a/src/main/java/io/appium/java_client/android/options/app/ActivityOptions.java +++ b/src/main/java/io/appium/java_client/android/options/app/ActivityOptions.java @@ -22,11 +22,22 @@ import java.util.Map; import java.util.Optional; +/** + * Custom options for the main app activity, mapped to the {@code activityOptions} capability. + */ public class ActivityOptions extends BaseMapOptionData { + /** + * Creates empty options. + */ public ActivityOptions() { super(); } + /** + * Creates options from the given map. + * + * @param options Initial option values. + */ public ActivityOptions(Map options) { super(options); } diff --git a/src/main/java/io/appium/java_client/android/options/app/IntentOptions.java b/src/main/java/io/appium/java_client/android/options/app/IntentOptions.java index 67f09f2b5..28e7302f5 100644 --- a/src/main/java/io/appium/java_client/android/options/app/IntentOptions.java +++ b/src/main/java/io/appium/java_client/android/options/app/IntentOptions.java @@ -24,11 +24,22 @@ import java.util.function.Function; import java.util.stream.Collectors; +/** + * Custom options for the intent used to start the app, mapped to the {@code intentOptions} capability. + */ public class IntentOptions extends BaseMapOptionData { + /** + * Creates empty options. + */ public IntentOptions() { super(); } + /** + * Creates options from the given map. + * + * @param options Initial option values. + */ public IntentOptions(Map options) { super(options); } diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsActivityOptionsOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsActivityOptionsOption.java index 59d5fe520..125796525 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsActivityOptionsOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsActivityOptionsOption.java @@ -23,8 +23,16 @@ import java.util.Map; import java.util.Optional; +/** + * Provides getters and setters for the {@code activityOptions} capability. + * + * @param options type, used for chaining. + */ public interface SupportsActivityOptionsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code activityOptions} capability. + */ String ACTIVITY_OPTIONS_OPTION = "activityOptions"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsAllowTestPackagesOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsAllowTestPackagesOption.java index 2926aa932..d9b7bc2d6 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsAllowTestPackagesOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsAllowTestPackagesOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code allowTestPackages} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAllowTestPackagesOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code allowTestPackages} capability. + */ String ALLOW_TEST_PACKAGES_OPTION = "allowTestPackages"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsAndroidInstallTimeoutOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsAndroidInstallTimeoutOption.java index ead32780b..37face26e 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsAndroidInstallTimeoutOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsAndroidInstallTimeoutOption.java @@ -24,8 +24,16 @@ import java.time.Duration; import java.util.Optional; +/** + * Provides getters and setters for the {@code androidInstallTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAndroidInstallTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code androidInstallTimeout} capability. + */ String ANDROID_INSTALL_TIMEOUT_OPTION = "androidInstallTimeout"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsAppActivityOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsAppActivityOption.java index 6e1e544bd..72c54ab78 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsAppActivityOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsAppActivityOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code appActivity} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAppActivityOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code appActivity} capability. + */ String APP_ACTIVITY_OPTION = "appActivity"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsAppPackageOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsAppPackageOption.java index a82cc5dfe..fad2d0c51 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsAppPackageOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsAppPackageOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code appPackage} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAppPackageOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code appPackage} capability. + */ String APP_PACKAGE_OPTION = "appPackage"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitActivityOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitActivityOption.java index 5567fbb1e..b14702b5c 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitActivityOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitActivityOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code appWaitActivity} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAppWaitActivityOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code appWaitActivity} capability. + */ String APP_WAIT_ACTIVITY_OPTION = "appWaitActivity"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitDurationOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitDurationOption.java index 77039f70d..72c872031 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitDurationOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitDurationOption.java @@ -25,8 +25,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Provides getters and setters for the {@code appWaitDuration} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAppWaitDurationOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code appWaitDuration} capability. + */ String APP_WAIT_DURATION_OPTION = "appWaitDuration"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitForLaunchOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitForLaunchOption.java index 70e440b54..8f7442860 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitForLaunchOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitForLaunchOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code appWaitForLaunch} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAppWaitForLaunchOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code appWaitForLaunch} capability. + */ String APP_WAIT_FOR_LAUNCH_OPTION = "appWaitForLaunch"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitPackageOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitPackageOption.java index 6089d9bcf..9f16f9cb6 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitPackageOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsAppWaitPackageOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code appWaitPackage} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAppWaitPackageOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code appWaitPackage} capability. + */ String APP_WAIT_PACKAGE_OPTION = "appWaitPackage"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsAutoGrantPermissionsOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsAutoGrantPermissionsOption.java index 7a7d6cde1..eccf97154 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsAutoGrantPermissionsOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsAutoGrantPermissionsOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code autoGrantPermissions} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAutoGrantPermissionsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code autoGrantPermissions} capability. + */ String AUTO_GRANT_PERMISSIONS_OPTION = "autoGrantPermissions"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsIntentActionOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsIntentActionOption.java index 7fc2afe89..71ccf26a7 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsIntentActionOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsIntentActionOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code intentAction} capability. + * + * @param options type, used for chaining. + */ public interface SupportsIntentActionOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code intentAction} capability. + */ String INTENT_ACTION_OPTION = "intentAction"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsIntentCategoryOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsIntentCategoryOption.java index 287ac09d4..2b75ce276 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsIntentCategoryOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsIntentCategoryOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code intentCategory} capability. + * + * @param options type, used for chaining. + */ public interface SupportsIntentCategoryOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code intentCategory} capability. + */ String INTENT_CATEGORY_OPTION = "intentCategory"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsIntentFlagsOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsIntentFlagsOption.java index 6c9ed08a8..eb524b66c 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsIntentFlagsOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsIntentFlagsOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code intentFlags} capability. + * + * @param options type, used for chaining. + */ public interface SupportsIntentFlagsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code intentFlags} capability. + */ String INTENT_FLAGS_OPTION = "intentFlags"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsIntentOptionsOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsIntentOptionsOption.java index 3c0fab894..ca4eb08f4 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsIntentOptionsOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsIntentOptionsOption.java @@ -23,8 +23,16 @@ import java.util.Map; import java.util.Optional; +/** + * Provides getters and setters for the {@code intentOptions} capability. + * + * @param options type, used for chaining. + */ public interface SupportsIntentOptionsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code intentOptions} capability. + */ String INTENT_OPTIONS_OPTION = "intentOptions"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsOptionalIntentArgumentsOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsOptionalIntentArgumentsOption.java index da5d5a3c7..d9afef612 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsOptionalIntentArgumentsOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsOptionalIntentArgumentsOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code optionalIntentArguments} capability. + * + * @param options type, used for chaining. + */ public interface SupportsOptionalIntentArgumentsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code optionalIntentArguments} capability. + */ String OPTIONAL_INTENT_ARGUMENTS_OPTION = "optionalIntentArguments"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsRemoteAppsCacheLimitOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsRemoteAppsCacheLimitOption.java index e44e8fcf4..a98b8d648 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsRemoteAppsCacheLimitOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsRemoteAppsCacheLimitOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code remoteAppsCacheLimit} capability. + * + * @param options type, used for chaining. + */ public interface SupportsRemoteAppsCacheLimitOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code remoteAppsCacheLimit} capability. + */ String REMOTE_APPS_CACHE_LIMIT_OPTION = "remoteAppsCacheLimit"; /** diff --git a/src/main/java/io/appium/java_client/android/options/app/SupportsUninstallOtherPackagesOption.java b/src/main/java/io/appium/java_client/android/options/app/SupportsUninstallOtherPackagesOption.java index fb1402d79..d9f97d354 100644 --- a/src/main/java/io/appium/java_client/android/options/app/SupportsUninstallOtherPackagesOption.java +++ b/src/main/java/io/appium/java_client/android/options/app/SupportsUninstallOtherPackagesOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code uninstallOtherPackages} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUninstallOtherPackagesOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code uninstallOtherPackages} capability. + */ String UNINSTALL_OTHER_PACKAGES_OPTION = "uninstallOtherPackages"; /** diff --git a/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdArgsOption.java b/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdArgsOption.java index bca9866c0..073036215 100644 --- a/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdArgsOption.java +++ b/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdArgsOption.java @@ -24,8 +24,16 @@ import java.util.List; import java.util.Optional; +/** + * Provides getters and setters for the {@code avdArgs} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAvdArgsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code avdArgs} capability. + */ String AVD_ARGS_OPTION = "avdArgs"; /** diff --git a/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdEnvOption.java b/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdEnvOption.java index 9fadb6532..ab84a0dc1 100644 --- a/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdEnvOption.java +++ b/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdEnvOption.java @@ -23,8 +23,16 @@ import java.util.Map; import java.util.Optional; +/** + * Provides getters and setters for the {@code avdEnv} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAvdEnvOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code avdEnv} capability. + */ String AVD_ENV_OPTION = "avdEnv"; /** diff --git a/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdLaunchTimeoutOption.java b/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdLaunchTimeoutOption.java index 974b02203..bd80586ac 100644 --- a/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdLaunchTimeoutOption.java +++ b/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdLaunchTimeoutOption.java @@ -25,8 +25,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Provides getters and setters for the {@code avdLaunchTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAvdLaunchTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code avdLaunchTimeout} capability. + */ String AVD_LAUNCH_TIMEOUT_OPTION = "avdLaunchTimeout"; /** diff --git a/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdOption.java b/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdOption.java index 8eac74bd4..617939b5b 100644 --- a/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdOption.java +++ b/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code avd} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAvdOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code avd} capability. + */ String AVD_OPTION = "avd"; /** diff --git a/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdReadyTimeoutOption.java b/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdReadyTimeoutOption.java index 68f1e27f2..ecdec1439 100644 --- a/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdReadyTimeoutOption.java +++ b/src/main/java/io/appium/java_client/android/options/avd/SupportsAvdReadyTimeoutOption.java @@ -25,8 +25,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Provides getters and setters for the {@code avdReadyTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAvdReadyTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code avdReadyTimeout} capability. + */ String AVD_READY_TIMEOUT_OPTION = "avdReadyTimeout"; /** diff --git a/src/main/java/io/appium/java_client/android/options/avd/SupportsGpsEnabledOption.java b/src/main/java/io/appium/java_client/android/options/avd/SupportsGpsEnabledOption.java index 91dce65da..9a5237cb2 100644 --- a/src/main/java/io/appium/java_client/android/options/avd/SupportsGpsEnabledOption.java +++ b/src/main/java/io/appium/java_client/android/options/avd/SupportsGpsEnabledOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code gpsEnabled} capability. + * + * @param options type, used for chaining. + */ public interface SupportsGpsEnabledOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code gpsEnabled} capability. + */ String GPS_ENABLED_OPTION = "gpsEnabled"; /** diff --git a/src/main/java/io/appium/java_client/android/options/avd/SupportsNetworkSpeedOption.java b/src/main/java/io/appium/java_client/android/options/avd/SupportsNetworkSpeedOption.java index 5a3d05b47..c9306e8d5 100644 --- a/src/main/java/io/appium/java_client/android/options/avd/SupportsNetworkSpeedOption.java +++ b/src/main/java/io/appium/java_client/android/options/avd/SupportsNetworkSpeedOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code networkSpeed} capability. + * + * @param options type, used for chaining. + */ public interface SupportsNetworkSpeedOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code networkSpeed} capability. + */ String NETWORK_SPEED_OPTION = "networkSpeed"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsAutoWebviewTimeoutOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsAutoWebviewTimeoutOption.java index 0f0a07967..1443386f9 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsAutoWebviewTimeoutOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsAutoWebviewTimeoutOption.java @@ -25,8 +25,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Provides getters and setters for the {@code autoWebviewTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAutoWebviewTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code autoWebviewTimeout} capability. + */ String AUTO_WEBVIEW_TIMEOUT_OPTION = "autoWebviewTimeout"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsChromeLoggingPrefsOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsChromeLoggingPrefsOption.java index f47f4d865..e7ac94779 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsChromeLoggingPrefsOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsChromeLoggingPrefsOption.java @@ -23,8 +23,16 @@ import java.util.Map; import java.util.Optional; +/** + * Provides getters and setters for the {@code chromeLoggingPrefs} capability. + * + * @param options type, used for chaining. + */ public interface SupportsChromeLoggingPrefsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code chromeLoggingPrefs} capability. + */ String CHROME_LOGGING_PREFS_OPTION = "chromeLoggingPrefs"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsChromeOptionsOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsChromeOptionsOption.java index 955a6c2a7..8e9e04d06 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsChromeOptionsOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsChromeOptionsOption.java @@ -23,8 +23,16 @@ import java.util.Map; import java.util.Optional; +/** + * Provides getters and setters for the {@code chromeOptions} capability. + * + * @param options type, used for chaining. + */ public interface SupportsChromeOptionsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code chromeOptions} capability. + */ String CHROME_OPTIONS_OPTION = "chromeOptions"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverArgsOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverArgsOption.java index 227088b35..7e60a0ef3 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverArgsOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverArgsOption.java @@ -23,8 +23,16 @@ import java.util.List; import java.util.Optional; +/** + * Provides getters and setters for the {@code chromedriverArgs} capability. + * + * @param options type, used for chaining. + */ public interface SupportsChromedriverArgsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code chromedriverArgs} capability. + */ String CHROMEDRIVER_ARGS_OPTION = "chromedriverArgs"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverChromeMappingFileOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverChromeMappingFileOption.java index 83faaef42..d23e2f092 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverChromeMappingFileOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverChromeMappingFileOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code chromedriverChromeMappingFile} capability. + * + * @param options type, used for chaining. + */ public interface SupportsChromedriverChromeMappingFileOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code chromedriverChromeMappingFile} capability. + */ String CHROMEDRIVER_CHROME_MAPPING_FILE_OPTION = "chromedriverChromeMappingFile"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverDisableBuildCheckOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverDisableBuildCheckOption.java index 7757b0ed3..977b81017 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverDisableBuildCheckOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverDisableBuildCheckOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code chromedriverDisableBuildCheck} capability. + * + * @param options type, used for chaining. + */ public interface SupportsChromedriverDisableBuildCheckOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code chromedriverDisableBuildCheck} capability. + */ String CHROMEDRIVER_DISABLE_BUILD_CHECK_OPTION = "chromedriverDisableBuildCheck"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverExecutableDirOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverExecutableDirOption.java index 994021a5f..4deb9147d 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverExecutableDirOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverExecutableDirOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code chromedriverExecutableDir} capability. + * + * @param options type, used for chaining. + */ public interface SupportsChromedriverExecutableDirOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code chromedriverExecutableDir} capability. + */ String CHROMEDRIVER_EXECUTABLE_DIR_OPTION = "chromedriverExecutableDir"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverExecutableOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverExecutableOption.java index 4f73b42a2..dadf4e61e 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverExecutableOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverExecutableOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code chromedriverExecutable} capability. + * + * @param options type, used for chaining. + */ public interface SupportsChromedriverExecutableOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code chromedriverExecutable} capability. + */ String CHROMEDRIVER_EXECUTABLE_OPTION = "chromedriverExecutable"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverPortOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverPortOption.java index fa6cc1f5a..d4e6de6fa 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverPortOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverPortOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code chromedriverPort} capability. + * + * @param options type, used for chaining. + */ public interface SupportsChromedriverPortOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code chromedriverPort} capability. + */ String CHROMEDRIVER_PORT_OPTION = "chromedriverPort"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverPortsOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverPortsOption.java index eb0a4630c..89e6c557a 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverPortsOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverPortsOption.java @@ -23,8 +23,16 @@ import java.util.List; import java.util.Optional; +/** + * Provides getters and setters for the {@code chromedriverPorts} capability. + * + * @param options type, used for chaining. + */ public interface SupportsChromedriverPortsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code chromedriverPorts} capability. + */ String CHROMEDRIVER_PORTS_OPTION = "chromedriverPorts"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverUseSystemExecutableOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverUseSystemExecutableOption.java index 62e653cb0..89e13ee96 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverUseSystemExecutableOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsChromedriverUseSystemExecutableOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code chromedriverUseSystemExecutable} capability. + * + * @param options type, used for chaining. + */ public interface SupportsChromedriverUseSystemExecutableOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code chromedriverUseSystemExecutable} capability. + */ String CHROMEDRIVER_USE_SYSTEM_EXECUTABLE_OPTION = "chromedriverUseSystemExecutable"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsEnsureWebviewsHavePagesOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsEnsureWebviewsHavePagesOption.java index d72cbe066..b1f67850c 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsEnsureWebviewsHavePagesOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsEnsureWebviewsHavePagesOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code ensureWebviewsHavePages} capability. + * + * @param options type, used for chaining. + */ public interface SupportsEnsureWebviewsHavePagesOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code ensureWebviewsHavePages} capability. + */ String ENSURE_WEBVIEWS_HAVE_PAGES_OPTION = "ensureWebviewsHavePages"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsExtractChromeAndroidPackageFromContextNameOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsExtractChromeAndroidPackageFromContextNameOption.java index 447a1f2f4..8d4d8714b 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsExtractChromeAndroidPackageFromContextNameOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsExtractChromeAndroidPackageFromContextNameOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code extractChromeAndroidPackageFromContextName} capability. + * + * @param options type, used for chaining. + */ public interface SupportsExtractChromeAndroidPackageFromContextNameOption > extends Capabilities, CanSetCapability { + /** + * Name of the {@code extractChromeAndroidPackageFromContextName} capability. + */ String EXTRACT_CHROME_ANDROID_PACKAGE_FROM_CONTEXT_NAME_OPTION = "extractChromeAndroidPackageFromContextName"; diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsNativeWebScreenshotOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsNativeWebScreenshotOption.java index 71e5934ff..4721b38e1 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsNativeWebScreenshotOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsNativeWebScreenshotOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code nativeWebScreenshot} capability. + * + * @param options type, used for chaining. + */ public interface SupportsNativeWebScreenshotOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code nativeWebScreenshot} capability. + */ String NATIVE_WEB_SCREENSHOT_OPTION = "nativeWebScreenshot"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsRecreateChromeDriverSessionsOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsRecreateChromeDriverSessionsOption.java index a47ade424..394ea33c3 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsRecreateChromeDriverSessionsOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsRecreateChromeDriverSessionsOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code recreateChromeDriverSessions} capability. + * + * @param options type, used for chaining. + */ public interface SupportsRecreateChromeDriverSessionsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code recreateChromeDriverSessions} capability. + */ String RECREATE_CHROME_DRIVER_SESSIONS = "recreateChromeDriverSessions"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsShowChromedriverLogOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsShowChromedriverLogOption.java index ef2b6f301..845a3eed1 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsShowChromedriverLogOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsShowChromedriverLogOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code showChromedriverLog} capability. + * + * @param options type, used for chaining. + */ public interface SupportsShowChromedriverLogOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code showChromedriverLog} capability. + */ String SHOW_CHROMEDRIVER_LOG_OPTION = "showChromedriverLog"; /** diff --git a/src/main/java/io/appium/java_client/android/options/context/SupportsWebviewDevtoolsPortOption.java b/src/main/java/io/appium/java_client/android/options/context/SupportsWebviewDevtoolsPortOption.java index e48e73fad..e99d52999 100644 --- a/src/main/java/io/appium/java_client/android/options/context/SupportsWebviewDevtoolsPortOption.java +++ b/src/main/java/io/appium/java_client/android/options/context/SupportsWebviewDevtoolsPortOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code webviewDevtoolsPort} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWebviewDevtoolsPortOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code webviewDevtoolsPort} capability. + */ String WEBVIEW_DEVTOOLS_PORT_OPTION = "webviewDevtoolsPort"; /** diff --git a/src/main/java/io/appium/java_client/android/options/localization/AppLocale.java b/src/main/java/io/appium/java_client/android/options/localization/AppLocale.java index f8f0147f7..035d03c48 100644 --- a/src/main/java/io/appium/java_client/android/options/localization/AppLocale.java +++ b/src/main/java/io/appium/java_client/android/options/localization/AppLocale.java @@ -21,11 +21,22 @@ import java.util.Map; import java.util.Optional; +/** + * Locale of the app under test, mapped to the {@code appLocale} capability. + */ public class AppLocale extends BaseMapOptionData { + /** + * Creates empty options. + */ public AppLocale() { super(); } + /** + * Creates options from the given map. + * + * @param options Initial option values. + */ public AppLocale(Map options) { super(options); } diff --git a/src/main/java/io/appium/java_client/android/options/localization/SupportsAppLocaleOption.java b/src/main/java/io/appium/java_client/android/options/localization/SupportsAppLocaleOption.java index d8fafba02..b665876e9 100644 --- a/src/main/java/io/appium/java_client/android/options/localization/SupportsAppLocaleOption.java +++ b/src/main/java/io/appium/java_client/android/options/localization/SupportsAppLocaleOption.java @@ -23,8 +23,16 @@ import java.util.Map; import java.util.Optional; +/** + * Provides getters and setters for the {@code appLocale} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAppLocaleOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code appLocale} capability. + */ String APP_LOCALE_OPTION = "appLocale"; /** diff --git a/src/main/java/io/appium/java_client/android/options/localization/SupportsLocaleScriptOption.java b/src/main/java/io/appium/java_client/android/options/localization/SupportsLocaleScriptOption.java index 835c7d41d..be08413a9 100644 --- a/src/main/java/io/appium/java_client/android/options/localization/SupportsLocaleScriptOption.java +++ b/src/main/java/io/appium/java_client/android/options/localization/SupportsLocaleScriptOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code localeScript} capability. + * + * @param options type, used for chaining. + */ public interface SupportsLocaleScriptOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code localeScript} capability. + */ String LOCALE_SCRIPT_OPTION = "localeScript"; /** diff --git a/src/main/java/io/appium/java_client/android/options/locking/SupportsSkipUnlockOption.java b/src/main/java/io/appium/java_client/android/options/locking/SupportsSkipUnlockOption.java index 0846dddfe..3570656d0 100644 --- a/src/main/java/io/appium/java_client/android/options/locking/SupportsSkipUnlockOption.java +++ b/src/main/java/io/appium/java_client/android/options/locking/SupportsSkipUnlockOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code skipUnlock} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSkipUnlockOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code skipUnlock} capability. + */ String SKIP_UNLOCK_OPTION = "skipUnlock"; /** diff --git a/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockKeyOption.java b/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockKeyOption.java index 011ca2c87..4db74d288 100644 --- a/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockKeyOption.java +++ b/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockKeyOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code unlockKey} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUnlockKeyOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code unlockKey} capability. + */ String UNLOCK_KEY_OPTION = "unlockKey"; /** diff --git a/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockStrategyOption.java b/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockStrategyOption.java index 6329d6861..1dca5ec94 100644 --- a/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockStrategyOption.java +++ b/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockStrategyOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code unlockStrategy} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUnlockStrategyOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code unlockStrategy} capability. + */ String UNLOCK_STRATEGY_OPTION = "unlockStrategy"; /** diff --git a/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockSuccessTimeoutOption.java b/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockSuccessTimeoutOption.java index 487fbbdca..ad88cd167 100644 --- a/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockSuccessTimeoutOption.java +++ b/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockSuccessTimeoutOption.java @@ -25,8 +25,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Provides getters and setters for the {@code unlockSuccessTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUnlockSuccessTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code unlockSuccessTimeout} capability. + */ String UNLOCK_SUCCESS_TIMEOUT_OPTION = "unlockSuccessTimeout"; /** diff --git a/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockTypeOption.java b/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockTypeOption.java index 76b749fef..ff0f724e2 100644 --- a/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockTypeOption.java +++ b/src/main/java/io/appium/java_client/android/options/locking/SupportsUnlockTypeOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code unlockType} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUnlockTypeOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code unlockType} capability. + */ String UNLOCK_TYPE_OPTION = "unlockType"; /** diff --git a/src/main/java/io/appium/java_client/android/options/mjpeg/SupportsMjpegScreenshotUrlOption.java b/src/main/java/io/appium/java_client/android/options/mjpeg/SupportsMjpegScreenshotUrlOption.java index bd8111c94..265b8ced3 100644 --- a/src/main/java/io/appium/java_client/android/options/mjpeg/SupportsMjpegScreenshotUrlOption.java +++ b/src/main/java/io/appium/java_client/android/options/mjpeg/SupportsMjpegScreenshotUrlOption.java @@ -24,8 +24,16 @@ import java.net.URL; import java.util.Optional; +/** + * Provides getters and setters for the {@code mjpegScreenshotUrl} capability. + * + * @param options type, used for chaining. + */ public interface SupportsMjpegScreenshotUrlOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code mjpegScreenshotUrl} capability. + */ String MJPEG_SCREENSHOT_URL_OPTION = "mjpegScreenshotUrl"; /** diff --git a/src/main/java/io/appium/java_client/android/options/mjpeg/SupportsMjpegServerPortOption.java b/src/main/java/io/appium/java_client/android/options/mjpeg/SupportsMjpegServerPortOption.java index 2649a5eb0..2e5e9223c 100644 --- a/src/main/java/io/appium/java_client/android/options/mjpeg/SupportsMjpegServerPortOption.java +++ b/src/main/java/io/appium/java_client/android/options/mjpeg/SupportsMjpegServerPortOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code mjpegServerPort} capability. + * + * @param options type, used for chaining. + */ public interface SupportsMjpegServerPortOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code mjpegServerPort} capability. + */ String MJPEG_SERVER_PORT_OPTION = "mjpegServerPort"; /** diff --git a/src/main/java/io/appium/java_client/android/options/other/SupportsDisableSuppressAccessibilityServiceOption.java b/src/main/java/io/appium/java_client/android/options/other/SupportsDisableSuppressAccessibilityServiceOption.java index eab017873..63b03d549 100644 --- a/src/main/java/io/appium/java_client/android/options/other/SupportsDisableSuppressAccessibilityServiceOption.java +++ b/src/main/java/io/appium/java_client/android/options/other/SupportsDisableSuppressAccessibilityServiceOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code disableSuppressAccessibilityService} capability. + * + * @param options type, used for chaining. + */ public interface SupportsDisableSuppressAccessibilityServiceOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code disableSuppressAccessibilityService} capability. + */ String DISABLE_SUPPRESS_ACCESSIBILITY_SERVICE_OPTION = "disableSuppressAccessibilityService"; /** diff --git a/src/main/java/io/appium/java_client/android/options/other/SupportsUserProfileOption.java b/src/main/java/io/appium/java_client/android/options/other/SupportsUserProfileOption.java index 0408abb1c..e927aa1b4 100644 --- a/src/main/java/io/appium/java_client/android/options/other/SupportsUserProfileOption.java +++ b/src/main/java/io/appium/java_client/android/options/other/SupportsUserProfileOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code userProfile} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUserProfileOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code userProfile} capability. + */ String USER_PROFILE_OPTION = "userProfile"; /** diff --git a/src/main/java/io/appium/java_client/android/options/server/EspressoBuildConfig.java b/src/main/java/io/appium/java_client/android/options/server/EspressoBuildConfig.java index 4cbc571da..c24893cc5 100644 --- a/src/main/java/io/appium/java_client/android/options/server/EspressoBuildConfig.java +++ b/src/main/java/io/appium/java_client/android/options/server/EspressoBuildConfig.java @@ -24,16 +24,30 @@ import java.util.Map; import java.util.Optional; +/** + * Build configuration of the Espresso server, mapped to the {@code espressoBuildConfig} capability. + */ public class EspressoBuildConfig extends BaseMapOptionData { + /** Name of the tools versions section. */ public static final String TOOLS_VERSION = "toolsVersions"; + /** Name of the additional app dependencies option. */ public static final String ADDITIONAL_APP_DEPENDENCIES = "additionalAppDependencies"; + /** Name of the additional Android test dependencies option. */ public static final String ADDITIONAL_ANDROID_TEST_DEPENDENCIES = "additionalAndroidTestDependencies"; + /** + * Creates an empty build config. + */ public EspressoBuildConfig() { super(); } + /** + * Creates a build config from the given JSON. + * + * @param json JSON string with the build config. + */ public EspressoBuildConfig(String json) { super(json); } diff --git a/src/main/java/io/appium/java_client/android/options/server/SupportsDisableWindowAnimationOption.java b/src/main/java/io/appium/java_client/android/options/server/SupportsDisableWindowAnimationOption.java index c8acbaac9..67fe68fbc 100644 --- a/src/main/java/io/appium/java_client/android/options/server/SupportsDisableWindowAnimationOption.java +++ b/src/main/java/io/appium/java_client/android/options/server/SupportsDisableWindowAnimationOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code disableWindowAnimation} capability. + * + * @param options type, used for chaining. + */ public interface SupportsDisableWindowAnimationOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code disableWindowAnimation} capability. + */ String DISABLE_WINDOWS_ANIMATION_OPTION = "disableWindowAnimation"; /** diff --git a/src/main/java/io/appium/java_client/android/options/server/SupportsEspressoBuildConfigOption.java b/src/main/java/io/appium/java_client/android/options/server/SupportsEspressoBuildConfigOption.java index a916ec35b..b5e76ee8c 100644 --- a/src/main/java/io/appium/java_client/android/options/server/SupportsEspressoBuildConfigOption.java +++ b/src/main/java/io/appium/java_client/android/options/server/SupportsEspressoBuildConfigOption.java @@ -23,8 +23,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code espressoBuildConfig} capability. + * + * @param options type, used for chaining. + */ public interface SupportsEspressoBuildConfigOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code espressoBuildConfig} capability. + */ String ESPRESSO_BUILD_CONFIG_OPTION = "espressoBuildConfig"; /** diff --git a/src/main/java/io/appium/java_client/android/options/server/SupportsEspressoServerLaunchTimeoutOption.java b/src/main/java/io/appium/java_client/android/options/server/SupportsEspressoServerLaunchTimeoutOption.java index 41bc66ee5..760a23149 100644 --- a/src/main/java/io/appium/java_client/android/options/server/SupportsEspressoServerLaunchTimeoutOption.java +++ b/src/main/java/io/appium/java_client/android/options/server/SupportsEspressoServerLaunchTimeoutOption.java @@ -25,8 +25,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Provides getters and setters for the {@code espressoServerLaunchTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsEspressoServerLaunchTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code espressoServerLaunchTimeout} capability. + */ String ESPRESSO_SERVER_LAUNCH_TIMEOUT_OPTION = "espressoServerLaunchTimeout"; /** diff --git a/src/main/java/io/appium/java_client/android/options/server/SupportsForceEspressoRebuildOption.java b/src/main/java/io/appium/java_client/android/options/server/SupportsForceEspressoRebuildOption.java index 843d25ddc..823033438 100644 --- a/src/main/java/io/appium/java_client/android/options/server/SupportsForceEspressoRebuildOption.java +++ b/src/main/java/io/appium/java_client/android/options/server/SupportsForceEspressoRebuildOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code forceEspressoRebuild} capability. + * + * @param options type, used for chaining. + */ public interface SupportsForceEspressoRebuildOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code forceEspressoRebuild} capability. + */ String FORCE_ESPRESSO_REBUILD_OPTION = "forceEspressoRebuild"; /** diff --git a/src/main/java/io/appium/java_client/android/options/server/SupportsShowGradleLogOption.java b/src/main/java/io/appium/java_client/android/options/server/SupportsShowGradleLogOption.java index dabd0f0ec..a201c047b 100644 --- a/src/main/java/io/appium/java_client/android/options/server/SupportsShowGradleLogOption.java +++ b/src/main/java/io/appium/java_client/android/options/server/SupportsShowGradleLogOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code showGradleLog} capability. + * + * @param options type, used for chaining. + */ public interface SupportsShowGradleLogOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code showGradleLog} capability. + */ String SHOW_GRADLE_LOG_OPTION = "showGradleLog"; /** diff --git a/src/main/java/io/appium/java_client/android/options/server/SupportsSkipDeviceInitializationOption.java b/src/main/java/io/appium/java_client/android/options/server/SupportsSkipDeviceInitializationOption.java index 2b42327bb..46afafea7 100644 --- a/src/main/java/io/appium/java_client/android/options/server/SupportsSkipDeviceInitializationOption.java +++ b/src/main/java/io/appium/java_client/android/options/server/SupportsSkipDeviceInitializationOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code skipDeviceInitialization} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSkipDeviceInitializationOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code skipDeviceInitialization} capability. + */ String SKIP_DEVICE_INITIALIZATION_OPTION = "skipDeviceInitialization"; /** diff --git a/src/main/java/io/appium/java_client/android/options/server/SupportsSkipServerInstallationOption.java b/src/main/java/io/appium/java_client/android/options/server/SupportsSkipServerInstallationOption.java index ad572b3f6..af7a88a8d 100644 --- a/src/main/java/io/appium/java_client/android/options/server/SupportsSkipServerInstallationOption.java +++ b/src/main/java/io/appium/java_client/android/options/server/SupportsSkipServerInstallationOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code skipServerInstallation} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSkipServerInstallationOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code skipServerInstallation} capability. + */ String SKIP_SERVER_INSTALLATION_OPTION = "skipServerInstallation"; /** diff --git a/src/main/java/io/appium/java_client/android/options/server/SupportsSystemPortOption.java b/src/main/java/io/appium/java_client/android/options/server/SupportsSystemPortOption.java index 925b8ea3d..1dcf390cd 100644 --- a/src/main/java/io/appium/java_client/android/options/server/SupportsSystemPortOption.java +++ b/src/main/java/io/appium/java_client/android/options/server/SupportsSystemPortOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code systemPort} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSystemPortOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code systemPort} capability. + */ String SYSTEM_PORT_OPTION = "systemPort"; /** diff --git a/src/main/java/io/appium/java_client/android/options/server/SupportsUiautomator2ServerInstallTimeoutOption.java b/src/main/java/io/appium/java_client/android/options/server/SupportsUiautomator2ServerInstallTimeoutOption.java index dac3b3b38..1bb9ec488 100644 --- a/src/main/java/io/appium/java_client/android/options/server/SupportsUiautomator2ServerInstallTimeoutOption.java +++ b/src/main/java/io/appium/java_client/android/options/server/SupportsUiautomator2ServerInstallTimeoutOption.java @@ -25,8 +25,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Provides getters and setters for the {@code uiautomator2ServerInstallTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUiautomator2ServerInstallTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code uiautomator2ServerInstallTimeout} capability. + */ String UIAUTOMATOR2_SERVER_INSTALL_TIMEOUT_OPTION = "uiautomator2ServerInstallTimeout"; /** diff --git a/src/main/java/io/appium/java_client/android/options/server/SupportsUiautomator2ServerLaunchTimeoutOption.java b/src/main/java/io/appium/java_client/android/options/server/SupportsUiautomator2ServerLaunchTimeoutOption.java index ea12f0d09..0df8397a5 100644 --- a/src/main/java/io/appium/java_client/android/options/server/SupportsUiautomator2ServerLaunchTimeoutOption.java +++ b/src/main/java/io/appium/java_client/android/options/server/SupportsUiautomator2ServerLaunchTimeoutOption.java @@ -25,8 +25,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Provides getters and setters for the {@code uiautomator2ServerLaunchTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUiautomator2ServerLaunchTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code uiautomator2ServerLaunchTimeout} capability. + */ String UIAUTOMATOR2_SERVER_LAUNCH_TIMEOUT_OPTION = "uiautomator2ServerLaunchTimeout"; /** diff --git a/src/main/java/io/appium/java_client/android/options/server/SupportsUiautomator2ServerReadTimeoutOption.java b/src/main/java/io/appium/java_client/android/options/server/SupportsUiautomator2ServerReadTimeoutOption.java index 699b73c48..f91adf29e 100644 --- a/src/main/java/io/appium/java_client/android/options/server/SupportsUiautomator2ServerReadTimeoutOption.java +++ b/src/main/java/io/appium/java_client/android/options/server/SupportsUiautomator2ServerReadTimeoutOption.java @@ -25,8 +25,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Provides getters and setters for the {@code uiautomator2ServerReadTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUiautomator2ServerReadTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code uiautomator2ServerReadTimeout} capability. + */ String UIAUTOMATOR2_SERVER_READ_TIMEOUT_OPTION = "uiautomator2ServerReadTimeout"; /** diff --git a/src/main/java/io/appium/java_client/android/options/signing/KeystoreConfig.java b/src/main/java/io/appium/java_client/android/options/signing/KeystoreConfig.java index 5ab0d78b6..df46e71d7 100644 --- a/src/main/java/io/appium/java_client/android/options/signing/KeystoreConfig.java +++ b/src/main/java/io/appium/java_client/android/options/signing/KeystoreConfig.java @@ -19,6 +19,9 @@ import lombok.Data; import lombok.ToString; +/** + * Configuration of a custom keystore used to sign the app under test. + */ @ToString() @Data() public class KeystoreConfig { @@ -26,4 +29,19 @@ public class KeystoreConfig { private final String password; private final String keyAlias; private final String keyPassword; + + /** + * Creates a new keystore configuration. + * + * @param path the keystore path + * @param password the keystore password + * @param keyAlias the key alias + * @param keyPassword the key password + */ + public KeystoreConfig(String path, String password, String keyAlias, String keyPassword) { + this.path = path; + this.password = password; + this.keyAlias = keyAlias; + this.keyPassword = keyPassword; + } } diff --git a/src/main/java/io/appium/java_client/android/options/signing/SupportsKeystoreOptions.java b/src/main/java/io/appium/java_client/android/options/signing/SupportsKeystoreOptions.java index 5fbfcc2ce..d8c9f8996 100644 --- a/src/main/java/io/appium/java_client/android/options/signing/SupportsKeystoreOptions.java +++ b/src/main/java/io/appium/java_client/android/options/signing/SupportsKeystoreOptions.java @@ -24,12 +24,32 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the keystore signing capabilities. + * + * @param options type, used for chaining. + */ public interface SupportsKeystoreOptions> extends Capabilities, CanSetCapability { + /** + * Name of the {@code useKeystore} capability. + */ String USE_KEYSTORE_OPTION = "useKeystore"; + /** + * Name of the {@code keystorePath} capability. + */ String KEYSTORE_PATH_OPTION = "keystorePath"; + /** + * Name of the {@code keystorePassword} capability. + */ String KEYSTORE_PASSWORD_OPTION = "keystorePassword"; + /** + * Name of the {@code keyAlias} capability. + */ String KEY_ALIAS_OPTION = "keyAlias"; + /** + * Name of the {@code keyPassword} capability. + */ String KEY_PASSWORD_OPTION = "keyPassword"; /** diff --git a/src/main/java/io/appium/java_client/android/options/signing/SupportsNoSignOption.java b/src/main/java/io/appium/java_client/android/options/signing/SupportsNoSignOption.java index 9518d7b8f..927408956 100644 --- a/src/main/java/io/appium/java_client/android/options/signing/SupportsNoSignOption.java +++ b/src/main/java/io/appium/java_client/android/options/signing/SupportsNoSignOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code noSign} capability. + * + * @param options type, used for chaining. + */ public interface SupportsNoSignOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code noSign} capability. + */ String NO_SIGN_OPTION = "noSign"; /** diff --git a/src/main/java/io/appium/java_client/appmanagement/ApplicationState.java b/src/main/java/io/appium/java_client/appmanagement/ApplicationState.java index 8cc9005a3..855ddf476 100644 --- a/src/main/java/io/appium/java_client/appmanagement/ApplicationState.java +++ b/src/main/java/io/appium/java_client/appmanagement/ApplicationState.java @@ -18,9 +18,20 @@ import java.util.Arrays; +/** + * Possible states of an application on the device under test. + */ public enum ApplicationState { - NOT_INSTALLED, NOT_RUNNING, RUNNING_IN_BACKGROUND_SUSPENDED, - RUNNING_IN_BACKGROUND, RUNNING_IN_FOREGROUND; + /** The application is not installed. */ + NOT_INSTALLED, + /** The application is installed, but not running. */ + NOT_RUNNING, + /** The application is running in the background and is suspended. */ + RUNNING_IN_BACKGROUND_SUSPENDED, + /** The application is running in the background. */ + RUNNING_IN_BACKGROUND, + /** The application is running in the foreground. */ + RUNNING_IN_FOREGROUND; /** * Creates {@link ApplicationState} instance based on the code. diff --git a/src/main/java/io/appium/java_client/appmanagement/BaseActivateApplicationOptions.java b/src/main/java/io/appium/java_client/appmanagement/BaseActivateApplicationOptions.java index 08158d32b..066823223 100644 --- a/src/main/java/io/appium/java_client/appmanagement/BaseActivateApplicationOptions.java +++ b/src/main/java/io/appium/java_client/appmanagement/BaseActivateApplicationOptions.java @@ -16,7 +16,17 @@ package io.appium.java_client.appmanagement; +/** + * Base class for the options of the application activation commands. + * + * @param the actual options type, used for chaining + */ public abstract class BaseActivateApplicationOptions> extends BaseOptions { + /** + * Creates a new instance. + */ + public BaseActivateApplicationOptions() { + } } diff --git a/src/main/java/io/appium/java_client/appmanagement/BaseInstallApplicationOptions.java b/src/main/java/io/appium/java_client/appmanagement/BaseInstallApplicationOptions.java index ac58ab7dc..675a59b6a 100644 --- a/src/main/java/io/appium/java_client/appmanagement/BaseInstallApplicationOptions.java +++ b/src/main/java/io/appium/java_client/appmanagement/BaseInstallApplicationOptions.java @@ -16,7 +16,17 @@ package io.appium.java_client.appmanagement; +/** + * Base class for the options of the application installation commands. + * + * @param the actual options type, used for chaining + */ public abstract class BaseInstallApplicationOptions> extends BaseOptions { + /** + * Creates a new instance. + */ + public BaseInstallApplicationOptions() { + } } diff --git a/src/main/java/io/appium/java_client/appmanagement/BaseOptions.java b/src/main/java/io/appium/java_client/appmanagement/BaseOptions.java index 1c1327a86..0087f263a 100644 --- a/src/main/java/io/appium/java_client/appmanagement/BaseOptions.java +++ b/src/main/java/io/appium/java_client/appmanagement/BaseOptions.java @@ -18,7 +18,17 @@ import java.util.Map; +/** + * Base class for the options of the application management commands. + * + * @param the actual options type, used for chaining + */ public abstract class BaseOptions> { + /** + * Creates a new instance. + */ + public BaseOptions() { + } /** * Creates a map based on the provided options. diff --git a/src/main/java/io/appium/java_client/appmanagement/BaseRemoveApplicationOptions.java b/src/main/java/io/appium/java_client/appmanagement/BaseRemoveApplicationOptions.java index e43ce5631..a712e98b5 100644 --- a/src/main/java/io/appium/java_client/appmanagement/BaseRemoveApplicationOptions.java +++ b/src/main/java/io/appium/java_client/appmanagement/BaseRemoveApplicationOptions.java @@ -16,7 +16,17 @@ package io.appium.java_client.appmanagement; +/** + * Base class for the options of the application removal commands. + * + * @param the actual options type, used for chaining + */ public abstract class BaseRemoveApplicationOptions> extends BaseOptions { + /** + * Creates a new instance. + */ + public BaseRemoveApplicationOptions() { + } } diff --git a/src/main/java/io/appium/java_client/appmanagement/BaseTerminateApplicationOptions.java b/src/main/java/io/appium/java_client/appmanagement/BaseTerminateApplicationOptions.java index 204f87a66..a6e3e6cd7 100644 --- a/src/main/java/io/appium/java_client/appmanagement/BaseTerminateApplicationOptions.java +++ b/src/main/java/io/appium/java_client/appmanagement/BaseTerminateApplicationOptions.java @@ -16,7 +16,17 @@ package io.appium.java_client.appmanagement; +/** + * Base class for the options of the application termination commands. + * + * @param the actual options type, used for chaining + */ public abstract class BaseTerminateApplicationOptions> extends BaseOptions { + /** + * Creates a new instance. + */ + public BaseTerminateApplicationOptions() { + } } diff --git a/src/main/java/io/appium/java_client/battery/BatteryInfo.java b/src/main/java/io/appium/java_client/battery/BatteryInfo.java index 1781db8a5..20de8486c 100644 --- a/src/main/java/io/appium/java_client/battery/BatteryInfo.java +++ b/src/main/java/io/appium/java_client/battery/BatteryInfo.java @@ -2,9 +2,17 @@ import java.util.Map; +/** + * Battery information of the device under test. + */ public abstract class BatteryInfo { private final Map input; + /** + * Creates a new instance from the raw battery data. + * + * @param input the raw battery info mapping returned by the server + */ public BatteryInfo(Map input) { this.input = input; } @@ -30,6 +38,11 @@ public double getLevel() { */ public abstract T getState(); + /** + * Returns the raw battery data. + * + * @return the raw battery info mapping + */ protected Map getInput() { return this.input; } diff --git a/src/main/java/io/appium/java_client/battery/HasBattery.java b/src/main/java/io/appium/java_client/battery/HasBattery.java index 4b25cc7e4..9b8a29cf9 100644 --- a/src/main/java/io/appium/java_client/battery/HasBattery.java +++ b/src/main/java/io/appium/java_client/battery/HasBattery.java @@ -18,6 +18,11 @@ import io.appium.java_client.ExecutesMethod; +/** + * Provides access to the battery information of the device under test. + * + * @param the platform-specific {@link BatteryInfo} type + */ public interface HasBattery extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/chromium/ChromiumDriver.java b/src/main/java/io/appium/java_client/chromium/ChromiumDriver.java index df698a4d1..3ab0dd7a7 100644 --- a/src/main/java/io/appium/java_client/chromium/ChromiumDriver.java +++ b/src/main/java/io/appium/java_client/chromium/ChromiumDriver.java @@ -39,36 +39,91 @@ public class ChromiumDriver extends AppiumDriver { private static final String AUTOMATION_NAME = AutomationName.CHROMIUM; + /** + * Creates a new instance based on command {@code executor} and {@code capabilities}. + * + * @param executor the command executor that sends the commands to the server + * @param capabilities the capabilities of the session to create + */ public ChromiumDriver(AppiumCommandExecutor executor, Capabilities capabilities) { super(executor, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on the server address and {@code capabilities}. + * + * @param remoteAddress the address of the remote Appium server + * @param capabilities the capabilities of the session to create + */ public ChromiumDriver(URL remoteAddress, Capabilities capabilities) { super(remoteAddress, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on the server address, a custom HTTP client factory + * and {@code capabilities}. + * + * @param remoteAddress the address of the remote Appium server + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public ChromiumDriver(URL remoteAddress, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(remoteAddress, httpClientFactory, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on the local Appium service and {@code capabilities}. + * + * @param service the local Appium service to start and connect to + * @param capabilities the capabilities of the session to create + */ public ChromiumDriver(AppiumDriverLocalService service, Capabilities capabilities) { super(service, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on the local Appium service, a custom HTTP client factory + * and {@code capabilities}. + * + * @param service the local Appium service to start and connect to + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public ChromiumDriver(AppiumDriverLocalService service, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(service, httpClientFactory, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on the local Appium service builder and {@code capabilities}. + * + * @param builder the builder of the local Appium service to start and connect to + * @param capabilities the capabilities of the session to create + */ public ChromiumDriver(AppiumServiceBuilder builder, Capabilities capabilities) { super(builder, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on the local Appium service builder, a custom HTTP client + * factory and {@code capabilities}. + * + * @param builder the builder of the local Appium service to start and connect to + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public ChromiumDriver(AppiumServiceBuilder builder, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(builder, httpClientFactory, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on a custom HTTP client factory and {@code capabilities}. + * The default local Appium service is used. + * + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public ChromiumDriver(HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(httpClientFactory, ensureAutomationName(capabilities, AUTOMATION_NAME)); } @@ -111,6 +166,11 @@ public ChromiumDriver(AppiumClientConfig appiumClientConfig, Capabilities capabi super(appiumClientConfig, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on {@code capabilities} using the default local Appium service. + * + * @param capabilities the capabilities of the session to create + */ public ChromiumDriver(Capabilities capabilities) { super(ensureAutomationName(capabilities, AUTOMATION_NAME)); } diff --git a/src/main/java/io/appium/java_client/chromium/options/ChromiumOptions.java b/src/main/java/io/appium/java_client/chromium/options/ChromiumOptions.java index 2f25eeff4..2e9b3a71f 100644 --- a/src/main/java/io/appium/java_client/chromium/options/ChromiumOptions.java +++ b/src/main/java/io/appium/java_client/chromium/options/ChromiumOptions.java @@ -38,15 +38,26 @@ public class ChromiumOptions extends BaseOptions implements SupportsBuildCheckOption, SupportsAutodownloadOption, SupportsUseSystemExecutableOption { + /** Creates options with the default capabilities set. */ public ChromiumOptions() { setCommonOptions(); } + /** + * Creates options from the given capabilities. + * + * @param source The capabilities to copy. + */ public ChromiumOptions(Capabilities source) { super(source); setCommonOptions(); } + /** + * Creates options from the given capabilities map. + * + * @param source The capabilities to copy. + */ public ChromiumOptions(Map source) { super(source); setCommonOptions(); diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsAutodownloadOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsAutodownloadOption.java index a1cefdffe..c5c932c88 100644 --- a/src/main/java/io/appium/java_client/chromium/options/SupportsAutodownloadOption.java +++ b/src/main/java/io/appium/java_client/chromium/options/SupportsAutodownloadOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code autodownloadEnabled} capability: whether Chrome drivers are downloaded automatically. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsAutodownloadOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code autodownloadEnabled} capability. + */ String AUTODOWNLOAD_ENABLED = "autodownloadEnabled"; /** diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsBuildCheckOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsBuildCheckOption.java index 204967bca..3c42698b6 100644 --- a/src/main/java/io/appium/java_client/chromium/options/SupportsBuildCheckOption.java +++ b/src/main/java/io/appium/java_client/chromium/options/SupportsBuildCheckOption.java @@ -24,8 +24,17 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code disableBuildCheck} capability: whether the Chrome driver and browser version compatibility + * check is disabled. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsBuildCheckOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code disableBuildCheck} capability. + */ String DISABLE_BUILD_CHECK = "disableBuildCheck"; /** diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsChromeDrivePortOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsChromeDrivePortOption.java index 68cace279..601c209aa 100644 --- a/src/main/java/io/appium/java_client/chromium/options/SupportsChromeDrivePortOption.java +++ b/src/main/java/io/appium/java_client/chromium/options/SupportsChromeDrivePortOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Support for the {@code chromedriverPort} capability: the port the Chrome driver listens on. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsChromeDrivePortOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code chromedriverPort} capability. + */ String CHROME_DRIVER_PORT = "chromedriverPort"; /** diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsExecutableDirOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsExecutableDirOption.java index c525ab7ad..8e5320c7a 100644 --- a/src/main/java/io/appium/java_client/chromium/options/SupportsExecutableDirOption.java +++ b/src/main/java/io/appium/java_client/chromium/options/SupportsExecutableDirOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Support for the {@code executableDir} capability: the directory where Chrome driver executables are stored. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsExecutableDirOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code executableDir} capability. + */ String EXECUTABLE_DIR = "executableDir"; /** diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsExecutableOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsExecutableOption.java index 84e730e62..c4fed4377 100644 --- a/src/main/java/io/appium/java_client/chromium/options/SupportsExecutableOption.java +++ b/src/main/java/io/appium/java_client/chromium/options/SupportsExecutableOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Support for the {@code executable} capability: the path to a custom Chrome driver executable. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsExecutableOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code executable} capability. + */ String EXECUTABLE = "executable"; /** diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsLogPathOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsLogPathOption.java index cf1b8713d..aaa14f56c 100644 --- a/src/main/java/io/appium/java_client/chromium/options/SupportsLogPathOption.java +++ b/src/main/java/io/appium/java_client/chromium/options/SupportsLogPathOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Support for the {@code logPath} capability: the path to the driver log file. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsLogPathOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code logPath} capability. + */ String LOG_PATH = "logPath"; /** diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsUseSystemExecutableOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsUseSystemExecutableOption.java index 6d51b332b..5858fdbb8 100644 --- a/src/main/java/io/appium/java_client/chromium/options/SupportsUseSystemExecutableOption.java +++ b/src/main/java/io/appium/java_client/chromium/options/SupportsUseSystemExecutableOption.java @@ -24,8 +24,17 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code useSystemExecutable} capability: whether the Chrome driver executable found on the system + * is used. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsUseSystemExecutableOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code useSystemExecutable} capability. + */ String USE_SYSTEM_EXECUTABLE = "useSystemExecutable"; /** diff --git a/src/main/java/io/appium/java_client/chromium/options/SupportsVerboseOption.java b/src/main/java/io/appium/java_client/chromium/options/SupportsVerboseOption.java index 14aa571d2..f1a126ed9 100644 --- a/src/main/java/io/appium/java_client/chromium/options/SupportsVerboseOption.java +++ b/src/main/java/io/appium/java_client/chromium/options/SupportsVerboseOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code verbose} capability: whether verbose driver logging is enabled. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsVerboseOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code verbose} capability. + */ String VERBOSE = "verbose"; /** diff --git a/src/main/java/io/appium/java_client/clipboard/ClipboardContentType.java b/src/main/java/io/appium/java_client/clipboard/ClipboardContentType.java index 006d88e43..7e08b103a 100644 --- a/src/main/java/io/appium/java_client/clipboard/ClipboardContentType.java +++ b/src/main/java/io/appium/java_client/clipboard/ClipboardContentType.java @@ -16,6 +16,14 @@ package io.appium.java_client.clipboard; +/** + * Content types supported by the device clipboard. + */ public enum ClipboardContentType { - PLAINTEXT, IMAGE, URL + /** Plain text. */ + PLAINTEXT, + /** An image. */ + IMAGE, + /** A URL. */ + URL } diff --git a/src/main/java/io/appium/java_client/clipboard/HasClipboard.java b/src/main/java/io/appium/java_client/clipboard/HasClipboard.java index 60cc2e159..1f0a26559 100644 --- a/src/main/java/io/appium/java_client/clipboard/HasClipboard.java +++ b/src/main/java/io/appium/java_client/clipboard/HasClipboard.java @@ -26,6 +26,9 @@ import static java.util.Locale.ROOT; import static java.util.Objects.requireNonNull; +/** + * Provides access to the clipboard of the device under test. + */ public interface HasClipboard extends ExecutesMethod { /** * Set the content of device's clipboard. diff --git a/src/main/java/io/appium/java_client/driverscripts/ScriptOptions.java b/src/main/java/io/appium/java_client/driverscripts/ScriptOptions.java index 7eac89083..e94adb26a 100644 --- a/src/main/java/io/appium/java_client/driverscripts/ScriptOptions.java +++ b/src/main/java/io/appium/java_client/driverscripts/ScriptOptions.java @@ -24,8 +24,16 @@ import static java.util.Objects.requireNonNull; import static java.util.Optional.ofNullable; - +/** + * Options of the driver script execution. + */ public class ScriptOptions { + /** + * Creates a new instance. + */ + public ScriptOptions() { + } + private ScriptType scriptType; private Long timeoutMs; diff --git a/src/main/java/io/appium/java_client/driverscripts/ScriptType.java b/src/main/java/io/appium/java_client/driverscripts/ScriptType.java index 42aa78833..0eab3ed0f 100644 --- a/src/main/java/io/appium/java_client/driverscripts/ScriptType.java +++ b/src/main/java/io/appium/java_client/driverscripts/ScriptType.java @@ -16,6 +16,10 @@ package io.appium.java_client.driverscripts; +/** + * Supported driver script types. + */ public enum ScriptType { + /** A WebdriverIO script. */ WEBDRIVERIO } diff --git a/src/main/java/io/appium/java_client/driverscripts/ScriptValue.java b/src/main/java/io/appium/java_client/driverscripts/ScriptValue.java index 934cd670d..86c25786a 100644 --- a/src/main/java/io/appium/java_client/driverscripts/ScriptValue.java +++ b/src/main/java/io/appium/java_client/driverscripts/ScriptValue.java @@ -21,6 +21,9 @@ import java.util.Map; +/** + * The result of the driver script execution. + */ public class ScriptValue { /** * The result of ExecuteDriverScript call. @@ -37,6 +40,12 @@ public class ScriptValue { */ @Getter(AccessLevel.PUBLIC) private final Map logs; + /** + * Creates a new script value. + * + * @param result the value returned by the script + * @param logs the logs mapping produced by the script + */ public ScriptValue(Object result, Map logs) { this.result = result; this.logs = logs; diff --git a/src/main/java/io/appium/java_client/flutter/CanExecuteFlutterScripts.java b/src/main/java/io/appium/java_client/flutter/CanExecuteFlutterScripts.java index e844388be..efbd6aaea 100644 --- a/src/main/java/io/appium/java_client/flutter/CanExecuteFlutterScripts.java +++ b/src/main/java/io/appium/java_client/flutter/CanExecuteFlutterScripts.java @@ -5,6 +5,9 @@ import java.util.Map; +/** + * The interface for the drivers that can execute Flutter integration driver scripts. + */ public interface CanExecuteFlutterScripts extends JavascriptExecutor { /** diff --git a/src/main/java/io/appium/java_client/flutter/FlutterDriverOptions.java b/src/main/java/io/appium/java_client/flutter/FlutterDriverOptions.java index 2e5a83430..4daa3ed8d 100644 --- a/src/main/java/io/appium/java_client/flutter/FlutterDriverOptions.java +++ b/src/main/java/io/appium/java_client/flutter/FlutterDriverOptions.java @@ -24,24 +24,49 @@ public class FlutterDriverOptions extends BaseOptions impl SupportsFlutterElementWaitTimeoutOption, SupportsFlutterEnableMockCamera { + /** + * Creates a new instance with the default Flutter driver options. + */ public FlutterDriverOptions() { setDefaultOptions(); } + /** + * Creates a new instance from the given capabilities with the default Flutter driver options. + * + * @param source the capabilities to copy + */ public FlutterDriverOptions(Capabilities source) { super(source); setDefaultOptions(); } + /** + * Creates a new instance from the given map with the default Flutter driver options. + * + * @param source the capabilities to copy + */ public FlutterDriverOptions(Map source) { super(source); setDefaultOptions(); } + /** + * Merges the given UiAutomator2 options into these options. + * + * @param uiAutomator2Options the Android options to merge + * @return self instance for chaining + */ public FlutterDriverOptions setUiAutomator2Options(UiAutomator2Options uiAutomator2Options) { return setDefaultOptions(merge(uiAutomator2Options)); } + /** + * Merges the given XCUITest options into these options. + * + * @param xcuiTestOptions the iOS options to merge + * @return self instance for chaining + */ public FlutterDriverOptions setXCUITestOptions(XCUITestOptions xcuiTestOptions) { return setDefaultOptions(merge(xcuiTestOptions)); } diff --git a/src/main/java/io/appium/java_client/flutter/SupportsGestureOnFlutterElements.java b/src/main/java/io/appium/java_client/flutter/SupportsGestureOnFlutterElements.java index 7e80e8a97..6b79808cc 100644 --- a/src/main/java/io/appium/java_client/flutter/SupportsGestureOnFlutterElements.java +++ b/src/main/java/io/appium/java_client/flutter/SupportsGestureOnFlutterElements.java @@ -4,6 +4,9 @@ import io.appium.java_client.flutter.commands.DragAndDropParameter; import io.appium.java_client.flutter.commands.LongPressParameter; +/** + * The interface for the drivers that can perform gestures on Flutter elements. + */ public interface SupportsGestureOnFlutterElements extends CanExecuteFlutterScripts { /** diff --git a/src/main/java/io/appium/java_client/flutter/SupportsScrollingOfFlutterElements.java b/src/main/java/io/appium/java_client/flutter/SupportsScrollingOfFlutterElements.java index 25a734cf7..169d350ff 100644 --- a/src/main/java/io/appium/java_client/flutter/SupportsScrollingOfFlutterElements.java +++ b/src/main/java/io/appium/java_client/flutter/SupportsScrollingOfFlutterElements.java @@ -3,6 +3,9 @@ import io.appium.java_client.flutter.commands.ScrollParameter; import org.openqa.selenium.WebElement; +/** + * The interface for the drivers that can scroll to Flutter elements. + */ public interface SupportsScrollingOfFlutterElements extends CanExecuteFlutterScripts { /** diff --git a/src/main/java/io/appium/java_client/flutter/SupportsWaitingForFlutterElements.java b/src/main/java/io/appium/java_client/flutter/SupportsWaitingForFlutterElements.java index 521f75cc8..376946f3f 100644 --- a/src/main/java/io/appium/java_client/flutter/SupportsWaitingForFlutterElements.java +++ b/src/main/java/io/appium/java_client/flutter/SupportsWaitingForFlutterElements.java @@ -2,6 +2,9 @@ import io.appium.java_client.flutter.commands.WaitParameter; +/** + * The interface for the drivers that can wait for Flutter elements. + */ public interface SupportsWaitingForFlutterElements extends CanExecuteFlutterScripts { /** diff --git a/src/main/java/io/appium/java_client/flutter/android/FlutterAndroidDriver.java b/src/main/java/io/appium/java_client/flutter/android/FlutterAndroidDriver.java index 2cd1b8482..0bcb60522 100644 --- a/src/main/java/io/appium/java_client/flutter/android/FlutterAndroidDriver.java +++ b/src/main/java/io/appium/java_client/flutter/android/FlutterAndroidDriver.java @@ -16,48 +16,121 @@ */ public class FlutterAndroidDriver extends AndroidDriver implements FlutterIntegrationTestDriver { + /** + * Creates a new instance based on command {@code executor} and {@code capabilities}. + * + * @param executor the command executor that sends the commands to the server + * @param capabilities the capabilities of the session to create + */ public FlutterAndroidDriver(AppiumCommandExecutor executor, Capabilities capabilities) { super(executor, capabilities); } + /** + * Creates a new instance based on the server address and {@code capabilities}. + * + * @param remoteAddress the address of the remote Appium server + * @param capabilities the capabilities of the session to create + */ public FlutterAndroidDriver(URL remoteAddress, Capabilities capabilities) { super(remoteAddress, capabilities); } + /** + * Creates a new instance based on the server address, a custom HTTP client factory + * and {@code capabilities}. + * + * @param remoteAddress the address of the remote Appium server + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public FlutterAndroidDriver(URL remoteAddress, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(remoteAddress, httpClientFactory, capabilities); } + /** + * Creates a new instance based on the local Appium service and {@code capabilities}. + * + * @param service the local Appium service to start and connect to + * @param capabilities the capabilities of the session to create + */ public FlutterAndroidDriver(AppiumDriverLocalService service, Capabilities capabilities) { super(service, capabilities); } + /** + * Creates a new instance based on the local Appium service, a custom HTTP client factory + * and {@code capabilities}. + * + * @param service the local Appium service to start and connect to + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public FlutterAndroidDriver( AppiumDriverLocalService service, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(service, httpClientFactory, capabilities); } + /** + * Creates a new instance based on the local Appium service builder and {@code capabilities}. + * + * @param builder the builder of the local Appium service to start and connect to + * @param capabilities the capabilities of the session to create + */ public FlutterAndroidDriver(AppiumServiceBuilder builder, Capabilities capabilities) { super(builder, capabilities); } + /** + * Creates a new instance based on the local Appium service builder, a custom HTTP client + * factory and {@code capabilities}. + * + * @param builder the builder of the local Appium service to start and connect to + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public FlutterAndroidDriver( AppiumServiceBuilder builder, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(builder, httpClientFactory, capabilities); } + /** + * Creates a new instance based on a custom HTTP client factory and {@code capabilities}. + * The default local Appium service is used. + * + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public FlutterAndroidDriver(HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(httpClientFactory, capabilities); } + /** + * Creates a new instance based on the HTTP client configuration and {@code capabilities}. + * + * @param appiumClientConfig the HTTP client configuration + * @param capabilities the capabilities of the session to create + */ public FlutterAndroidDriver(AppiumClientConfig appiumClientConfig, Capabilities capabilities) { super(appiumClientConfig, capabilities); } + /** + * Creates a new instance based on {@code capabilities} using the default local Appium service. + * + * @param capabilities the capabilities of the session to create + */ public FlutterAndroidDriver(Capabilities capabilities) { super(capabilities); } + /** + * Connects to a running session at the given address. + * This API is supposed to be used for debugging purposes only. + * + * @param remoteSessionAddress the address of the running session including the session identifier + * @param automationName the name of the target automation + */ public FlutterAndroidDriver(URL remoteSessionAddress, String automationName) { super(remoteSessionAddress, automationName); } diff --git a/src/main/java/io/appium/java_client/flutter/commands/DoubleClickParameter.java b/src/main/java/io/appium/java_client/flutter/commands/DoubleClickParameter.java index 859f26057..547e75053 100644 --- a/src/main/java/io/appium/java_client/flutter/commands/DoubleClickParameter.java +++ b/src/main/java/io/appium/java_client/flutter/commands/DoubleClickParameter.java @@ -12,10 +12,19 @@ import java.util.Map; import java.util.Optional; +/** + * The parameters of the Flutter double click gesture. + */ @Accessors(chain = true) @Setter @Getter public class DoubleClickParameter extends FlutterCommandParameter { + /** + * Creates a new instance. + */ + public DoubleClickParameter() { + } + private WebElement element; private Point offset; diff --git a/src/main/java/io/appium/java_client/flutter/commands/DragAndDropParameter.java b/src/main/java/io/appium/java_client/flutter/commands/DragAndDropParameter.java index 14bc04cbf..daaaa32d1 100644 --- a/src/main/java/io/appium/java_client/flutter/commands/DragAndDropParameter.java +++ b/src/main/java/io/appium/java_client/flutter/commands/DragAndDropParameter.java @@ -7,6 +7,9 @@ import java.util.Map; +/** + * The parameters of the Flutter drag and drop gesture. + */ @Accessors(chain = true) @Getter public class DragAndDropParameter extends FlutterCommandParameter { diff --git a/src/main/java/io/appium/java_client/flutter/commands/FlutterCommandParameter.java b/src/main/java/io/appium/java_client/flutter/commands/FlutterCommandParameter.java index ddd2d74f6..e26600296 100644 --- a/src/main/java/io/appium/java_client/flutter/commands/FlutterCommandParameter.java +++ b/src/main/java/io/appium/java_client/flutter/commands/FlutterCommandParameter.java @@ -5,7 +5,15 @@ import java.util.Map; +/** + * The base class of the parameters of the Flutter integration driver commands. + */ public abstract class FlutterCommandParameter { + /** + * Creates a new instance. + */ + public FlutterCommandParameter() { + } /** * Parses an Appium Flutter locator into a Map representation suitable for Flutter Integration Driver. @@ -21,5 +29,10 @@ protected static Map parseFlutterLocator(AppiumBy.FlutterBy by) ); } + /** + * Converts the parameters to the format expected by the Flutter integration driver. + * + * @return the command arguments + */ public abstract Map toJson(); } diff --git a/src/main/java/io/appium/java_client/flutter/commands/LongPressParameter.java b/src/main/java/io/appium/java_client/flutter/commands/LongPressParameter.java index 36f80772d..925c6d4df 100644 --- a/src/main/java/io/appium/java_client/flutter/commands/LongPressParameter.java +++ b/src/main/java/io/appium/java_client/flutter/commands/LongPressParameter.java @@ -12,10 +12,19 @@ import java.util.Map; import java.util.Optional; +/** + * The parameters of the Flutter long press gesture. + */ @Accessors(chain = true) @Setter @Getter public class LongPressParameter extends FlutterCommandParameter { + /** + * Creates a new instance. + */ + public LongPressParameter() { + } + private WebElement element; private Point offset; diff --git a/src/main/java/io/appium/java_client/flutter/commands/ScrollParameter.java b/src/main/java/io/appium/java_client/flutter/commands/ScrollParameter.java index d2a2674c7..031f85979 100644 --- a/src/main/java/io/appium/java_client/flutter/commands/ScrollParameter.java +++ b/src/main/java/io/appium/java_client/flutter/commands/ScrollParameter.java @@ -12,6 +12,9 @@ import java.util.Map; import java.util.Optional; +/** + * The parameters of the Flutter scroll command. + */ @Accessors(chain = true) @Getter @Setter @@ -70,11 +73,18 @@ public Map toJson() { return Collections.unmodifiableMap(params); } + /** + * The direction of the scroll. + */ @Getter public static enum ScrollDirection { + /** Scroll up. */ UP("up"), + /** Scroll to the right. */ RIGHT("right"), + /** Scroll down. */ DOWN("down"), + /** Scroll to the left. */ LEFT("left"); private final String direction; diff --git a/src/main/java/io/appium/java_client/flutter/commands/WaitParameter.java b/src/main/java/io/appium/java_client/flutter/commands/WaitParameter.java index d9f057032..84f8b69da 100644 --- a/src/main/java/io/appium/java_client/flutter/commands/WaitParameter.java +++ b/src/main/java/io/appium/java_client/flutter/commands/WaitParameter.java @@ -13,10 +13,19 @@ import java.util.Map; import java.util.Optional; +/** + * The parameters of the Flutter commands that wait for an element. + */ @Accessors(chain = true) @Getter @Setter public class WaitParameter extends FlutterCommandParameter { + /** + * Creates a new instance. + */ + public WaitParameter() { + } + private WebElement element; private AppiumBy.FlutterBy locator; private Duration timeout; diff --git a/src/main/java/io/appium/java_client/flutter/ios/FlutterIOSDriver.java b/src/main/java/io/appium/java_client/flutter/ios/FlutterIOSDriver.java index afaacbeaa..1d470ea4f 100644 --- a/src/main/java/io/appium/java_client/flutter/ios/FlutterIOSDriver.java +++ b/src/main/java/io/appium/java_client/flutter/ios/FlutterIOSDriver.java @@ -16,48 +16,120 @@ */ public class FlutterIOSDriver extends IOSDriver implements FlutterIntegrationTestDriver { + /** + * Creates a new instance based on command {@code executor} and {@code capabilities}. + * + * @param executor the command executor that sends the commands to the server + * @param capabilities the capabilities of the session to create + */ public FlutterIOSDriver(AppiumCommandExecutor executor, Capabilities capabilities) { super(executor, capabilities); } + /** + * Creates a new instance based on the server address and {@code capabilities}. + * + * @param remoteAddress the address of the remote Appium server + * @param capabilities the capabilities of the session to create + */ public FlutterIOSDriver(URL remoteAddress, Capabilities capabilities) { super(remoteAddress, capabilities); } + /** + * Creates a new instance based on the server address, a custom HTTP client factory + * and {@code capabilities}. + * + * @param remoteAddress the address of the remote Appium server + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public FlutterIOSDriver(URL remoteAddress, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(remoteAddress, httpClientFactory, capabilities); } + /** + * Creates a new instance based on the local Appium service and {@code capabilities}. + * + * @param service the local Appium service to start and connect to + * @param capabilities the capabilities of the session to create + */ public FlutterIOSDriver(AppiumDriverLocalService service, Capabilities capabilities) { super(service, capabilities); } + /** + * Creates a new instance based on the local Appium service, a custom HTTP client factory + * and {@code capabilities}. + * + * @param service the local Appium service to start and connect to + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public FlutterIOSDriver( AppiumDriverLocalService service, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(service, httpClientFactory, capabilities); } + /** + * Creates a new instance based on the local Appium service builder and {@code capabilities}. + * + * @param builder the builder of the local Appium service to start and connect to + * @param capabilities the capabilities of the session to create + */ public FlutterIOSDriver(AppiumServiceBuilder builder, Capabilities capabilities) { super(builder, capabilities); } + /** + * Creates a new instance based on the local Appium service builder, a custom HTTP client + * factory and {@code capabilities}. + * + * @param builder the builder of the local Appium service to start and connect to + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public FlutterIOSDriver( AppiumServiceBuilder builder, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(builder, httpClientFactory, capabilities); } + /** + * Creates a new instance based on a custom HTTP client factory and {@code capabilities}. + * The default local Appium service is used. + * + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public FlutterIOSDriver(HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(httpClientFactory, capabilities); } + /** + * Creates a new instance based on the HTTP client configuration and {@code capabilities}. + * + * @param appiumClientConfig the HTTP client configuration + * @param capabilities the capabilities of the session to create + */ public FlutterIOSDriver(AppiumClientConfig appiumClientConfig, Capabilities capabilities) { super(appiumClientConfig, capabilities); } + /** + * Connects to a running session at the given address. + * This API is supposed to be used for debugging purposes only. + * + * @param remoteSessionAddress the address of the running session including the session identifier + */ public FlutterIOSDriver(URL remoteSessionAddress) { super(remoteSessionAddress); } + /** + * Creates a new instance based on {@code capabilities} using the default local Appium service. + * + * @param capabilities the capabilities of the session to create + */ public FlutterIOSDriver(Capabilities capabilities) { super(capabilities); } diff --git a/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterElementWaitTimeoutOption.java b/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterElementWaitTimeoutOption.java index 794c955d4..00eae8112 100644 --- a/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterElementWaitTimeoutOption.java +++ b/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterElementWaitTimeoutOption.java @@ -8,8 +8,14 @@ import java.time.Duration; import java.util.Optional; +/** + * The interface for the options that set the Flutter element wait timeout. + * + * @param the type of the options class, returned for chaining + */ public interface SupportsFlutterElementWaitTimeoutOption> extends Capabilities, CanSetCapability { + /** The name of the Flutter element wait timeout capability. */ String FLUTTER_ELEMENT_WAIT_TIMEOUT_OPTION = "flutterElementWaitTimeout"; /** diff --git a/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterEnableMockCamera.java b/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterEnableMockCamera.java index baffaf96d..f43ea422f 100644 --- a/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterEnableMockCamera.java +++ b/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterEnableMockCamera.java @@ -8,8 +8,14 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * The interface for the options that enable the Flutter mock camera. + * + * @param the type of the options class, returned for chaining + */ public interface SupportsFlutterEnableMockCamera> extends Capabilities, CanSetCapability { + /** The name of the Flutter mock camera capability. */ String FLUTTER_ENABLE_MOCK_CAMERA_OPTION = "flutterEnableMockCamera"; /** diff --git a/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterServerLaunchTimeoutOption.java b/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterServerLaunchTimeoutOption.java index 52b51a8eb..d677b648f 100644 --- a/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterServerLaunchTimeoutOption.java +++ b/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterServerLaunchTimeoutOption.java @@ -8,8 +8,14 @@ import java.time.Duration; import java.util.Optional; +/** + * The interface for the options that set the Flutter server launch timeout. + * + * @param the type of the options class, returned for chaining + */ public interface SupportsFlutterServerLaunchTimeoutOption> extends Capabilities, CanSetCapability { + /** The name of the Flutter server launch timeout capability. */ String FLUTTER_SERVER_LAUNCH_TIMEOUT_OPTION = "flutterServerLaunchTimeout"; /** diff --git a/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterSystemPortOption.java b/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterSystemPortOption.java index 3f25ccec3..1f1fe96fa 100644 --- a/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterSystemPortOption.java +++ b/src/main/java/io/appium/java_client/flutter/options/SupportsFlutterSystemPortOption.java @@ -8,8 +8,14 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * The interface for the options that set the Flutter server port. + * + * @param the type of the options class, returned for chaining + */ public interface SupportsFlutterSystemPortOption> extends Capabilities, CanSetCapability { + /** The name of the Flutter server port capability. */ String FLUTTER_SYSTEM_PORT_OPTION = "flutterSystemPort"; /** diff --git a/src/main/java/io/appium/java_client/gecko/GeckoDriver.java b/src/main/java/io/appium/java_client/gecko/GeckoDriver.java index ab4d10d67..6cb97b7a4 100644 --- a/src/main/java/io/appium/java_client/gecko/GeckoDriver.java +++ b/src/main/java/io/appium/java_client/gecko/GeckoDriver.java @@ -40,36 +40,91 @@ public class GeckoDriver extends AppiumDriver { private static final String AUTOMATION_NAME = AutomationName.GECKO; + /** + * Creates a new instance based on command {@code executor} and {@code capabilities}. + * + * @param executor the command executor that sends the commands to the server + * @param capabilities the capabilities of the session to create + */ public GeckoDriver(AppiumCommandExecutor executor, Capabilities capabilities) { super(executor, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on the server address and {@code capabilities}. + * + * @param remoteAddress the address of the remote Appium server + * @param capabilities the capabilities of the session to create + */ public GeckoDriver(URL remoteAddress, Capabilities capabilities) { super(remoteAddress, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on the server address, a custom HTTP client factory + * and {@code capabilities}. + * + * @param remoteAddress the address of the remote Appium server + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public GeckoDriver(URL remoteAddress, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(remoteAddress, httpClientFactory, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on the local Appium service and {@code capabilities}. + * + * @param service the local Appium service to start and connect to + * @param capabilities the capabilities of the session to create + */ public GeckoDriver(AppiumDriverLocalService service, Capabilities capabilities) { super(service, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on the local Appium service, a custom HTTP client factory + * and {@code capabilities}. + * + * @param service the local Appium service to start and connect to + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public GeckoDriver(AppiumDriverLocalService service, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(service, httpClientFactory, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on the local Appium service builder and {@code capabilities}. + * + * @param builder the builder of the local Appium service to start and connect to + * @param capabilities the capabilities of the session to create + */ public GeckoDriver(AppiumServiceBuilder builder, Capabilities capabilities) { super(builder, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on the local Appium service builder, a custom HTTP client + * factory and {@code capabilities}. + * + * @param builder the builder of the local Appium service to start and connect to + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public GeckoDriver(AppiumServiceBuilder builder, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(builder, httpClientFactory, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on a custom HTTP client factory and {@code capabilities}. + * The default local Appium service is used. + * + * @param httpClientFactory the factory that creates the HTTP client + * @param capabilities the capabilities of the session to create + */ public GeckoDriver(HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(httpClientFactory, ensureAutomationName(capabilities, AUTOMATION_NAME)); } @@ -112,6 +167,11 @@ public GeckoDriver(AppiumClientConfig appiumClientConfig, Capabilities capabilit super(appiumClientConfig, ensureAutomationName(capabilities, AUTOMATION_NAME)); } + /** + * Creates a new instance based on {@code capabilities} using the default local Appium service. + * + * @param capabilities the capabilities of the session to create + */ public GeckoDriver(Capabilities capabilities) { super(ensureAutomationName(capabilities, AUTOMATION_NAME)); } diff --git a/src/main/java/io/appium/java_client/gecko/options/GeckoOptions.java b/src/main/java/io/appium/java_client/gecko/options/GeckoOptions.java index 2e1b4f1fd..e565b2c9f 100644 --- a/src/main/java/io/appium/java_client/gecko/options/GeckoOptions.java +++ b/src/main/java/io/appium/java_client/gecko/options/GeckoOptions.java @@ -49,15 +49,26 @@ public class GeckoOptions extends BaseOptions implements SupportsSetWindowRectOption, SupportsProxyOption, SupportsUnhandledPromptBehaviorOption { + /** Creates options with the default capabilities set. */ public GeckoOptions() { setCommonOptions(); } + /** + * Creates options from the given capabilities. + * + * @param source The capabilities to copy. + */ public GeckoOptions(Capabilities source) { super(source); setCommonOptions(); } + /** + * Creates options from the given capabilities map. + * + * @param source The capabilities to copy. + */ public GeckoOptions(Map source) { super(source); setCommonOptions(); diff --git a/src/main/java/io/appium/java_client/gecko/options/SupportsAndroidStorageOption.java b/src/main/java/io/appium/java_client/gecko/options/SupportsAndroidStorageOption.java index b85438271..cd83b8408 100644 --- a/src/main/java/io/appium/java_client/gecko/options/SupportsAndroidStorageOption.java +++ b/src/main/java/io/appium/java_client/gecko/options/SupportsAndroidStorageOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Support for the {@code androidStorage} capability: the Android storage location used by Geckodriver. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsAndroidStorageOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code androidStorage} capability. + */ String ANDROID_STORAGE_OPTION = "androidStorage"; /** diff --git a/src/main/java/io/appium/java_client/gecko/options/SupportsMarionettePortOption.java b/src/main/java/io/appium/java_client/gecko/options/SupportsMarionettePortOption.java index 75bbcbf60..d2364d55b 100644 --- a/src/main/java/io/appium/java_client/gecko/options/SupportsMarionettePortOption.java +++ b/src/main/java/io/appium/java_client/gecko/options/SupportsMarionettePortOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Support for the {@code marionettePort} capability: the Marionette port Geckodriver connects to. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsMarionettePortOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code marionettePort} capability. + */ String MARIONETTE_PORT_OPTION = "marionettePort"; /** diff --git a/src/main/java/io/appium/java_client/gecko/options/SupportsMozFirefoxOptionsOption.java b/src/main/java/io/appium/java_client/gecko/options/SupportsMozFirefoxOptionsOption.java index 16b2d9579..cd9595626 100644 --- a/src/main/java/io/appium/java_client/gecko/options/SupportsMozFirefoxOptionsOption.java +++ b/src/main/java/io/appium/java_client/gecko/options/SupportsMozFirefoxOptionsOption.java @@ -23,8 +23,16 @@ import java.util.Map; import java.util.Optional; +/** + * Support for the {@code moz:firefoxOptions} capability: Firefox-specific options passed to Geckodriver. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsMozFirefoxOptionsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code moz:firefoxOptions} capability. + */ String MOZ_FIREFOX_OPTIONS_OPTION = "moz:firefoxOptions"; /** diff --git a/src/main/java/io/appium/java_client/gecko/options/SupportsSystemPortOption.java b/src/main/java/io/appium/java_client/gecko/options/SupportsSystemPortOption.java index db89a31f4..daaac76d9 100644 --- a/src/main/java/io/appium/java_client/gecko/options/SupportsSystemPortOption.java +++ b/src/main/java/io/appium/java_client/gecko/options/SupportsSystemPortOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Support for the {@code systemPort} capability: the port the driver server listens on. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSystemPortOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code systemPort} capability. + */ String SYSTEM_PORT_OPTION = "systemPort"; /** diff --git a/src/main/java/io/appium/java_client/gecko/options/SupportsVerbosityOption.java b/src/main/java/io/appium/java_client/gecko/options/SupportsVerbosityOption.java index 32d37f61e..615a0aaca 100644 --- a/src/main/java/io/appium/java_client/gecko/options/SupportsVerbosityOption.java +++ b/src/main/java/io/appium/java_client/gecko/options/SupportsVerbosityOption.java @@ -24,8 +24,16 @@ import static java.util.Locale.ROOT; +/** + * Support for the {@code verbosity} capability: the Geckodriver log verbosity level. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsVerbosityOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code verbosity} capability. + */ String VERBOSITY_OPTION = "verbosity"; /** diff --git a/src/main/java/io/appium/java_client/gecko/options/Verbosity.java b/src/main/java/io/appium/java_client/gecko/options/Verbosity.java index f9a5c599e..009cf042e 100644 --- a/src/main/java/io/appium/java_client/gecko/options/Verbosity.java +++ b/src/main/java/io/appium/java_client/gecko/options/Verbosity.java @@ -16,6 +16,12 @@ package io.appium.java_client.gecko.options; +/** + * Geckodriver log verbosity levels. + */ public enum Verbosity { - DEBUG, TRACE + /** Debug level logging. */ + DEBUG, + /** Trace level logging. */ + TRACE } diff --git a/src/main/java/io/appium/java_client/http/BinaryMessage.java b/src/main/java/io/appium/java_client/http/BinaryMessage.java index 5be228d27..ae3421199 100644 --- a/src/main/java/io/appium/java_client/http/BinaryMessage.java +++ b/src/main/java/io/appium/java_client/http/BinaryMessage.java @@ -18,13 +18,26 @@ import static java.util.Objects.requireNonNull; +/** + * A binary WebSocket message. + */ public class BinaryMessage implements Message { private final byte[] data; + /** + * Creates a message from the given bytes. + * + * @param data the message payload (copied) + */ public BinaryMessage(byte[] data) { this.data = requireNonNull(data, "Data to use").clone(); } + /** + * Returns the message payload. + * + * @return the payload bytes + */ public byte[] data() { return data; } diff --git a/src/main/java/io/appium/java_client/http/ClientConfig.java b/src/main/java/io/appium/java_client/http/ClientConfig.java index 100ad8976..df9e0d1e4 100644 --- a/src/main/java/io/appium/java_client/http/ClientConfig.java +++ b/src/main/java/io/appium/java_client/http/ClientConfig.java @@ -37,10 +37,25 @@ public interface ClientConfig { @Nullable URI baseUri(); + /** + * The maximum time to wait for a connection to be established. + * + * @return the connection timeout + */ Duration connectionTimeout(); + /** + * The maximum time to wait for a response to be read. + * + * @return the read timeout + */ Duration readTimeout(); + /** + * The maximum time to wait for a WebSocket connection to be established. + * + * @return the WebSocket timeout + */ Duration wsTimeout(); /** @@ -50,12 +65,27 @@ public interface ClientConfig { */ Filter filter(); + /** + * The proxy to route requests through. + * + * @return the proxy or null if none is used + */ @Nullable Proxy proxy(); + /** + * The credentials to authenticate requests with. + * + * @return the credentials or null if none are configured + */ @Nullable Credentials credentials(); + /** + * The SSL context used for secure connections. + * + * @return the SSL context or null for the transport default + */ @Nullable SSLContext sslContext(); diff --git a/src/main/java/io/appium/java_client/http/CloseMessage.java b/src/main/java/io/appium/java_client/http/CloseMessage.java index 776838838..e221b7902 100644 --- a/src/main/java/io/appium/java_client/http/CloseMessage.java +++ b/src/main/java/io/appium/java_client/http/CloseMessage.java @@ -16,23 +16,47 @@ package io.appium.java_client.http; +/** + * A WebSocket close message. + */ public class CloseMessage implements Message { private final int code; private final String reason; + /** + * Creates a message with the given code and an empty reason. + * + * @param code the close status code + */ public CloseMessage(int code) { this(code, ""); } + /** + * Creates a message with the given code and reason. + * + * @param code the close status code + * @param reason the close reason, null is treated as empty + */ public CloseMessage(int code, String reason) { this.code = code; this.reason = reason == null ? "" : reason; } + /** + * Returns the close status code. + * + * @return the status code + */ public int code() { return code; } + /** + * Returns the close reason. + * + * @return the reason, never null + */ public String reason() { return reason; } diff --git a/src/main/java/io/appium/java_client/http/ConnectionFailedException.java b/src/main/java/io/appium/java_client/http/ConnectionFailedException.java index 325814bd7..dc010eeb5 100644 --- a/src/main/java/io/appium/java_client/http/ConnectionFailedException.java +++ b/src/main/java/io/appium/java_client/http/ConnectionFailedException.java @@ -18,11 +18,25 @@ import org.openqa.selenium.WebDriverException; +/** + * Thrown if a connection to the server could not be established. + */ public class ConnectionFailedException extends WebDriverException { + /** + * Creates an exception with the given message. + * + * @param message the detail message + */ public ConnectionFailedException(String message) { super(message); } + /** + * Creates an exception with the given message and cause. + * + * @param message the detail message + * @param cause the cause + */ public ConnectionFailedException(String message, Throwable cause) { super(message, cause); } diff --git a/src/main/java/io/appium/java_client/http/Contents.java b/src/main/java/io/appium/java_client/http/Contents.java index 6133b3cfb..625a03991 100644 --- a/src/main/java/io/appium/java_client/http/Contents.java +++ b/src/main/java/io/appium/java_client/http/Contents.java @@ -45,8 +45,20 @@ public interface Supplier extends java.util.function.Supplier, Auto @Override void close() throws IOException; + /** + * Reads the whole body as a string. + * + * @param charset the charset to decode the body with + * @return the body as string + */ String contentAsString(Charset charset); + /** + * Opens a reader over the body. + * + * @param charset the charset to decode the body with + * @return the reader + */ default Reader reader(Charset charset) { return new InputStreamReader(get(), charset); } @@ -55,10 +67,21 @@ default Reader reader(Charset charset) { private Contents() { } + /** + * Creates an empty body. + * + * @return the empty body + */ public static Supplier empty() { return bytes(new byte[0]); } + /** + * Creates a body from the given bytes. + * + * @param bytes the body bytes (copied) + * @return the body + */ public static Supplier bytes(byte[] bytes) { return new BytesSupplier(bytes); } @@ -77,14 +100,33 @@ public static byte[] bytes(Supplier supplier) { } } + /** + * Creates a body from the given string encoded as UTF-8. + * + * @param value the body text + * @return the body + */ public static Supplier utf8String(CharSequence value) { return string(value, UTF_8); } + /** + * Reads the whole body as a UTF-8 string. + * + * @param supplier the body + * @return the body as string + */ public static String utf8String(Supplier supplier) { return supplier.contentAsString(UTF_8); } + /** + * Creates a body from the given string. + * + * @param value the body text + * @param charset the charset to encode the text with + * @return the body + */ public static Supplier string(CharSequence value, Charset charset) { return bytes(value.toString().getBytes(charset)); } @@ -99,6 +141,13 @@ public static String string(HttpMessage message) { return message.contentAsString(); } + /** + * Creates a body backed by a stream, which can be read only once. + * + * @param stream the body stream + * @param length the body length in bytes or -1 if unknown + * @return the body + */ public static Supplier fromStream(InputStream stream, long length) { return new StreamSupplier(stream, length); } diff --git a/src/main/java/io/appium/java_client/http/Filter.java b/src/main/java/io/appium/java_client/http/Filter.java index 8b2ace05f..8c97c8ce0 100644 --- a/src/main/java/io/appium/java_client/http/Filter.java +++ b/src/main/java/io/appium/java_client/http/Filter.java @@ -36,6 +36,12 @@ default Filter andThen(Filter next) { return req -> apply(next.apply(req)); } + /** + * Applies this filter to the final handler. + * + * @param end the handler to run after this filter + * @return the resulting handler + */ default HttpHandler andFinally(HttpHandler end) { requireNonNull(end, "HTTP handler"); return request -> Filter.this.apply(end).execute(request); diff --git a/src/main/java/io/appium/java_client/http/HttpClient.java b/src/main/java/io/appium/java_client/http/HttpClient.java index 4e47f0c42..30c0b5c16 100644 --- a/src/main/java/io/appium/java_client/http/HttpClient.java +++ b/src/main/java/io/appium/java_client/http/HttpClient.java @@ -26,8 +26,21 @@ * the filter of the {@link ClientConfig} they were created with. */ public interface HttpClient extends Closeable, HttpHandler { + /** + * Opens a WebSocket connection. + * + * @param request the request describing the WebSocket endpoint + * @param listener the listener to receive the socket events + * @return the opened socket + */ WebSocket openSocket(HttpRequest request, WebSocket.Listener listener); + /** + * Executes the request asynchronously. + * + * @param req the request to send + * @return the future completed with the response + */ default CompletableFuture executeAsync(HttpRequest req) { return CompletableFuture.supplyAsync(() -> execute(req)); } @@ -49,6 +62,12 @@ static Factory createDefault() { return new JdkHttpClient.Factory(); } + /** + * Creates a client with the given settings. + * + * @param config the client settings + * @return the new client + */ HttpClient createClient(ClientConfig config); } } diff --git a/src/main/java/io/appium/java_client/http/HttpHandler.java b/src/main/java/io/appium/java_client/http/HttpHandler.java index 6a760e076..cff87cd3b 100644 --- a/src/main/java/io/appium/java_client/http/HttpHandler.java +++ b/src/main/java/io/appium/java_client/http/HttpHandler.java @@ -18,10 +18,26 @@ import java.io.UncheckedIOException; +/** + * Executes HTTP requests. + */ @FunctionalInterface public interface HttpHandler { + /** + * Executes the request. + * + * @param req the request to send + * @return the response + * @throws UncheckedIOException if an I/O error occurs + */ HttpResponse execute(HttpRequest req) throws UncheckedIOException; + /** + * Wraps this handler with the given filter. + * + * @param filter the filter to apply + * @return the filtered handler + */ default HttpHandler with(Filter filter) { return filter.andFinally(this); } diff --git a/src/main/java/io/appium/java_client/http/HttpHeader.java b/src/main/java/io/appium/java_client/http/HttpHeader.java index a068e43ab..c46a710ce 100644 --- a/src/main/java/io/appium/java_client/http/HttpHeader.java +++ b/src/main/java/io/appium/java_client/http/HttpHeader.java @@ -16,13 +16,37 @@ package io.appium.java_client.http; +/** + * Well-known HTTP header names. + */ public enum HttpHeader { + /** + * The {@code cache-control} header. + */ CacheControl("cache-control"), + /** + * The {@code content-length} header. + */ ContentLength("content-length"), + /** + * The {@code content-type} header. + */ ContentType("content-type"), + /** + * The {@code expires} header. + */ Expires("expires"), + /** + * The {@code host} header. + */ Host("host"), + /** + * The {@code user-agent} header. + */ UserAgent("user-agent"), + /** + * The {@code x-forwarded-for} header. + */ XForwardedFor("x-forwarded-for"); private final String name; @@ -31,6 +55,11 @@ public enum HttpHeader { this.name = name; } + /** + * Returns the lower-case header name. + * + * @return the header name + */ public String getName() { return name; } diff --git a/src/main/java/io/appium/java_client/http/HttpMessage.java b/src/main/java/io/appium/java_client/http/HttpMessage.java index ab7f432f8..6a15402a3 100644 --- a/src/main/java/io/appium/java_client/http/HttpMessage.java +++ b/src/main/java/io/appium/java_client/http/HttpMessage.java @@ -38,46 +38,107 @@ * @param the concrete message type */ public abstract class HttpMessage> { + /** + * Creates a new instance. + */ + public HttpMessage() { + } + private final Map> headers = new HashMap<>(); private Contents.Supplier content = Contents.empty(); + /** + * Calls the action for every header value. + * + * @param action the action to call with the header name and value + */ public void forEachHeader(BiConsumer action) { headers.forEach((name, values) -> values.forEach(value -> action.accept(name, value))); } + /** + * Returns the names of all headers. + * + * @return the lower-case header names + */ public Iterable getHeaderNames() { return Collections.unmodifiableCollection(headers.keySet()); } + /** + * Returns all values of the header. + * + * @param name the header name, case-insensitive + * @return the header values, empty if the header is not set + */ public Iterable getHeaders(String name) { return Collections.unmodifiableCollection(headers.getOrDefault(name.toLowerCase(Locale.ENGLISH), emptyList())); } + /** + * Returns the first value of the header. + * + * @param name the header + * @return the first value or null if the header is not set + */ @Nullable public String getHeader(HttpHeader name) { return getHeader(name.getName()); } + /** + * Returns the first value of the header. + * + * @param name the header name, case-insensitive + * @return the first value or null if the header is not set + */ @Nullable public String getHeader(String name) { List values = headers.getOrDefault(name.toLowerCase(Locale.ENGLISH), emptyList()); return values.isEmpty() ? null : values.get(0); } + /** + * Replaces all values of the header with the given one. + * + * @param name the header name, case-insensitive + * @param value the header value + * @return this message + */ public M setHeader(String name, String value) { String lowerCaseName = name.toLowerCase(Locale.ENGLISH); return removeHeader(lowerCaseName).addHeader(lowerCaseName, value); } + /** + * Adds a value to the header. + * + * @param name the header + * @param value the header value + * @return this message + */ public M addHeader(HttpHeader name, String value) { return addHeader(name.getName(), value); } + /** + * Adds a value to the header. + * + * @param name the header name, case-insensitive + * @param value the header value + * @return this message + */ public M addHeader(String name, String value) { headers.computeIfAbsent(name.toLowerCase(Locale.ENGLISH), n -> new ArrayList<>()).add(value); return self(); } + /** + * Removes all values of the header. + * + * @param name the header name, case-insensitive + * @return this message + */ public M removeHeader(String name) { headers.remove(name.toLowerCase(Locale.ENGLISH)); return self(); @@ -93,6 +154,11 @@ public Long getContentLength() { return value == null ? -1L : Long.parseLong(value); } + /** + * The Content-Type header value. + * + * @return the header value or null if it is not set + */ @Nullable public String getContentType() { return getHeader(HttpHeader.ContentType); @@ -121,15 +187,31 @@ public Charset getContentEncoding() { return UTF_8; } + /** + * Sets the message body. + * + * @param supplier the body + * @return this message + */ public M setContent(Contents.Supplier supplier) { this.content = requireNonNull(supplier, "Supplier"); return self(); } + /** + * Returns the message body. + * + * @return the body + */ public Contents.Supplier getContent() { return content; } + /** + * Reads the body as a string using the declared encoding. + * + * @return the body as string + */ public String contentAsString() { return getContent().contentAsString(getContentEncoding()); } diff --git a/src/main/java/io/appium/java_client/http/HttpMethod.java b/src/main/java/io/appium/java_client/http/HttpMethod.java index d073d0ac2..66fc1c90e 100644 --- a/src/main/java/io/appium/java_client/http/HttpMethod.java +++ b/src/main/java/io/appium/java_client/http/HttpMethod.java @@ -18,15 +18,27 @@ import java.util.Locale; +/** + * Supported HTTP methods. + */ public enum HttpMethod { + /** The DELETE method. */ DELETE, + /** The GET method. */ GET, + /** The POST method. */ POST, + /** The PUT method. */ PUT, + /** The OPTIONS method. */ OPTIONS, + /** The PATCH method. */ PATCH, + /** The HEAD method. */ HEAD, + /** The CONNECT method. */ CONNECT, + /** The TRACE method. */ TRACE; /** diff --git a/src/main/java/io/appium/java_client/http/HttpRequest.java b/src/main/java/io/appium/java_client/http/HttpRequest.java index 4a5046fb7..8dcd466e1 100644 --- a/src/main/java/io/appium/java_client/http/HttpRequest.java +++ b/src/main/java/io/appium/java_client/http/HttpRequest.java @@ -26,6 +26,9 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.stream.Collectors.joining; +/** + * An HTTP request. + */ public class HttpRequest extends HttpMessage { private final HttpMethod method; private final String uri; @@ -42,18 +45,41 @@ public HttpRequest(HttpMethod method, String uri) { this.uri = uri; } + /** + * Creates a request. + * + * @param method the HTTP method + * @param uri the absolute request URI + */ public HttpRequest(HttpMethod method, URI uri) { this(method, uri.toString()); } + /** + * Returns the request URI. + * + * @return a path relative to the client base URI, or an absolute URI + */ public String getUri() { return uri; } + /** + * Returns the HTTP method. + * + * @return the method + */ public HttpMethod getMethod() { return method; } + /** + * Adds a query parameter. Repeated names are allowed. + * + * @param name the parameter name + * @param value the parameter value + * @return this request + */ public HttpRequest addQueryParameter(String name, String value) { queryParameters.computeIfAbsent(name, n -> new ArrayList<>()).add(value); return this; diff --git a/src/main/java/io/appium/java_client/http/HttpResponse.java b/src/main/java/io/appium/java_client/http/HttpResponse.java index 2b94533fc..cb338d2cf 100644 --- a/src/main/java/io/appium/java_client/http/HttpResponse.java +++ b/src/main/java/io/appium/java_client/http/HttpResponse.java @@ -18,17 +18,42 @@ import static java.net.HttpURLConnection.HTTP_OK; +/** + * An HTTP response. + */ public class HttpResponse extends HttpMessage { + /** + * Creates a new instance. + */ + public HttpResponse() { + } + private int status = HTTP_OK; + /** + * Checks whether the status is in the 2xx range. + * + * @return true if the response is successful + */ public boolean isSuccessful() { return status >= HTTP_OK && status < 300; } + /** + * Returns the HTTP status code. + * + * @return the status code + */ public int getStatus() { return status; } + /** + * Sets the HTTP status code. + * + * @param status the status code + * @return this response + */ public HttpResponse setStatus(int status) { this.status = status; return this; diff --git a/src/main/java/io/appium/java_client/http/TextMessage.java b/src/main/java/io/appium/java_client/http/TextMessage.java index 147941e3f..4f0eb925a 100644 --- a/src/main/java/io/appium/java_client/http/TextMessage.java +++ b/src/main/java/io/appium/java_client/http/TextMessage.java @@ -18,13 +18,26 @@ import static java.util.Objects.requireNonNull; +/** + * A text WebSocket message. + */ public class TextMessage implements Message { private final String text; + /** + * Creates a message with the given text. + * + * @param text the message text + */ public TextMessage(CharSequence text) { this.text = requireNonNull(text, "Message text").toString(); } + /** + * Returns the message text. + * + * @return the text + */ public String text() { return text; } diff --git a/src/main/java/io/appium/java_client/http/WebSocket.java b/src/main/java/io/appium/java_client/http/WebSocket.java index 59cc9455f..9662f7dc2 100644 --- a/src/main/java/io/appium/java_client/http/WebSocket.java +++ b/src/main/java/io/appium/java_client/http/WebSocket.java @@ -22,15 +22,37 @@ import java.io.Closeable; import java.util.function.Consumer; +/** + * A WebSocket connection. + */ public interface WebSocket extends Closeable { + /** The logger shared by the WebSocket implementations. */ Logger LOG = LoggerFactory.getLogger(WebSocket.class); + /** + * Sends a message. + * + * @param message the message to send + * @return this socket + */ WebSocket send(Message message); + /** + * Sends a text message. + * + * @param data the text to send + * @return this socket + */ default WebSocket sendText(CharSequence data) { return send(new TextMessage(data)); } + /** + * Sends a binary message. + * + * @param data the bytes to send + * @return this socket + */ default WebSocket sendBinary(byte[] data) { return send(new BinaryMessage(data)); } @@ -53,12 +75,28 @@ default void accept(Message message) { } } + /** + * Handles a binary message. + * + * @param data the received bytes + */ default void onBinary(byte[] data) { } + /** + * Handles the connection closure. + * + * @param code the close status code + * @param reason the close reason + */ default void onClose(int code, String reason) { } + /** + * Handles a text message. + * + * @param data the received text + */ default void onText(CharSequence data) { } diff --git a/src/main/java/io/appium/java_client/imagecomparison/BaseComparisonOptions.java b/src/main/java/io/appium/java_client/imagecomparison/BaseComparisonOptions.java index bd20f884a..443f5dd1f 100644 --- a/src/main/java/io/appium/java_client/imagecomparison/BaseComparisonOptions.java +++ b/src/main/java/io/appium/java_client/imagecomparison/BaseComparisonOptions.java @@ -22,7 +22,18 @@ import static java.util.Optional.ofNullable; +/** + * Base class for the image comparison options. + * + * @param the actual options type, used for chaining + */ public abstract class BaseComparisonOptions> { + /** + * Creates a new instance. + */ + public BaseComparisonOptions() { + } + private Boolean visualize; /** diff --git a/src/main/java/io/appium/java_client/imagecomparison/ComparisonMode.java b/src/main/java/io/appium/java_client/imagecomparison/ComparisonMode.java index c2e20f96f..b6de703ba 100644 --- a/src/main/java/io/appium/java_client/imagecomparison/ComparisonMode.java +++ b/src/main/java/io/appium/java_client/imagecomparison/ComparisonMode.java @@ -16,8 +16,16 @@ package io.appium.java_client.imagecomparison; +/** + * Image comparison modes supported by the server. + */ public enum ComparisonMode { - MATCH_FEATURES("matchFeatures"), GET_SIMILARITY("getSimilarity"), MATCH_TEMPLATE("matchTemplate"); + /** Matches features of the images. */ + MATCH_FEATURES("matchFeatures"), + /** Calculates the similarity score of the images. */ + GET_SIMILARITY("getSimilarity"), + /** Finds the occurrence of a partial image in the full one. */ + MATCH_TEMPLATE("matchTemplate"); private final String name; diff --git a/src/main/java/io/appium/java_client/imagecomparison/ComparisonResult.java b/src/main/java/io/appium/java_client/imagecomparison/ComparisonResult.java index e73be71c8..c832895ef 100644 --- a/src/main/java/io/appium/java_client/imagecomparison/ComparisonResult.java +++ b/src/main/java/io/appium/java_client/imagecomparison/ComparisonResult.java @@ -27,15 +27,29 @@ import java.util.Base64; import java.util.Map; +/** + * Base class for the image comparison results. + */ public abstract class ComparisonResult { private static final String VISUALIZATION = "visualization"; + /** The raw command result returned by the server. */ protected final Object commandResult; + /** + * Creates a result wrapper. + * + * @param commandResult the raw command result returned by the server + */ public ComparisonResult(Object commandResult) { this.commandResult = commandResult; } + /** + * Returns the raw command result as a map. + * + * @return the result mapping + */ protected Map getResultAsMap() { //noinspection unchecked return (Map) commandResult; diff --git a/src/main/java/io/appium/java_client/imagecomparison/FeatureDetector.java b/src/main/java/io/appium/java_client/imagecomparison/FeatureDetector.java index 2e9f50a5d..67244cc31 100644 --- a/src/main/java/io/appium/java_client/imagecomparison/FeatureDetector.java +++ b/src/main/java/io/appium/java_client/imagecomparison/FeatureDetector.java @@ -16,6 +16,26 @@ package io.appium.java_client.imagecomparison; +/** + * Feature detectors available for the features matching. + */ public enum FeatureDetector { - AKAZE, AGAST, BRISK, FAST, GFTT, KAZE, MSER, SIFT, ORB + /** The AKAZE detector. */ + AKAZE, + /** The AGAST detector. */ + AGAST, + /** The BRISK detector. */ + BRISK, + /** The FAST detector. */ + FAST, + /** The GFTT detector. */ + GFTT, + /** The KAZE detector. */ + KAZE, + /** The MSER detector. */ + MSER, + /** The SIFT detector. */ + SIFT, + /** The ORB detector. */ + ORB } diff --git a/src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingOptions.java b/src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingOptions.java index ecb3d0f79..d4c712328 100644 --- a/src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingOptions.java +++ b/src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingOptions.java @@ -23,7 +23,16 @@ import static io.appium.java_client.internal.Preconditions.checkArgument; import static java.util.Optional.ofNullable; +/** + * Options of the features matching. + */ public class FeaturesMatchingOptions extends BaseComparisonOptions { + /** + * Creates a new instance. + */ + public FeaturesMatchingOptions() { + } + private String detectorName; private String matchFunc; private Integer goodMatchesFactor; diff --git a/src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingResult.java b/src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingResult.java index 0a983e50a..853e9807d 100644 --- a/src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingResult.java +++ b/src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingResult.java @@ -23,6 +23,9 @@ import java.util.Map; import java.util.stream.Collectors; +/** + * The result of the features matching. + */ public class FeaturesMatchingResult extends ComparisonResult { private static final String COUNT = "count"; private static final String TOTAL_COUNT = "totalCount"; @@ -31,6 +34,11 @@ public class FeaturesMatchingResult extends ComparisonResult { private static final String POINTS2 = "points2"; private static final String RECT2 = "rect2"; + /** + * Creates a result wrapper. + * + * @param input the raw command result returned by the server + */ public FeaturesMatchingResult(Map input) { super(input); } diff --git a/src/main/java/io/appium/java_client/imagecomparison/MatchingFunction.java b/src/main/java/io/appium/java_client/imagecomparison/MatchingFunction.java index 1fe71738e..91fa064a7 100644 --- a/src/main/java/io/appium/java_client/imagecomparison/MatchingFunction.java +++ b/src/main/java/io/appium/java_client/imagecomparison/MatchingFunction.java @@ -16,9 +16,21 @@ package io.appium.java_client.imagecomparison; +/** + * Matching functions available for the features matching. + */ public enum MatchingFunction { - FLANN_BASED("FlannBased"), BRUTE_FORCE("BruteForce"), BRUTE_FORCE1("BruteForceL1"), - BRUTE_FORCE_HAMMING("BruteForceHamming"), BRUTE_FORCE_HAMMING_LUT("BruteForceHammingLut"), + /** The FLANN-based matcher. */ + FLANN_BASED("FlannBased"), + /** The brute-force matcher. */ + BRUTE_FORCE("BruteForce"), + /** The brute-force matcher using the L1 norm. */ + BRUTE_FORCE1("BruteForceL1"), + /** The brute-force matcher using the Hamming distance. */ + BRUTE_FORCE_HAMMING("BruteForceHamming"), + /** The brute-force matcher using the Hamming distance with a lookup table. */ + BRUTE_FORCE_HAMMING_LUT("BruteForceHammingLut"), + /** The brute-force matcher using the squared L2 norm. */ BRUTE_FORCE_SL2("BruteForceSL2"); private final String name; diff --git a/src/main/java/io/appium/java_client/imagecomparison/OccurrenceMatchingOptions.java b/src/main/java/io/appium/java_client/imagecomparison/OccurrenceMatchingOptions.java index 314a237dc..2f250becc 100644 --- a/src/main/java/io/appium/java_client/imagecomparison/OccurrenceMatchingOptions.java +++ b/src/main/java/io/appium/java_client/imagecomparison/OccurrenceMatchingOptions.java @@ -22,7 +22,16 @@ import static java.util.Optional.ofNullable; +/** + * Options of the partial image occurrence matching. + */ public class OccurrenceMatchingOptions extends BaseComparisonOptions { + /** + * Creates a new instance. + */ + public OccurrenceMatchingOptions() { + } + private Double threshold; private Boolean multiple; private Integer matchNeighbourThreshold; diff --git a/src/main/java/io/appium/java_client/imagecomparison/OccurrenceMatchingResult.java b/src/main/java/io/appium/java_client/imagecomparison/OccurrenceMatchingResult.java index 7b0266f23..060f43832 100644 --- a/src/main/java/io/appium/java_client/imagecomparison/OccurrenceMatchingResult.java +++ b/src/main/java/io/appium/java_client/imagecomparison/OccurrenceMatchingResult.java @@ -24,12 +24,20 @@ import java.util.Map; import java.util.stream.Collectors; +/** + * The result of the partial image occurrence matching. + */ public class OccurrenceMatchingResult extends ComparisonResult { private static final String RECT = "rect"; private static final String SCORE = "score"; private final boolean hasMultiple; + /** + * Creates a result wrapper. + * + * @param input the raw command result, either a single match map or a list of matches + */ public OccurrenceMatchingResult(Object input) { super(input); hasMultiple = input instanceof List; diff --git a/src/main/java/io/appium/java_client/imagecomparison/SimilarityMatchingOptions.java b/src/main/java/io/appium/java_client/imagecomparison/SimilarityMatchingOptions.java index 69a7a5f7e..388a42472 100644 --- a/src/main/java/io/appium/java_client/imagecomparison/SimilarityMatchingOptions.java +++ b/src/main/java/io/appium/java_client/imagecomparison/SimilarityMatchingOptions.java @@ -16,5 +16,14 @@ package io.appium.java_client.imagecomparison; +/** + * Options of the images similarity calculation. + */ public class SimilarityMatchingOptions extends BaseComparisonOptions { + /** + * Creates a new instance. + */ + public SimilarityMatchingOptions() { + } + } diff --git a/src/main/java/io/appium/java_client/imagecomparison/SimilarityMatchingResult.java b/src/main/java/io/appium/java_client/imagecomparison/SimilarityMatchingResult.java index 0806e7b53..0a03f5338 100644 --- a/src/main/java/io/appium/java_client/imagecomparison/SimilarityMatchingResult.java +++ b/src/main/java/io/appium/java_client/imagecomparison/SimilarityMatchingResult.java @@ -18,9 +18,17 @@ import java.util.Map; +/** + * The result of the images similarity calculation. + */ public class SimilarityMatchingResult extends ComparisonResult { private static final String SCORE = "score"; + /** + * Creates a result wrapper. + * + * @param input the raw command result returned by the server + */ public SimilarityMatchingResult(Map input) { super(input); } diff --git a/src/main/java/io/appium/java_client/internal/CapabilityHelpers.java b/src/main/java/io/appium/java_client/internal/CapabilityHelpers.java index 345e60a9c..2dccc91f1 100644 --- a/src/main/java/io/appium/java_client/internal/CapabilityHelpers.java +++ b/src/main/java/io/appium/java_client/internal/CapabilityHelpers.java @@ -26,7 +26,11 @@ import java.util.List; import java.util.function.Function; +/** + * Helpers for reading and converting capability values. + */ public class CapabilityHelpers { + /** The vendor prefix of Appium-specific capability names. */ public static final String APPIUM_PREFIX = "appium:"; private CapabilityHelpers() { diff --git a/src/main/java/io/appium/java_client/internal/Config.java b/src/main/java/io/appium/java_client/internal/Config.java index 4413f28ab..beb42a593 100644 --- a/src/main/java/io/appium/java_client/internal/Config.java +++ b/src/main/java/io/appium/java_client/internal/Config.java @@ -8,6 +8,9 @@ import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; +/** + * Provides access to the client properties. + */ public class Config { private static Config mainInstance = null; private static final String MAIN_CONFIG = "main.properties"; diff --git a/src/main/java/io/appium/java_client/internal/SessionHelpers.java b/src/main/java/io/appium/java_client/internal/SessionHelpers.java index 51371dbd1..8e47112a7 100644 --- a/src/main/java/io/appium/java_client/internal/SessionHelpers.java +++ b/src/main/java/io/appium/java_client/internal/SessionHelpers.java @@ -25,15 +25,30 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +/** + * Helpers for working with remote session addresses. + */ public class SessionHelpers { private static final Pattern SESSION = Pattern.compile("/session/([^/]+)"); private SessionHelpers() { } + /** The server URL and the session identifier of a remote session. */ @Data public static class SessionAddress { private final URL serverUrl; private final String id; + + /** + * Creates a new session address. + * + * @param serverUrl the URL of the server hosting the session + * @param id the session identifier + */ + public SessionAddress(URL serverUrl, String id) { + this.serverUrl = serverUrl; + this.id = id; + } } /** diff --git a/src/main/java/io/appium/java_client/internal/Strings.java b/src/main/java/io/appium/java_client/internal/Strings.java index 33e9edd6a..4cee7b0ae 100644 --- a/src/main/java/io/appium/java_client/internal/Strings.java +++ b/src/main/java/io/appium/java_client/internal/Strings.java @@ -18,10 +18,19 @@ import org.jspecify.annotations.Nullable; +/** + * String helpers. + */ public final class Strings { private Strings() { } + /** + * Checks whether the string is null or empty. + * + * @param string the string to check + * @return true if the string is null or empty + */ public static boolean isNullOrEmpty(@Nullable String string) { return string == null || string.isEmpty(); } diff --git a/src/main/java/io/appium/java_client/internal/filters/AppiumIdempotencyFilter.java b/src/main/java/io/appium/java_client/internal/filters/AppiumIdempotencyFilter.java index 5112e1bee..198c41ade 100644 --- a/src/main/java/io/appium/java_client/internal/filters/AppiumIdempotencyFilter.java +++ b/src/main/java/io/appium/java_client/internal/filters/AppiumIdempotencyFilter.java @@ -23,7 +23,16 @@ import static java.util.Locale.ROOT; import static java.util.UUID.randomUUID; +/** + * Adds the idempotency key header to the session creation requests. + */ public class AppiumIdempotencyFilter implements Filter { + /** + * Creates a new instance. + */ + public AppiumIdempotencyFilter() { + } + // https://github.com/appium/appium-base-driver/pull/400 private static final String IDEMPOTENCY_KEY_HEADER = "X-Idempotency-Key"; diff --git a/src/main/java/io/appium/java_client/internal/filters/AppiumUserAgentFilter.java b/src/main/java/io/appium/java_client/internal/filters/AppiumUserAgentFilter.java index 6a642ef45..b176affbc 100644 --- a/src/main/java/io/appium/java_client/internal/filters/AppiumUserAgentFilter.java +++ b/src/main/java/io/appium/java_client/internal/filters/AppiumUserAgentFilter.java @@ -32,7 +32,13 @@ */ public class AppiumUserAgentFilter implements Filter { + /** + * Creates a new instance. + */ + public AppiumUserAgentFilter() { + } + /** The config key of the client version. */ public static final String VERSION_KEY = "appiumClient.version"; private static final String USER_AGENT_PREFIX = "appium/"; diff --git a/src/main/java/io/appium/java_client/internal/filters/RetryRequestFilter.java b/src/main/java/io/appium/java_client/internal/filters/RetryRequestFilter.java index 2757fa203..49bc160c4 100644 --- a/src/main/java/io/appium/java_client/internal/filters/RetryRequestFilter.java +++ b/src/main/java/io/appium/java_client/internal/filters/RetryRequestFilter.java @@ -32,6 +32,12 @@ * Adapted from Selenium's {@code RetryRequest} (Apache License 2.0). */ public class RetryRequestFilter implements Filter { + /** + * Creates a new instance. + */ + public RetryRequestFilter() { + } + private static final Logger LOG = LoggerFactory.getLogger(RetryRequestFilter.class); private static final int RETRIES_ON_CONNECTION_FAILURE = 3; private static final int RETRIES_ON_SERVER_ERROR = 2; diff --git a/src/main/java/io/appium/java_client/internal/http/ConnectionException.java b/src/main/java/io/appium/java_client/internal/http/ConnectionException.java index c8b86a087..77dbd0a38 100644 --- a/src/main/java/io/appium/java_client/internal/http/ConnectionException.java +++ b/src/main/java/io/appium/java_client/internal/http/ConnectionException.java @@ -23,13 +23,26 @@ * Thrown if a connection to the server cannot be established. */ public class ConnectionException extends UncheckedIOException { + /** The URI the connection was attempted to. */ private final String uri; + /** + * Creates an exception. + * + * @param message the detail message + * @param uri the URI the connection was attempted to + * @param cause the cause + */ public ConnectionException(String message, String uri, ConnectException cause) { super(message, cause); this.uri = uri; } + /** + * Returns the URI the connection was attempted to. + * + * @return the URI + */ public String uri() { return uri; } diff --git a/src/main/java/io/appium/java_client/internal/http/JdkHttpClient.java b/src/main/java/io/appium/java_client/internal/http/JdkHttpClient.java index 8cb550a77..4ed776177 100644 --- a/src/main/java/io/appium/java_client/internal/http/JdkHttpClient.java +++ b/src/main/java/io/appium/java_client/internal/http/JdkHttpClient.java @@ -356,6 +356,12 @@ public void close() { * Creates {@link JdkHttpClient} instances. */ public static class Factory implements HttpClient.Factory { + /** + * Creates a new instance. + */ + public Factory() { + } + @Override public HttpClient createClient(ClientConfig config) { return new JdkHttpClient(Objects.requireNonNull(config, "Client config must be set")); diff --git a/src/main/java/io/appium/java_client/internal/json/WireJson.java b/src/main/java/io/appium/java_client/internal/json/WireJson.java index 2ea2c5e76..f9eb62261 100644 --- a/src/main/java/io/appium/java_client/internal/json/WireJson.java +++ b/src/main/java/io/appium/java_client/internal/json/WireJson.java @@ -272,10 +272,21 @@ private static Method findMethod(@Nullable Class type, String name) { * Thrown if a JSON document cannot be read or written. */ public static class WireJsonException extends WebDriverException { + /** + * Creates an exception with the given message. + * + * @param message the detail message + */ public WireJsonException(String message) { super(message); } + /** + * Creates an exception with the given message and cause. + * + * @param message the detail message + * @param cause the cause + */ public WireJsonException(String message, Throwable cause) { super(message, cause); } diff --git a/src/main/java/io/appium/java_client/internal/process/ExecutableFinder.java b/src/main/java/io/appium/java_client/internal/process/ExecutableFinder.java index 6cb2b9a4d..048eaa249 100644 --- a/src/main/java/io/appium/java_client/internal/process/ExecutableFinder.java +++ b/src/main/java/io/appium/java_client/internal/process/ExecutableFinder.java @@ -36,6 +36,11 @@ * trimmed to bare-name PATH lookup, the only way this class is actually called. */ public class ExecutableFinder { + /** + * Creates a new instance. + */ + public ExecutableFinder() { + } private static final boolean IS_WINDOWS = osNameContains("win"); private static final boolean IS_MAC = osNameContains("mac"); diff --git a/src/main/java/io/appium/java_client/internal/process/ExternalProcess.java b/src/main/java/io/appium/java_client/internal/process/ExternalProcess.java index d9a2a85fc..cf2d037db 100644 --- a/src/main/java/io/appium/java_client/internal/process/ExternalProcess.java +++ b/src/main/java/io/appium/java_client/internal/process/ExternalProcess.java @@ -54,6 +54,11 @@ private ExternalProcess(Process process, TailBuffer output, Thread worker) { this.worker = worker; } + /** + * Creates a process builder. + * + * @return a new builder + */ public static Builder builder() { return new Builder(); } @@ -67,6 +72,11 @@ public String getOutput() { return output.toString(Charset.defaultCharset()); } + /** + * Checks whether the process is still running. + * + * @return true if the process is alive + */ public boolean isAlive() { return process.isAlive(); } @@ -168,6 +178,9 @@ private void stopWorker(AtomicBoolean interrupts) { joinWorker(Duration.ofSeconds(2), interrupts); } + /** + * Builds {@link ExternalProcess} instances. + */ public static final class Builder { private final ProcessBuilder builder = new ProcessBuilder(); private @Nullable OutputStream copyOutputTo; @@ -190,11 +203,24 @@ public Builder command(String executable, List arguments) { return this; } + /** + * Sets an environment variable of the process. + * + * @param name the variable name + * @param value the variable value + * @return this instance + */ public Builder environment(String name, String value) { builder.environment().put(name, value); return this; } + /** + * Sets environment variables of the process. + * + * @param environment the variable names mapped to their values + * @return this instance + */ public Builder environment(Map environment) { environment.forEach(this::environment); return this; diff --git a/src/main/java/io/appium/java_client/internal/webdriver/InvalidResponseException.java b/src/main/java/io/appium/java_client/internal/webdriver/InvalidResponseException.java index 9d763157f..2eba9711e 100644 --- a/src/main/java/io/appium/java_client/internal/webdriver/InvalidResponseException.java +++ b/src/main/java/io/appium/java_client/internal/webdriver/InvalidResponseException.java @@ -24,6 +24,12 @@ public class InvalidResponseException extends IllegalArgumentException { private static final String W3C_ERRORS_URL = "https://www.w3.org/TR/webdriver2/#errors"; + /** + * Creates an exception. + * + * @param message the detail message + * @param response the response that cannot be interpreted + */ public InvalidResponseException(String message, Map response) { super(String.format("%s: %s%nSee %s", message, response, W3C_ERRORS_URL)); } diff --git a/src/main/java/io/appium/java_client/internal/webdriver/ProtocolHandshake.java b/src/main/java/io/appium/java_client/internal/webdriver/ProtocolHandshake.java index f037f8cfc..b7240094f 100644 --- a/src/main/java/io/appium/java_client/internal/webdriver/ProtocolHandshake.java +++ b/src/main/java/io/appium/java_client/internal/webdriver/ProtocolHandshake.java @@ -53,6 +53,12 @@ * which also negotiated the legacy JSON wire protocol. */ public class ProtocolHandshake { + /** + * Creates a new instance. + */ + public ProtocolHandshake() { + } + private static final Logger LOG = LoggerFactory.getLogger(ProtocolHandshake.class); private static final Type MAP_TYPE = new TypeToken>() { }.getType(); private static final Predicate ACCEPTED_W3C_PATTERNS = W3CCapabilityKeys.INSTANCE; diff --git a/src/main/java/io/appium/java_client/ios/HasIOSClipboard.java b/src/main/java/io/appium/java_client/ios/HasIOSClipboard.java index 32f4c9df4..2d13aee02 100644 --- a/src/main/java/io/appium/java_client/ios/HasIOSClipboard.java +++ b/src/main/java/io/appium/java_client/ios/HasIOSClipboard.java @@ -31,6 +31,9 @@ import static java.util.Objects.requireNonNull; +/** + * The interface for the drivers that can set the iOS-specific clipboard content. + */ public interface HasIOSClipboard extends HasClipboard { /** * Set an image to the clipboard. diff --git a/src/main/java/io/appium/java_client/ios/HasIOSSettings.java b/src/main/java/io/appium/java_client/ios/HasIOSSettings.java index 0f27380b3..0b1bacd29 100644 --- a/src/main/java/io/appium/java_client/ios/HasIOSSettings.java +++ b/src/main/java/io/appium/java_client/ios/HasIOSSettings.java @@ -19,6 +19,9 @@ import io.appium.java_client.HasSettings; import io.appium.java_client.Setting; +/** + * The interface for the drivers that can change the iOS-specific Appium settings. + */ public interface HasIOSSettings extends HasSettings { /** * Set the `nativeWebTap` setting. *iOS-only method*. diff --git a/src/main/java/io/appium/java_client/ios/IOSBatteryInfo.java b/src/main/java/io/appium/java_client/ios/IOSBatteryInfo.java index 3344f9903..e29b86f4e 100644 --- a/src/main/java/io/appium/java_client/ios/IOSBatteryInfo.java +++ b/src/main/java/io/appium/java_client/ios/IOSBatteryInfo.java @@ -4,8 +4,14 @@ import java.util.Map; +/** Battery information of an iOS device. */ public class IOSBatteryInfo extends BatteryInfo { + /** + * Creates the battery info from the raw server response. + * + * @param input The raw battery info map. + */ public IOSBatteryInfo(Map input) { super(input); } @@ -26,7 +32,15 @@ public BatteryState getState() { } } + /** iOS battery charging state. */ public enum BatteryState { - UNKNOWN, UNPLUGGED, CHARGING, FULL + /** The state is not known. */ + UNKNOWN, + /** The device is not plugged in. */ + UNPLUGGED, + /** The battery is charging. */ + CHARGING, + /** The battery is fully charged. */ + FULL } } diff --git a/src/main/java/io/appium/java_client/ios/IOSStartScreenRecordingOptions.java b/src/main/java/io/appium/java_client/ios/IOSStartScreenRecordingOptions.java index 5c56cd9a5..fecf77c50 100644 --- a/src/main/java/io/appium/java_client/ios/IOSStartScreenRecordingOptions.java +++ b/src/main/java/io/appium/java_client/ios/IOSStartScreenRecordingOptions.java @@ -28,14 +28,26 @@ import static java.util.Objects.requireNonNull; import static java.util.Optional.ofNullable; +/** iOS-specific options for starting a screen recording. */ public class IOSStartScreenRecordingOptions extends BaseStartScreenRecordingOptions { + /** + * Creates a new instance. + */ + public IOSStartScreenRecordingOptions() { + } + private String videoType; private String videoQuality; private String videoScale; private String videoFilters; private Integer fps; + /** + * Creates a new options instance. + * + * @return a new {@link IOSStartScreenRecordingOptions} instance. + */ public static IOSStartScreenRecordingOptions startScreenRecordingOptions() { return new IOSStartScreenRecordingOptions(); } @@ -62,8 +74,16 @@ public IOSStartScreenRecordingOptions withVideoType(String videoType) { return this; } + /** Video encoding quality presets. */ public enum VideoQuality { - LOW, MEDIUM, HIGH, PHOTO + /** Low quality. */ + LOW, + /** Medium quality. */ + MEDIUM, + /** High quality. */ + HIGH, + /** Photo quality. */ + PHOTO } /** diff --git a/src/main/java/io/appium/java_client/ios/IOSStopScreenRecordingOptions.java b/src/main/java/io/appium/java_client/ios/IOSStopScreenRecordingOptions.java index bbe9b33dc..f5a68ac1e 100644 --- a/src/main/java/io/appium/java_client/ios/IOSStopScreenRecordingOptions.java +++ b/src/main/java/io/appium/java_client/ios/IOSStopScreenRecordingOptions.java @@ -18,9 +18,20 @@ import io.appium.java_client.screenrecording.BaseStopScreenRecordingOptions; +/** iOS-specific options for stopping a screen recording. */ public class IOSStopScreenRecordingOptions extends BaseStopScreenRecordingOptions { + /** + * Creates a new instance. + */ + public IOSStopScreenRecordingOptions() { + } + /** + * Creates a new options instance. + * + * @return a new {@link IOSStopScreenRecordingOptions} instance. + */ public static IOSStopScreenRecordingOptions stopScreenRecordingOptions() { return new IOSStopScreenRecordingOptions(); } diff --git a/src/main/java/io/appium/java_client/ios/ListensToSyslogMessages.java b/src/main/java/io/appium/java_client/ios/ListensToSyslogMessages.java index fec40939c..4558f5d23 100644 --- a/src/main/java/io/appium/java_client/ios/ListensToSyslogMessages.java +++ b/src/main/java/io/appium/java_client/ios/ListensToSyslogMessages.java @@ -29,8 +29,14 @@ import static io.appium.java_client.service.local.AppiumServiceBuilder.DEFAULT_APPIUM_PORT; +/** Provides the ability to listen to syslog messages broadcast by the Appium server via web socket. */ public interface ListensToSyslogMessages extends ExecutesMethod { + /** + * Returns the web socket client used to receive syslog messages. + * + * @return the syslog web socket client + */ StringWebSocketClient getSyslogClient(); /** diff --git a/src/main/java/io/appium/java_client/ios/PerformsTouchID.java b/src/main/java/io/appium/java_client/ios/PerformsTouchID.java index 5829808bd..ea8db77eb 100644 --- a/src/main/java/io/appium/java_client/ios/PerformsTouchID.java +++ b/src/main/java/io/appium/java_client/ios/PerformsTouchID.java @@ -21,6 +21,7 @@ import java.util.Map; +/** Provides Touch ID simulation on iOS Simulator. */ public interface PerformsTouchID extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/ios/ShakesDevice.java b/src/main/java/io/appium/java_client/ios/ShakesDevice.java index 7942b231f..cfc9188e6 100644 --- a/src/main/java/io/appium/java_client/ios/ShakesDevice.java +++ b/src/main/java/io/appium/java_client/ios/ShakesDevice.java @@ -19,6 +19,7 @@ import io.appium.java_client.CommandExecutionHelper; import io.appium.java_client.ExecutesMethod; +/** Provides the ability to shake the iOS Simulator. */ public interface ShakesDevice extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/ios/options/XCUITestOptions.java b/src/main/java/io/appium/java_client/ios/options/XCUITestOptions.java index 41d5047a2..42066db40 100644 --- a/src/main/java/io/appium/java_client/ios/options/XCUITestOptions.java +++ b/src/main/java/io/appium/java_client/ios/options/XCUITestOptions.java @@ -232,15 +232,26 @@ public class XCUITestOptions extends BaseOptions implements SupportsShowIosLogOption, SupportsClearSystemFilesOption { + /** Creates options with the default capabilities set. */ public XCUITestOptions() { setCommonOptions(); } + /** + * Creates options from the given capabilities. + * + * @param source The capabilities to copy. + */ public XCUITestOptions(Capabilities source) { super(source); setCommonOptions(); } + /** + * Creates options from the given capabilities map. + * + * @param source The capabilities to copy. + */ public XCUITestOptions(Map source) { super(source); setCommonOptions(); diff --git a/src/main/java/io/appium/java_client/ios/options/app/SupportsAppInstallStrategyOption.java b/src/main/java/io/appium/java_client/ios/options/app/SupportsAppInstallStrategyOption.java index f74d1db15..750d836c2 100644 --- a/src/main/java/io/appium/java_client/ios/options/app/SupportsAppInstallStrategyOption.java +++ b/src/main/java/io/appium/java_client/ios/options/app/SupportsAppInstallStrategyOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code appInstallStrategy} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAppInstallStrategyOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code appInstallStrategy} capability. + */ String APP_INSTALL_STRATEGY_OPTION = "appInstallStrategy"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/app/SupportsAppPushTimeoutOption.java b/src/main/java/io/appium/java_client/ios/options/app/SupportsAppPushTimeoutOption.java index 1e3d54aeb..ca12eff3d 100644 --- a/src/main/java/io/appium/java_client/ios/options/app/SupportsAppPushTimeoutOption.java +++ b/src/main/java/io/appium/java_client/ios/options/app/SupportsAppPushTimeoutOption.java @@ -24,8 +24,16 @@ import java.time.Duration; import java.util.Optional; +/** + * Provides getters and setters for the {@code appPushTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAppPushTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code appPushTimeout} capability. + */ String APP_PUSH_TIMEOUT_OPTION = "appPushTimeout"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/app/SupportsBundleIdOption.java b/src/main/java/io/appium/java_client/ios/options/app/SupportsBundleIdOption.java index 97e53d2f4..ec1bbe1bc 100644 --- a/src/main/java/io/appium/java_client/ios/options/app/SupportsBundleIdOption.java +++ b/src/main/java/io/appium/java_client/ios/options/app/SupportsBundleIdOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code bundleId} capability. + * + * @param options type, used for chaining. + */ public interface SupportsBundleIdOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code bundleId} capability. + */ String BUNDLE_ID_OPTION = "bundleId"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/app/SupportsLocalizableStringsDirOption.java b/src/main/java/io/appium/java_client/ios/options/app/SupportsLocalizableStringsDirOption.java index f02635bf6..9c4ae72b0 100644 --- a/src/main/java/io/appium/java_client/ios/options/app/SupportsLocalizableStringsDirOption.java +++ b/src/main/java/io/appium/java_client/ios/options/app/SupportsLocalizableStringsDirOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code localizableStringsDir} capability. + * + * @param options type, used for chaining. + */ public interface SupportsLocalizableStringsDirOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code localizableStringsDir} capability. + */ String LOCALIZABLE_STRINGS_DIR_OPTION = "localizableStringsDir"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/general/SupportsIncludeDeviceCapsToSessionInfoOption.java b/src/main/java/io/appium/java_client/ios/options/general/SupportsIncludeDeviceCapsToSessionInfoOption.java index 9760cbdf5..b755014c0 100644 --- a/src/main/java/io/appium/java_client/ios/options/general/SupportsIncludeDeviceCapsToSessionInfoOption.java +++ b/src/main/java/io/appium/java_client/ios/options/general/SupportsIncludeDeviceCapsToSessionInfoOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code includeDeviceCapsToSessionInfo} capability. + * + * @param options type, used for chaining. + */ public interface SupportsIncludeDeviceCapsToSessionInfoOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code includeDeviceCapsToSessionInfo} capability. + */ String INCLUDE_DEVICE_CAPS_TO_SESSION_INFO_OPTION = "includeDeviceCapsToSessionInfo"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/general/SupportsResetLocationServiceOption.java b/src/main/java/io/appium/java_client/ios/options/general/SupportsResetLocationServiceOption.java index 5bd8da1d7..706ee278c 100644 --- a/src/main/java/io/appium/java_client/ios/options/general/SupportsResetLocationServiceOption.java +++ b/src/main/java/io/appium/java_client/ios/options/general/SupportsResetLocationServiceOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code resetLocationService} capability. + * + * @param options type, used for chaining. + */ public interface SupportsResetLocationServiceOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code resetLocationService} capability. + */ String RESET_LOCATION_SERVICE_OPTION = "resetLocationService"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/other/CommandTimeouts.java b/src/main/java/io/appium/java_client/ios/options/other/CommandTimeouts.java index 36b435a90..a9d4b8f10 100644 --- a/src/main/java/io/appium/java_client/ios/options/other/CommandTimeouts.java +++ b/src/main/java/io/appium/java_client/ios/options/other/CommandTimeouts.java @@ -23,16 +23,33 @@ import java.util.Map; import java.util.Optional; +/** + * Custom timeouts for the WDA backend commands, keyed by command name. + */ public class CommandTimeouts extends BaseMapOptionData { + /** + * Command name that defines the default timeout for all commands. + */ public static final String DEFAULT_COMMAND = "default"; + /** Creates empty command timeouts. */ public CommandTimeouts() { } + /** + * Creates command timeouts from the given map. + * + * @param timeouts Mapping of command names to timeouts in milliseconds. + */ public CommandTimeouts(Map timeouts) { super(timeouts); } + /** + * Creates command timeouts from the given JSON. + * + * @param json JSON object mapping command names to timeouts in milliseconds. + */ public CommandTimeouts(String json) { super(json); } diff --git a/src/main/java/io/appium/java_client/ios/options/other/SupportsCommandTimeoutsOption.java b/src/main/java/io/appium/java_client/ios/options/other/SupportsCommandTimeoutsOption.java index d19e6272f..2e5dedf35 100644 --- a/src/main/java/io/appium/java_client/ios/options/other/SupportsCommandTimeoutsOption.java +++ b/src/main/java/io/appium/java_client/ios/options/other/SupportsCommandTimeoutsOption.java @@ -26,8 +26,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Provides getters and setters for the {@code commandTimeouts} capability. + * + * @param options type, used for chaining. + */ public interface SupportsCommandTimeoutsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code commandTimeouts} capability. + */ String COMMAND_TIMEOUTS_OPTION = "commandTimeouts"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/other/SupportsLaunchWithIdbOption.java b/src/main/java/io/appium/java_client/ios/options/other/SupportsLaunchWithIdbOption.java index 8c36b58bf..87dd61bbc 100644 --- a/src/main/java/io/appium/java_client/ios/options/other/SupportsLaunchWithIdbOption.java +++ b/src/main/java/io/appium/java_client/ios/options/other/SupportsLaunchWithIdbOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code launchWithIDB} capability. + * + * @param options type, used for chaining. + */ public interface SupportsLaunchWithIdbOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code launchWithIDB} capability. + */ String LAUNCH_WITH_IDB_OPTION = "launchWithIDB"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/other/SupportsResetOnSessionStartOnlyOption.java b/src/main/java/io/appium/java_client/ios/options/other/SupportsResetOnSessionStartOnlyOption.java index 65f29c837..3f071cb2e 100644 --- a/src/main/java/io/appium/java_client/ios/options/other/SupportsResetOnSessionStartOnlyOption.java +++ b/src/main/java/io/appium/java_client/ios/options/other/SupportsResetOnSessionStartOnlyOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code resetOnSessionStartOnly} capability. + * + * @param options type, used for chaining. + */ public interface SupportsResetOnSessionStartOnlyOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code resetOnSessionStartOnly} capability. + */ String RESET_ON_SESSION_START_ONLY_OPTION = "resetOnSessionStartOnly"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/other/SupportsShowIosLogOption.java b/src/main/java/io/appium/java_client/ios/options/other/SupportsShowIosLogOption.java index ee0676d44..97fc383ba 100644 --- a/src/main/java/io/appium/java_client/ios/options/other/SupportsShowIosLogOption.java +++ b/src/main/java/io/appium/java_client/ios/options/other/SupportsShowIosLogOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code showIOSLog} capability. + * + * @param options type, used for chaining. + */ public interface SupportsShowIosLogOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code showIOSLog} capability. + */ String SHOW_IOS_LOG_OPTION = "showIOSLog"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/other/SupportsUseJsonSourceOption.java b/src/main/java/io/appium/java_client/ios/options/other/SupportsUseJsonSourceOption.java index dd88a9a34..d59c04805 100644 --- a/src/main/java/io/appium/java_client/ios/options/other/SupportsUseJsonSourceOption.java +++ b/src/main/java/io/appium/java_client/ios/options/other/SupportsUseJsonSourceOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code useJSONSource} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUseJsonSourceOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code useJSONSource} capability. + */ String USE_JSON_SOURCE_OPTION = "useJSONSource"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/PasteboardSyncState.java b/src/main/java/io/appium/java_client/ios/options/simulator/PasteboardSyncState.java index 885229dd8..b7ebe33a5 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/PasteboardSyncState.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/PasteboardSyncState.java @@ -16,6 +16,14 @@ package io.appium.java_client.ios.options.simulator; +/** + * Possible values of the {@code simulatorPasteboardAutomaticSync} capability. + */ public enum PasteboardSyncState { - ON, OFF, SYSTEM + /** Forces the pasteboard sync flag enabled. */ + ON, + /** Disables the pasteboard sync. */ + OFF, + /** Does not provide the flag to the simulator launch command. */ + SYSTEM } diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/Permissions.java b/src/main/java/io/appium/java_client/ios/options/simulator/Permissions.java index 53094e5ab..4f30bc4b5 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/Permissions.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/Permissions.java @@ -21,14 +21,28 @@ import java.util.Map; import java.util.Optional; +/** + * Simulator permissions, keyed by application bundle identifier. + */ public class Permissions extends BaseMapOptionData { + /** Creates empty permissions. */ public Permissions() { } + /** + * Creates permissions from the given map. + * + * @param permissions Mapping of bundle identifiers to permission settings. + */ public Permissions(Map permissions) { super(permissions); } + /** + * Creates permissions from the given JSON. + * + * @param json JSON object mapping bundle identifiers to permission settings. + */ public Permissions(String json) { super(json); } diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsCalendarAccessAuthorizedOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsCalendarAccessAuthorizedOption.java index 800bac79e..100786b5d 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsCalendarAccessAuthorizedOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsCalendarAccessAuthorizedOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code calendarAccessAuthorized} capability. + * + * @param options type, used for chaining. + */ public interface SupportsCalendarAccessAuthorizedOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code calendarAccessAuthorized} capability. + */ String CALENDAR_ACCESS_AUTHORIZED_OPTION = "calendarAccessAuthorized"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsCalendarFormatOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsCalendarFormatOption.java index f38a31bd2..64e6d8431 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsCalendarFormatOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsCalendarFormatOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code calendarFormat} capability. + * + * @param options type, used for chaining. + */ public interface SupportsCalendarFormatOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code calendarFormat} capability. + */ String CALENDAR_FORMAT_OPTION = "calendarFormat"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsConnectHardwareKeyboardOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsConnectHardwareKeyboardOption.java index 3eed21650..747c2c1aa 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsConnectHardwareKeyboardOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsConnectHardwareKeyboardOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code connectHardwareKeyboard} capability. + * + * @param options type, used for chaining. + */ public interface SupportsConnectHardwareKeyboardOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code connectHardwareKeyboard} capability. + */ String CONNECT_HARDWARE_KEYBOARD_OPTION = "connectHardwareKeyboard"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsCustomSslCertOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsCustomSslCertOption.java index af501a76e..0cda7c8eb 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsCustomSslCertOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsCustomSslCertOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code customSSLCert} capability. + * + * @param options type, used for chaining. + */ public interface SupportsCustomSslCertOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code customSSLCert} capability. + */ String CUSTOM_SSLCERT_OPTION = "customSSLCert"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsEnforceFreshSimulatorCreationOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsEnforceFreshSimulatorCreationOption.java index 010049af9..62dfe7473 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsEnforceFreshSimulatorCreationOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsEnforceFreshSimulatorCreationOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code enforceFreshSimulatorCreation} capability. + * + * @param options type, used for chaining. + */ public interface SupportsEnforceFreshSimulatorCreationOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code enforceFreshSimulatorCreation} capability. + */ String ENFORCE_FRESH_SIMULATOR_CREATION_OPTION = "enforceFreshSimulatorCreation"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsForceSimulatorSoftwareKeyboardPresenceOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsForceSimulatorSoftwareKeyboardPresenceOption.java index ba30bdcaa..da088ede4 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsForceSimulatorSoftwareKeyboardPresenceOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsForceSimulatorSoftwareKeyboardPresenceOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code forceSimulatorSoftwareKeyboardPresence} capability. + * + * @param options type, used for chaining. + */ public interface SupportsForceSimulatorSoftwareKeyboardPresenceOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code forceSimulatorSoftwareKeyboardPresence} capability. + */ String FORCE_SIMULATOR_SOFTWARE_KEYBOARD_PRESENCE_OPTION = "forceSimulatorSoftwareKeyboardPresence"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsIosSimulatorLogsPredicateOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsIosSimulatorLogsPredicateOption.java index da69dc30b..1d434b80f 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsIosSimulatorLogsPredicateOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsIosSimulatorLogsPredicateOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code iosSimulatorLogsPredicate} capability. + * + * @param options type, used for chaining. + */ public interface SupportsIosSimulatorLogsPredicateOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code iosSimulatorLogsPredicate} capability. + */ String IOS_SIMULATOR_LOGS_PREDICATE_OPTION = "iosSimulatorLogsPredicate"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsKeepKeyChainsOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsKeepKeyChainsOption.java index cc444192c..77886d724 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsKeepKeyChainsOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsKeepKeyChainsOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code keepKeyChains} capability. + * + * @param options type, used for chaining. + */ public interface SupportsKeepKeyChainsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code keepKeyChains} capability. + */ String KEEP_KEY_CHAINS_OPTION = "keepKeyChains"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsKeychainsExcludePatternsOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsKeychainsExcludePatternsOption.java index 960a5ed2e..7aa13a1d1 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsKeychainsExcludePatternsOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsKeychainsExcludePatternsOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code keychainsExcludePatterns} capability. + * + * @param options type, used for chaining. + */ public interface SupportsKeychainsExcludePatternsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code keychainsExcludePatterns} capability. + */ String KEYCHAINS_EXCLUDE_PATTERNS_OPTION = "keychainsExcludePatterns"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsPermissionsOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsPermissionsOption.java index 3f55a335c..755c6e252 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsPermissionsOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsPermissionsOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code permissions} capability. + * + * @param options type, used for chaining. + */ public interface SupportsPermissionsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code permissions} capability. + */ String PERMISSIONS_OPTION = "permissions"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsReduceMotionOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsReduceMotionOption.java index 5cee8feb0..f2c41b862 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsReduceMotionOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsReduceMotionOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code reduceMotion} capability. + * + * @param options type, used for chaining. + */ public interface SupportsReduceMotionOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code reduceMotion} capability. + */ String REDUCE_MOTION_OPTION = "reduceMotion"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsScaleFactorOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsScaleFactorOption.java index 1644da81d..763948d6c 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsScaleFactorOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsScaleFactorOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code scaleFactor} capability. + * + * @param options type, used for chaining. + */ public interface SupportsScaleFactorOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code scaleFactor} capability. + */ String SCALE_FACTOR_OPTION = "scaleFactor"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsShutdownOtherSimulatorsOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsShutdownOtherSimulatorsOption.java index 1fd54493f..130e5ace6 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsShutdownOtherSimulatorsOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsShutdownOtherSimulatorsOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code shutdownOtherSimulators} capability. + * + * @param options type, used for chaining. + */ public interface SupportsShutdownOtherSimulatorsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code shutdownOtherSimulators} capability. + */ String SHUTDOWN_OTHER_SIMULATORS_OPTION = "shutdownOtherSimulators"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorDevicesSetPathOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorDevicesSetPathOption.java index cf6f0df41..0b4acf27a 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorDevicesSetPathOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorDevicesSetPathOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code simulatorDevicesSetPath} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSimulatorDevicesSetPathOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code simulatorDevicesSetPath} capability. + */ String SIMULATOR_DEVICES_SET_PATH_OPTION = "simulatorDevicesSetPath"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorPasteboardAutomaticSyncOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorPasteboardAutomaticSyncOption.java index 5f3f5615b..a6eefef61 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorPasteboardAutomaticSyncOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorPasteboardAutomaticSyncOption.java @@ -24,8 +24,16 @@ import static java.util.Locale.ROOT; +/** + * Provides getters and setters for the {@code simulatorPasteboardAutomaticSync} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSimulatorPasteboardAutomaticSyncOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code simulatorPasteboardAutomaticSync} capability. + */ String SIMULATOR_PASTEBOARD_AUTOMATIC_SYNC = "simulatorPasteboardAutomaticSync"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorStartupTimeoutOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorStartupTimeoutOption.java index c3e593d7c..4bd83dc09 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorStartupTimeoutOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorStartupTimeoutOption.java @@ -24,8 +24,16 @@ import java.time.Duration; import java.util.Optional; +/** + * Provides getters and setters for the {@code simulatorStartupTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSimulatorStartupTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code simulatorStartupTimeout} capability. + */ String SIMULATOR_STARTUP_TIMEOUT_OPTION = "simulatorStartupTimeout"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorTracePointerOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorTracePointerOption.java index d7a1d115e..e7d6b515d 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorTracePointerOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorTracePointerOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code simulatorTracePointer} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSimulatorTracePointerOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code simulatorTracePointer} capability. + */ String SIMULATOR_TRACE_POINTER_OPTION = "simulatorTracePointer"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorWindowCenterOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorWindowCenterOption.java index 480e0286e..b61b73c9c 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorWindowCenterOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsSimulatorWindowCenterOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code simulatorWindowCenter} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSimulatorWindowCenterOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code simulatorWindowCenter} capability. + */ String SIMULATOR_WINDOW_CENTER_OPTION = "simulatorWindowCenter"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsWebkitResponseTimeoutOption.java b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsWebkitResponseTimeoutOption.java index 1ddd413ec..e4c04aeb6 100644 --- a/src/main/java/io/appium/java_client/ios/options/simulator/SupportsWebkitResponseTimeoutOption.java +++ b/src/main/java/io/appium/java_client/ios/options/simulator/SupportsWebkitResponseTimeoutOption.java @@ -24,8 +24,16 @@ import java.time.Duration; import java.util.Optional; +/** + * Provides getters and setters for the {@code webkitResponseTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWebkitResponseTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code webkitResponseTimeout} capability. + */ String WEBKIT_RESPONSE_TIMEOUT_OPTION = "webkitResponseTimeout"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/Keychain.java b/src/main/java/io/appium/java_client/ios/options/wda/Keychain.java index 8a2e69891..238be8960 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/Keychain.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/Keychain.java @@ -19,9 +19,23 @@ import lombok.Data; import lombok.ToString; +/** + * Custom keychain details: its path and password. + */ @ToString() @Data() public class Keychain { private final String path; private final String password; + + /** + * Creates a new keychain description. + * + * @param path the keychain path + * @param password the keychain password + */ + public Keychain(String path, String password) { + this.path = path; + this.password = password; + } } diff --git a/src/main/java/io/appium/java_client/ios/options/wda/ProcessArguments.java b/src/main/java/io/appium/java_client/ios/options/wda/ProcessArguments.java index 08b06f9f8..ec76623bd 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/ProcessArguments.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/ProcessArguments.java @@ -24,20 +24,39 @@ import java.util.Map; import java.util.Optional; +/** + * Process arguments and environment sent to the WebDriverAgent server. + */ @ToString() public class ProcessArguments { private final List args; private final Map env; + /** + * Creates process arguments with an environment. + * + * @param args Process arguments. + * @param env Process environment variables. + */ public ProcessArguments(List args, Map env) { this.args = args; this.env = env; } + /** + * Creates process arguments without an environment. + * + * @param args Process arguments. + */ public ProcessArguments(List args) { this(args, null); } + /** + * Creates an environment without process arguments. + * + * @param env Process environment variables. + */ public ProcessArguments(Map env) { this(null, env); } diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsAllowProvisioningDeviceRegistrationOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsAllowProvisioningDeviceRegistrationOption.java index 0ddf36ddb..490ebaedd 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsAllowProvisioningDeviceRegistrationOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsAllowProvisioningDeviceRegistrationOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code allowProvisioningDeviceRegistration} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAllowProvisioningDeviceRegistrationOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code allowProvisioningDeviceRegistration} capability. + */ String ALLOW_PROVISIONING_DEVICE_REGISTRATION_OPTION = "allowProvisioningDeviceRegistration"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsAutoAcceptAlertsOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsAutoAcceptAlertsOption.java index 1a3a86347..4fedff2f0 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsAutoAcceptAlertsOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsAutoAcceptAlertsOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code autoAcceptAlerts} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAutoAcceptAlertsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code autoAcceptAlerts} capability. + */ String AUTO_ACCEPT_ALERTS_OPTION = "autoAcceptAlerts"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsAutoDismissAlertsOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsAutoDismissAlertsOption.java index 82a85754e..096f8b0eb 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsAutoDismissAlertsOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsAutoDismissAlertsOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code autoDismissAlerts} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAutoDismissAlertsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code autoDismissAlerts} capability. + */ String AUTO_DISMISS_ALERTS_OPTION = "autoDismissAlerts"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsDerivedDataPathOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsDerivedDataPathOption.java index e3bfc1f2f..c994c9d00 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsDerivedDataPathOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsDerivedDataPathOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code derivedDataPath} capability. + * + * @param options type, used for chaining. + */ public interface SupportsDerivedDataPathOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code derivedDataPath} capability. + */ String DERIVED_DATA_PATH_OPTION = "derivedDataPath"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsDisableAutomaticScreenshotsOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsDisableAutomaticScreenshotsOption.java index 90c0b2683..682d3c4f4 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsDisableAutomaticScreenshotsOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsDisableAutomaticScreenshotsOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code disableAutomaticScreenshots} capability. + * + * @param options type, used for chaining. + */ public interface SupportsDisableAutomaticScreenshotsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code disableAutomaticScreenshots} capability. + */ String DISABLE_AUTOMATIC_SCREENSHOTS_OPTION = "disableAutomaticScreenshots"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsForceAppLaunchOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsForceAppLaunchOption.java index 4c2ab4780..fc2c921e0 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsForceAppLaunchOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsForceAppLaunchOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code forceAppLaunch} capability. + * + * @param options type, used for chaining. + */ public interface SupportsForceAppLaunchOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code forceAppLaunch} capability. + */ String FORCE_APP_LAUNCH_OPTION = "forceAppLaunch"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsKeychainOptions.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsKeychainOptions.java index 92e7a33bf..54e4f367e 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsKeychainOptions.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsKeychainOptions.java @@ -22,9 +22,20 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code keychainPath} and {@code keychainPassword} capabilities. + * + * @param options type, used for chaining. + */ public interface SupportsKeychainOptions> extends Capabilities, CanSetCapability { + /** + * Name of the {@code keychainPath} capability. + */ String KEYCHAIN_PATH_OPTION = "keychainPath"; + /** + * Name of the {@code keychainPassword} capability. + */ String KEYCHAIN_PASSWORD_OPTION = "keychainPassword"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsMaxTypingFrequencyOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsMaxTypingFrequencyOption.java index bbc434838..4d3e8dfd9 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsMaxTypingFrequencyOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsMaxTypingFrequencyOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code maxTypingFrequency} capability. + * + * @param options type, used for chaining. + */ public interface SupportsMaxTypingFrequencyOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code maxTypingFrequency} capability. + */ String MAX_TYPING_FREQUENCY_OPTION = "maxTypingFrequency"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsMjpegServerPortOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsMjpegServerPortOption.java index 6b14fab5e..19ee2df9e 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsMjpegServerPortOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsMjpegServerPortOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code mjpegServerPort} capability. + * + * @param options type, used for chaining. + */ public interface SupportsMjpegServerPortOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code mjpegServerPort} capability. + */ String MJPEG_SERVER_PORT_OPTION = "mjpegServerPort"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsPrebuiltWdaPathOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsPrebuiltWdaPathOption.java index 7754f232c..8feddfe2e 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsPrebuiltWdaPathOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsPrebuiltWdaPathOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code prebuiltWDAPath} capability. + * + * @param options type, used for chaining. + */ public interface SupportsPrebuiltWdaPathOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code prebuiltWDAPath} capability. + */ String PREBUILT_WDA_PATH_OPTION = "prebuiltWDAPath"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsProcessArgumentsOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsProcessArgumentsOption.java index 2f30a6e1d..ca10810a2 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsProcessArgumentsOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsProcessArgumentsOption.java @@ -24,8 +24,16 @@ import java.util.Map; import java.util.Optional; +/** + * Provides getters and setters for the {@code processArguments} capability. + * + * @param options type, used for chaining. + */ public interface SupportsProcessArgumentsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code processArguments} capability. + */ String PROCESS_ARGUMENTS_OPTION = "processArguments"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsResultBundlePathOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsResultBundlePathOption.java index 01156e770..a4188a8eb 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsResultBundlePathOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsResultBundlePathOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code resultBundlePath} capability. + * + * @param options type, used for chaining. + */ public interface SupportsResultBundlePathOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code resultBundlePath} capability. + */ String RESULT_BUNDLE_PATH_OPTION = "resultBundlePath"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsScreenshotQualityOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsScreenshotQualityOption.java index 0eb3481f7..267723ffc 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsScreenshotQualityOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsScreenshotQualityOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code screenshotQuality} capability. + * + * @param options type, used for chaining. + */ public interface SupportsScreenshotQualityOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code screenshotQuality} capability. + */ String SCREENSHOT_QUALITY_OPTION = "screenshotQuality"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsShouldTerminateAppOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsShouldTerminateAppOption.java index 4c92b812f..76ac92333 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsShouldTerminateAppOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsShouldTerminateAppOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code shouldTerminateApp} capability. + * + * @param options type, used for chaining. + */ public interface SupportsShouldTerminateAppOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code shouldTerminateApp} capability. + */ String SHOULD_TERMINATE_APP_OPTION = "shouldTerminateApp"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsShouldUseSingletonTestManagerOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsShouldUseSingletonTestManagerOption.java index 16ee1d2cd..5432f2820 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsShouldUseSingletonTestManagerOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsShouldUseSingletonTestManagerOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code shouldUseSingletonTestManager} capability. + * + * @param options type, used for chaining. + */ public interface SupportsShouldUseSingletonTestManagerOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code shouldUseSingletonTestManager} capability. + */ String SHOULD_USE_SINGLETON_TEST_MANAGER_OPTION = "shouldUseSingletonTestManager"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsShowXcodeLogOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsShowXcodeLogOption.java index 902b67ced..aff616fe5 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsShowXcodeLogOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsShowXcodeLogOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code showXcodeLog} capability. + * + * @param options type, used for chaining. + */ public interface SupportsShowXcodeLogOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code showXcodeLog} capability. + */ String SHOW_XCODE_LOG_OPTION = "showXcodeLog"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsSimpleIsVisibleCheckOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsSimpleIsVisibleCheckOption.java index 72bebc33a..f51a9f6a1 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsSimpleIsVisibleCheckOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsSimpleIsVisibleCheckOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code simpleIsVisibleCheck} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSimpleIsVisibleCheckOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code simpleIsVisibleCheck} capability. + */ String SIMPLE_IS_VISIBLE_CHECK_OPTION = "simpleIsVisibleCheck"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsUpdatedWdaBundleIdOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsUpdatedWdaBundleIdOption.java index 2e4da983f..49e79714a 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsUpdatedWdaBundleIdOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsUpdatedWdaBundleIdOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code updatedWDABundleId} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUpdatedWdaBundleIdOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code updatedWDABundleId} capability. + */ String UPDATED_WDA_BUNDLE_ID_OPTION = "updatedWDABundleId"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseNativeCachingStrategyOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseNativeCachingStrategyOption.java index 10f394aee..304a292ee 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseNativeCachingStrategyOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseNativeCachingStrategyOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code useNativeCachingStrategy} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUseNativeCachingStrategyOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code useNativeCachingStrategy} capability. + */ String USE_NATIVE_CACHING_STRATEGY_OPTION = "useNativeCachingStrategy"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseNewWdaOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseNewWdaOption.java index 2422c078c..0dc6c5af6 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseNewWdaOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseNewWdaOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code useNewWDA} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUseNewWdaOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code useNewWDA} capability. + */ String USE_NEW_WDA_OPTION = "useNewWDA"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsUsePrebuiltWdaOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsUsePrebuiltWdaOption.java index bf4ce84ff..4ac639fad 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsUsePrebuiltWdaOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsUsePrebuiltWdaOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code usePrebuiltWDA} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUsePrebuiltWdaOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code usePrebuiltWDA} capability. + */ String USE_PREBUILT_WDA_OPTION = "usePrebuiltWDA"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsUsePreinstalledWdaOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsUsePreinstalledWdaOption.java index 0ae2dbcfd..6e2ee3e50 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsUsePreinstalledWdaOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsUsePreinstalledWdaOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code usePreinstalledWDA} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUsePreinstalledWdaOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code usePreinstalledWDA} capability. + */ String USE_PREINSTALLED_WDA_OPTION = "usePreinstalledWDA"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseSimpleBuildTestOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseSimpleBuildTestOption.java index 8b455e629..c02ba32b5 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseSimpleBuildTestOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseSimpleBuildTestOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code useSimpleBuildTest} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUseSimpleBuildTestOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code useSimpleBuildTest} capability. + */ String USE_SIMPLE_BUILD_TEST_OPTION = "useSimpleBuildTest"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseXctestrunFileOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseXctestrunFileOption.java index f29c55a77..831049ab8 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseXctestrunFileOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsUseXctestrunFileOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code useXctestrunFile} capability. + * + * @param options type, used for chaining. + */ public interface SupportsUseXctestrunFileOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code useXctestrunFile} capability. + */ String USE_XCTESTRUN_FILE_OPTION = "useXctestrunFile"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWaitForIdleTimeoutOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWaitForIdleTimeoutOption.java index f9dd2401a..e604c91f9 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWaitForIdleTimeoutOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWaitForIdleTimeoutOption.java @@ -26,8 +26,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Provides getters and setters for the {@code waitForIdleTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWaitForIdleTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code waitForIdleTimeout} capability. + */ String WAIT_FOR_IDLE_TIMEOUT_OPTION = "waitForIdleTimeout"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWaitForQuiescenceOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWaitForQuiescenceOption.java index 9c49e469a..4abfb3b92 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWaitForQuiescenceOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWaitForQuiescenceOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code waitForQuiescence} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWaitForQuiescenceOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code waitForQuiescence} capability. + */ String WAIT_FOR_QUIESCENCE_OPTION = "waitForQuiescence"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaBaseUrlOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaBaseUrlOption.java index 2404aa5ef..62d9d1f32 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaBaseUrlOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaBaseUrlOption.java @@ -24,8 +24,16 @@ import java.net.URL; import java.util.Optional; +/** + * Provides getters and setters for the {@code wdaBaseUrl} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWdaBaseUrlOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code wdaBaseUrl} capability. + */ String WDA_BASE_URL_OPTION = "wdaBaseUrl"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaConnectionTimeoutOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaConnectionTimeoutOption.java index 8885b8c3e..91e245cdd 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaConnectionTimeoutOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaConnectionTimeoutOption.java @@ -24,8 +24,16 @@ import java.time.Duration; import java.util.Optional; +/** + * Provides getters and setters for the {@code wdaConnectionTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWdaConnectionTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code wdaConnectionTimeout} capability. + */ String WDA_CONNECTION_TIMEOUT_OPTION = "wdaConnectionTimeout"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaEventloopIdleDelayOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaEventloopIdleDelayOption.java index 3d48703b5..43936ddf8 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaEventloopIdleDelayOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaEventloopIdleDelayOption.java @@ -26,8 +26,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Provides getters and setters for the {@code wdaEventloopIdleDelay} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWdaEventloopIdleDelayOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code wdaEventloopIdleDelay} capability. + */ String WDA_EVENTLOOP_IDLE_DELAY_OPTION = "wdaEventloopIdleDelay"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaLaunchTimeoutOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaLaunchTimeoutOption.java index 96ec72521..8076f35cc 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaLaunchTimeoutOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaLaunchTimeoutOption.java @@ -24,8 +24,16 @@ import java.time.Duration; import java.util.Optional; +/** + * Provides getters and setters for the {@code wdaLaunchTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWdaLaunchTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code wdaLaunchTimeout} capability. + */ String WDA_LAUNCH_TIMEOUT_OPTION = "wdaLaunchTimeout"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaLocalPortOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaLocalPortOption.java index a011edeac..b0d0260f3 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaLocalPortOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaLocalPortOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code wdaLocalPort} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWdaLocalPortOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code wdaLocalPort} capability. + */ String WDA_LOCAL_PORT_OPTION = "wdaLocalPort"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaStartupRetriesOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaStartupRetriesOption.java index e69a52d42..bf3710fce 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaStartupRetriesOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaStartupRetriesOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code wdaStartupRetries} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWdaStartupRetriesOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code wdaStartupRetries} capability. + */ String WDA_STARTUP_RETRIES_OPTION = "wdaStartupRetries"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaStartupRetryIntervalOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaStartupRetryIntervalOption.java index c1fe04a35..f63db97d2 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaStartupRetryIntervalOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWdaStartupRetryIntervalOption.java @@ -24,8 +24,16 @@ import java.time.Duration; import java.util.Optional; +/** + * Provides getters and setters for the {@code wdaStartupRetryInterval} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWdaStartupRetryIntervalOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code wdaStartupRetryInterval} capability. + */ String WDA_STARTUP_RETRY_INTERVAL_OPTION = "wdaStartupRetryInterval"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWebDriverAgentUrlOption.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWebDriverAgentUrlOption.java index a985e280b..af4cda9c4 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsWebDriverAgentUrlOption.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsWebDriverAgentUrlOption.java @@ -24,8 +24,16 @@ import java.net.URL; import java.util.Optional; +/** + * Provides getters and setters for the {@code webDriverAgentUrl} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWebDriverAgentUrlOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code webDriverAgentUrl} capability. + */ String WEB_DRIVER_AGENT_URL_OPTION = "webDriverAgentUrl"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/SupportsXcodeCertificateOptions.java b/src/main/java/io/appium/java_client/ios/options/wda/SupportsXcodeCertificateOptions.java index 45d437195..be1bcdec2 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/SupportsXcodeCertificateOptions.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/SupportsXcodeCertificateOptions.java @@ -22,10 +22,24 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code xcodeOrgId} and {@code xcodeSigningId} capabilities. + * + * @param options type, used for chaining. + */ public interface SupportsXcodeCertificateOptions> extends Capabilities, CanSetCapability { + /** + * Name of the {@code xcodeOrgId} capability. + */ String XCODE_ORG_ID_OPTION = "xcodeOrgId"; + /** + * Name of the {@code xcodeSigningId} capability. + */ String XCODE_SIGNING_ID_OPTION = "xcodeSigningId"; + /** + * Default signing identity used if none is provided. + */ String DEFAULT_XCODE_SIGNING_ID = "iPhone Developer"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/wda/XcodeCertificate.java b/src/main/java/io/appium/java_client/ios/options/wda/XcodeCertificate.java index 49d2d4639..b0ecb6d10 100644 --- a/src/main/java/io/appium/java_client/ios/options/wda/XcodeCertificate.java +++ b/src/main/java/io/appium/java_client/ios/options/wda/XcodeCertificate.java @@ -19,17 +19,31 @@ import lombok.Data; import lombok.ToString; +/** + * Signing certificate details for the WebDriverAgent compilation. + */ @ToString() @Data() public class XcodeCertificate { private final String xcodeOrgId; private final String xcodeSigningId; + /** + * Creates a certificate from the given team and signing identifiers. + * + * @param xcodeOrgId Apple developer team identifier. + * @param xcodeSigningId Signing identity. + */ public XcodeCertificate(String xcodeOrgId, String xcodeSigningId) { this.xcodeOrgId = xcodeOrgId; this.xcodeSigningId = xcodeSigningId; } + /** + * Creates a certificate with the default signing identity. + * + * @param xcodeOrgId Apple developer team identifier. + */ public XcodeCertificate(String xcodeOrgId) { this(xcodeOrgId, null); } diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsAbsoluteWebLocationsOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsAbsoluteWebLocationsOption.java index ae3375b70..7cdfa3a34 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsAbsoluteWebLocationsOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsAbsoluteWebLocationsOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code absoluteWebLocations} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAbsoluteWebLocationsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code absoluteWebLocations} capability. + */ String ABSOLUTE_WEB_LOCATIONS_OPTION = "absoluteWebLocations"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsAdditionalWebviewBundleIdsOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsAdditionalWebviewBundleIdsOption.java index a21044b8f..f123aff05 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsAdditionalWebviewBundleIdsOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsAdditionalWebviewBundleIdsOption.java @@ -23,8 +23,16 @@ import java.util.List; import java.util.Optional; +/** + * Provides getters and setters for the {@code additionalWebviewBundleIds} capability. + * + * @param options type, used for chaining. + */ public interface SupportsAdditionalWebviewBundleIdsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code additionalWebviewBundleIds} capability. + */ String ADDITIONAL_WEBVIEW_BUNDLE_IDS_OPTION = "additionalWebviewBundleIds"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsEnableAsyncExecuteFromHttpsOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsEnableAsyncExecuteFromHttpsOption.java index 36e135436..6a9557686 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsEnableAsyncExecuteFromHttpsOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsEnableAsyncExecuteFromHttpsOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code enableAsyncExecuteFromHttps} capability. + * + * @param options type, used for chaining. + */ public interface SupportsEnableAsyncExecuteFromHttpsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code enableAsyncExecuteFromHttps} capability. + */ String ENABLE_ASYNC_EXECUTE_FROM_HTTPS_OPTION = "enableAsyncExecuteFromHttps"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsFullContextListOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsFullContextListOption.java index da432480c..e5b55235b 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsFullContextListOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsFullContextListOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code fullContextList} capability. + * + * @param options type, used for chaining. + */ public interface SupportsFullContextListOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code fullContextList} capability. + */ String FULL_CONTEXT_LIST_OPTION = "fullContextList"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsIncludeSafariInWebviewsOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsIncludeSafariInWebviewsOption.java index c7709050b..ccb52e6c3 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsIncludeSafariInWebviewsOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsIncludeSafariInWebviewsOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code includeSafariInWebviews} capability. + * + * @param options type, used for chaining. + */ public interface SupportsIncludeSafariInWebviewsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code includeSafariInWebviews} capability. + */ String INCLUDE_SAFARI_IN_WEBVIEWS_OPTION = "includeSafariInWebviews"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsNativeWebTapOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsNativeWebTapOption.java index 5158a06f7..44a3d67fb 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsNativeWebTapOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsNativeWebTapOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code nativeWebTap} capability. + * + * @param options type, used for chaining. + */ public interface SupportsNativeWebTapOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code nativeWebTap} capability. + */ String NATIVE_WEB_TAP_OPTION = "nativeWebTap"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsNativeWebTapStrictOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsNativeWebTapStrictOption.java index 0711d9b1f..3617a6f24 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsNativeWebTapStrictOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsNativeWebTapStrictOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code nativeWebTapStrict} capability. + * + * @param options type, used for chaining. + */ public interface SupportsNativeWebTapStrictOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code nativeWebTapStrict} capability. + */ String NATIVE_WEB_TAP_STRICT_OPTION = "nativeWebTapStrict"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariAllowPopupsOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariAllowPopupsOption.java index d7ad7d1f0..05626eba1 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariAllowPopupsOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariAllowPopupsOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code safariAllowPopups} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSafariAllowPopupsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safariAllowPopups} capability. + */ String SAFARI_ALLOW_POPUPS_OPTION = "safariAllowPopups"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariGarbageCollectOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariGarbageCollectOption.java index 2990e2a75..f74e3eb5b 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariGarbageCollectOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariGarbageCollectOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code safariGarbageCollect} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSafariGarbageCollectOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safariGarbageCollect} capability. + */ String SAFARI_GARBAGE_COLLECT_OPTION = "safariGarbageCollect"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariIgnoreFraudWarningOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariIgnoreFraudWarningOption.java index ad51e338a..d090f4cf4 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariIgnoreFraudWarningOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariIgnoreFraudWarningOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code safariIgnoreFraudWarning} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSafariIgnoreFraudWarningOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safariIgnoreFraudWarning} capability. + */ String SAFARI_IGNORE_FRAUD_WARNING_OPTION = "safariIgnoreFraudWarning"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariIgnoreWebHostnamesOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariIgnoreWebHostnamesOption.java index e8e154e72..2fcd53e28 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariIgnoreWebHostnamesOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariIgnoreWebHostnamesOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code safariIgnoreWebHostnames} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSafariIgnoreWebHostnamesOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safariIgnoreWebHostnames} capability. + */ String SAFARI_IGNORE_WEB_HOSTNAMES_OPTION = "safariIgnoreWebHostnames"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariInitialUrlOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariInitialUrlOption.java index bd2193a3e..07ee46f71 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariInitialUrlOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariInitialUrlOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Provides getters and setters for the {@code safariInitialUrl} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSafariInitialUrlOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safariInitialUrl} capability. + */ String SAFARI_INITIAL_URL_OPTION = "safariInitialUrl"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariLogAllCommunicationHexDumpOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariLogAllCommunicationHexDumpOption.java index 4dbece202..1cd102394 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariLogAllCommunicationHexDumpOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariLogAllCommunicationHexDumpOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code safariLogAllCommunicationHexDump} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSafariLogAllCommunicationHexDumpOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safariLogAllCommunicationHexDump} capability. + */ String SAFARI_LOG_ALL_COMMUNICATION_HEX_DUMP_OPTION = "safariLogAllCommunicationHexDump"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariLogAllCommunicationOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariLogAllCommunicationOption.java index e351cbb62..56c7a844f 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariLogAllCommunicationOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariLogAllCommunicationOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code safariLogAllCommunication} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSafariLogAllCommunicationOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safariLogAllCommunication} capability. + */ String SAFARI_LOG_ALL_COMMUNICATION_OPTION = "safariLogAllCommunication"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariOpenLinksInBackgroundOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariOpenLinksInBackgroundOption.java index 28b79a962..1569e8406 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariOpenLinksInBackgroundOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariOpenLinksInBackgroundOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Provides getters and setters for the {@code safariOpenLinksInBackground} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSafariOpenLinksInBackgroundOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safariOpenLinksInBackground} capability. + */ String SAFARI_OPEN_LINKS_IN_BACKGROUND_OPTION = "safariOpenLinksInBackground"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariSocketChunkSizeOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariSocketChunkSizeOption.java index 24190efaa..35c8b5245 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariSocketChunkSizeOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariSocketChunkSizeOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code safariSocketChunkSize} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSafariSocketChunkSizeOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safariSocketChunkSize} capability. + */ String SAFARI_SOCKET_CHUNK_SIZE_OPTION = "safariSocketChunkSize"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariWebInspectorMaxFrameLengthOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariWebInspectorMaxFrameLengthOption.java index b3b4c6f26..09ad1f5a0 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariWebInspectorMaxFrameLengthOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsSafariWebInspectorMaxFrameLengthOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code safariWebInspectorMaxFrameLength} capability. + * + * @param options type, used for chaining. + */ public interface SupportsSafariWebInspectorMaxFrameLengthOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safariWebInspectorMaxFrameLength} capability. + */ String SAFARI_WEB_INSPECTOR_MAX_FRAME_LENGTH_OPTION = "safariWebInspectorMaxFrameLength"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsWebkitResponseTimeoutOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsWebkitResponseTimeoutOption.java index dc9378399..5371f2cfb 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsWebkitResponseTimeoutOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsWebkitResponseTimeoutOption.java @@ -24,8 +24,16 @@ import java.time.Duration; import java.util.Optional; +/** + * Provides getters and setters for the {@code webkitResponseTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWebkitResponseTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code webkitResponseTimeout} capability. + */ String WEBKIT_RESPONSE_TIMEOUT_OPTION = "webkitResponseTimeout"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsWebviewConnectRetriesOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsWebviewConnectRetriesOption.java index a1b658945..7b5c1ba44 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsWebviewConnectRetriesOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsWebviewConnectRetriesOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Provides getters and setters for the {@code webviewConnectRetries} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWebviewConnectRetriesOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code webviewConnectRetries} capability. + */ String WEBVIEW_CONNECT_RETRIES_OPTION = "webviewConnectRetries"; /** diff --git a/src/main/java/io/appium/java_client/ios/options/webview/SupportsWebviewConnectTimeoutOption.java b/src/main/java/io/appium/java_client/ios/options/webview/SupportsWebviewConnectTimeoutOption.java index cd00db23f..f81e92665 100644 --- a/src/main/java/io/appium/java_client/ios/options/webview/SupportsWebviewConnectTimeoutOption.java +++ b/src/main/java/io/appium/java_client/ios/options/webview/SupportsWebviewConnectTimeoutOption.java @@ -24,8 +24,16 @@ import java.time.Duration; import java.util.Optional; +/** + * Provides getters and setters for the {@code webviewConnectTimeout} capability. + * + * @param options type, used for chaining. + */ public interface SupportsWebviewConnectTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code webviewConnectTimeout} capability. + */ String WEBVIEW_CONNECT_TIMEOUT_OPTION = "webviewConnectTimeout"; /** diff --git a/src/main/java/io/appium/java_client/mac/Mac2Driver.java b/src/main/java/io/appium/java_client/mac/Mac2Driver.java index 015defd50..a8b592391 100644 --- a/src/main/java/io/appium/java_client/mac/Mac2Driver.java +++ b/src/main/java/io/appium/java_client/mac/Mac2Driver.java @@ -43,41 +43,94 @@ public class Mac2Driver extends AppiumDriver implements private static final String PLATFORM_NAME = Platform.MAC.name(); private static final String AUTOMATION_NAME = AutomationName.MAC2; + /** + * Creates a new instance based on command {@code executor} and {@code capabilities}. + * + * @param executor is an instance of {@link AppiumCommandExecutor} + * or class that extends it. Default commands or another vendor-specific + * commands may be specified there. + * @param capabilities take a look at {@link Capabilities} + */ public Mac2Driver(AppiumCommandExecutor executor, Capabilities capabilities) { super(executor, ensurePlatformAndAutomationNames(capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium server URL and {@code capabilities}. + * + * @param remoteAddress is the address of remotely/locally started Appium server + * @param capabilities take a look at {@link Capabilities} + */ public Mac2Driver(URL remoteAddress, Capabilities capabilities) { super(remoteAddress, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium server URL, HTTP client factory and {@code capabilities}. + * + * @param remoteAddress is the address of remotely/locally started Appium server + * @param httpClientFactory take a look at {@link HttpClient.Factory} + * @param capabilities take a look at {@link Capabilities} + */ public Mac2Driver(URL remoteAddress, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(remoteAddress, httpClientFactory, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium driver local service and {@code capabilities}. + * + * @param service take a look at {@link AppiumDriverLocalService} + * @param capabilities take a look at {@link Capabilities} + */ public Mac2Driver(AppiumDriverLocalService service, Capabilities capabilities) { super(service, ensurePlatformAndAutomationNames(capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium driver local service, HTTP client factory and {@code capabilities}. + * + * @param service take a look at {@link AppiumDriverLocalService} + * @param httpClientFactory take a look at {@link HttpClient.Factory} + * @param capabilities take a look at {@link Capabilities} + */ public Mac2Driver(AppiumDriverLocalService service, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(service, httpClientFactory, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium service builder and {@code capabilities}. + * + * @param builder take a look at {@link AppiumServiceBuilder} + * @param capabilities take a look at {@link Capabilities} + */ public Mac2Driver(AppiumServiceBuilder builder, Capabilities capabilities) { super(builder, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium service builder, HTTP client factory and {@code capabilities}. + * + * @param builder take a look at {@link AppiumServiceBuilder} + * @param httpClientFactory take a look at {@link HttpClient.Factory} + * @param capabilities take a look at {@link Capabilities} + */ public Mac2Driver(AppiumServiceBuilder builder, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(builder, httpClientFactory, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on HTTP client factory and {@code capabilities}. + * + * @param httpClientFactory take a look at {@link HttpClient.Factory} + * @param capabilities take a look at {@link Capabilities} + */ public Mac2Driver(HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(httpClientFactory, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); @@ -121,6 +174,11 @@ public Mac2Driver(AppiumClientConfig appiumClientConfig, Capabilities capabiliti capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on {@code capabilities}. + * + * @param capabilities take a look at {@link Capabilities} + */ public Mac2Driver(Capabilities capabilities) { super(ensurePlatformAndAutomationNames(capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } diff --git a/src/main/java/io/appium/java_client/mac/Mac2StartScreenRecordingOptions.java b/src/main/java/io/appium/java_client/mac/Mac2StartScreenRecordingOptions.java index 342598b62..fa0e09639 100644 --- a/src/main/java/io/appium/java_client/mac/Mac2StartScreenRecordingOptions.java +++ b/src/main/java/io/appium/java_client/mac/Mac2StartScreenRecordingOptions.java @@ -25,8 +25,15 @@ import static java.util.Optional.ofNullable; +/** Mac2-specific options for starting a screen recording. */ public class Mac2StartScreenRecordingOptions extends BaseStartScreenRecordingOptions { + /** + * Creates a new instance. + */ + public Mac2StartScreenRecordingOptions() { + } + private Integer fps; private String videoFilter; private String preset; @@ -34,6 +41,11 @@ public class Mac2StartScreenRecordingOptions private Boolean captureClicks; private Integer deviceId; + /** + * Creates a new options instance. + * + * @return a new {@link Mac2StartScreenRecordingOptions} instance. + */ public static Mac2StartScreenRecordingOptions startScreenRecordingOptions() { return new Mac2StartScreenRecordingOptions(); } diff --git a/src/main/java/io/appium/java_client/mac/Mac2StopScreenRecordingOptions.java b/src/main/java/io/appium/java_client/mac/Mac2StopScreenRecordingOptions.java index 8984460be..48fd1510a 100644 --- a/src/main/java/io/appium/java_client/mac/Mac2StopScreenRecordingOptions.java +++ b/src/main/java/io/appium/java_client/mac/Mac2StopScreenRecordingOptions.java @@ -18,9 +18,20 @@ import io.appium.java_client.screenrecording.BaseStopScreenRecordingOptions; +/** Mac2-specific options for stopping a screen recording. */ public class Mac2StopScreenRecordingOptions extends BaseStopScreenRecordingOptions { + /** + * Creates a new instance. + */ + public Mac2StopScreenRecordingOptions() { + } + /** + * Creates a new options instance. + * + * @return a new {@link Mac2StopScreenRecordingOptions} instance. + */ public static Mac2StopScreenRecordingOptions stopScreenRecordingOptions() { return new Mac2StopScreenRecordingOptions(); } diff --git a/src/main/java/io/appium/java_client/mac/options/AppleScriptData.java b/src/main/java/io/appium/java_client/mac/options/AppleScriptData.java index 91b74aa98..50d1211c8 100644 --- a/src/main/java/io/appium/java_client/mac/options/AppleScriptData.java +++ b/src/main/java/io/appium/java_client/mac/options/AppleScriptData.java @@ -21,10 +21,19 @@ import java.util.Map; import java.util.Optional; +/** + * Data object describing an AppleScript to execute, either as a script or as a command. + */ public class AppleScriptData extends SystemScript { + /** Creates an empty data object. */ public AppleScriptData() { } + /** + * Creates a data object backed by the given map. + * + * @param options The initial option values. + */ public AppleScriptData(Map options) { super(options); } diff --git a/src/main/java/io/appium/java_client/mac/options/Mac2Options.java b/src/main/java/io/appium/java_client/mac/options/Mac2Options.java index 230c04c90..4cc32403d 100644 --- a/src/main/java/io/appium/java_client/mac/options/Mac2Options.java +++ b/src/main/java/io/appium/java_client/mac/options/Mac2Options.java @@ -45,15 +45,26 @@ public class Mac2Options extends BaseOptions implements SupportsShowServerLogsOption, SupportsPrerunOption, SupportsPostrunOption { + /** Creates options with the default capabilities set. */ public Mac2Options() { setCommonOptions(); } + /** + * Creates options from the given capabilities. + * + * @param source The capabilities to copy. + */ public Mac2Options(Capabilities source) { super(source); setCommonOptions(); } + /** + * Creates options from the given capabilities map. + * + * @param source The capabilities to copy. + */ public Mac2Options(Map source) { super(source); setCommonOptions(); diff --git a/src/main/java/io/appium/java_client/mac/options/SupportsArgumentsOption.java b/src/main/java/io/appium/java_client/mac/options/SupportsArgumentsOption.java index 8d8c427f5..f78da2b62 100644 --- a/src/main/java/io/appium/java_client/mac/options/SupportsArgumentsOption.java +++ b/src/main/java/io/appium/java_client/mac/options/SupportsArgumentsOption.java @@ -23,8 +23,16 @@ import java.util.List; import java.util.Optional; +/** + * Support for the {@code arguments} capability: the command line arguments for the application under test. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsArgumentsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code arguments} capability. + */ String ARGUMENTS_OPTION = "arguments"; /** diff --git a/src/main/java/io/appium/java_client/mac/options/SupportsBootstrapRootOption.java b/src/main/java/io/appium/java_client/mac/options/SupportsBootstrapRootOption.java index cb3245148..d823ece9e 100644 --- a/src/main/java/io/appium/java_client/mac/options/SupportsBootstrapRootOption.java +++ b/src/main/java/io/appium/java_client/mac/options/SupportsBootstrapRootOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Support for the {@code bootstrapRoot} capability: the root folder of the WebDriverAgentMac project. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsBootstrapRootOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code bootstrapRoot} capability. + */ String BOOTSTRAP_ROOT_OPTION = "bootstrapRoot"; /** diff --git a/src/main/java/io/appium/java_client/mac/options/SupportsBundleIdOption.java b/src/main/java/io/appium/java_client/mac/options/SupportsBundleIdOption.java index d19420c8f..34a23cca2 100644 --- a/src/main/java/io/appium/java_client/mac/options/SupportsBundleIdOption.java +++ b/src/main/java/io/appium/java_client/mac/options/SupportsBundleIdOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Support for the {@code bundleId} capability: the bundle identifier of the application under test. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsBundleIdOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code bundleId} capability. + */ String BUNDLE_ID_OPTION = "bundleId"; /** diff --git a/src/main/java/io/appium/java_client/mac/options/SupportsEnvironmentOption.java b/src/main/java/io/appium/java_client/mac/options/SupportsEnvironmentOption.java index 803561030..41455c70b 100644 --- a/src/main/java/io/appium/java_client/mac/options/SupportsEnvironmentOption.java +++ b/src/main/java/io/appium/java_client/mac/options/SupportsEnvironmentOption.java @@ -23,8 +23,16 @@ import java.util.Map; import java.util.Optional; +/** + * Support for the {@code environment} capability: the environment variables for the application under test. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsEnvironmentOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code environment} capability. + */ String ENVIRONMENT_OPTION = "environment"; /** diff --git a/src/main/java/io/appium/java_client/mac/options/SupportsServerStartupTimeoutOption.java b/src/main/java/io/appium/java_client/mac/options/SupportsServerStartupTimeoutOption.java index 97d052928..21de93bc1 100644 --- a/src/main/java/io/appium/java_client/mac/options/SupportsServerStartupTimeoutOption.java +++ b/src/main/java/io/appium/java_client/mac/options/SupportsServerStartupTimeoutOption.java @@ -25,8 +25,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Support for the {@code serverStartupTimeout} capability: the timeout for building and starting WebDriverAgentMac. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsServerStartupTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code serverStartupTimeout} capability. + */ String SERVER_STARTUP_TIMEOUT_OPTION = "serverStartupTimeout"; /** diff --git a/src/main/java/io/appium/java_client/mac/options/SupportsShowServerLogsOption.java b/src/main/java/io/appium/java_client/mac/options/SupportsShowServerLogsOption.java index f91a32d97..6ec16883f 100644 --- a/src/main/java/io/appium/java_client/mac/options/SupportsShowServerLogsOption.java +++ b/src/main/java/io/appium/java_client/mac/options/SupportsShowServerLogsOption.java @@ -24,8 +24,17 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code showServerLogs} capability: whether the WebDriverAgentMac server logs are shown in the + * driver log. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsShowServerLogsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code showServerLogs} capability. + */ String SHOW_SERVER_LOGS_OPTION = "showServerLogs"; /** diff --git a/src/main/java/io/appium/java_client/mac/options/SupportsSkipAppKillOption.java b/src/main/java/io/appium/java_client/mac/options/SupportsSkipAppKillOption.java index 5c166b80a..b352deacd 100644 --- a/src/main/java/io/appium/java_client/mac/options/SupportsSkipAppKillOption.java +++ b/src/main/java/io/appium/java_client/mac/options/SupportsSkipAppKillOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code skipAppKill} capability: whether the application is left running after the session ends. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSkipAppKillOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code skipAppKill} capability. + */ String SKIP_APP_KILL_OPTION = "skipAppKill"; /** diff --git a/src/main/java/io/appium/java_client/mac/options/SupportsSystemHostOption.java b/src/main/java/io/appium/java_client/mac/options/SupportsSystemHostOption.java index 8f6a92cc1..704f60208 100644 --- a/src/main/java/io/appium/java_client/mac/options/SupportsSystemHostOption.java +++ b/src/main/java/io/appium/java_client/mac/options/SupportsSystemHostOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Support for the {@code systemHost} capability: the host name the WebDriverAgentMac server listens on. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSystemHostOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code systemHost} capability. + */ String SYSTEM_HOST_OPTION = "systemHost"; /** diff --git a/src/main/java/io/appium/java_client/mac/options/SupportsSystemPortOption.java b/src/main/java/io/appium/java_client/mac/options/SupportsSystemPortOption.java index bf648a7bb..7087a73f9 100644 --- a/src/main/java/io/appium/java_client/mac/options/SupportsSystemPortOption.java +++ b/src/main/java/io/appium/java_client/mac/options/SupportsSystemPortOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Support for the {@code systemPort} capability: the port the driver server listens on. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSystemPortOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code systemPort} capability. + */ String SYSTEM_PORT_OPTION = "systemPort"; /** diff --git a/src/main/java/io/appium/java_client/mac/options/SupportsWebDriverAgentMacUrlOption.java b/src/main/java/io/appium/java_client/mac/options/SupportsWebDriverAgentMacUrlOption.java index 9f968c9c0..972c929cb 100644 --- a/src/main/java/io/appium/java_client/mac/options/SupportsWebDriverAgentMacUrlOption.java +++ b/src/main/java/io/appium/java_client/mac/options/SupportsWebDriverAgentMacUrlOption.java @@ -24,8 +24,16 @@ import java.net.URL; import java.util.Optional; +/** + * Support for the {@code webDriverAgentMacUrl} capability: the URL of an already running WebDriverAgentMac server. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsWebDriverAgentMacUrlOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code webDriverAgentMacUrl} capability. + */ String WEB_DRIVER_AGENT_MAC_URL_OPTION = "webDriverAgentMacUrl"; /** diff --git a/src/main/java/io/appium/java_client/pagefactory/AppiumElementLocatorFactory.java b/src/main/java/io/appium/java_client/pagefactory/AppiumElementLocatorFactory.java index f423d1dca..056d75b55 100644 --- a/src/main/java/io/appium/java_client/pagefactory/AppiumElementLocatorFactory.java +++ b/src/main/java/io/appium/java_client/pagefactory/AppiumElementLocatorFactory.java @@ -30,6 +30,7 @@ import static io.appium.java_client.pagefactory.WithTimeout.DurationBuilder.build; import static java.util.Optional.ofNullable; +/** Factory of locators for Appium-specific page object annotations. */ public class AppiumElementLocatorFactory implements CacheableElementLocatorFactory { private final SearchContext searchContext; private final WeakReference searchContextReference; diff --git a/src/main/java/io/appium/java_client/pagefactory/AppiumFieldDecorator.java b/src/main/java/io/appium/java_client/pagefactory/AppiumFieldDecorator.java index 64195cb40..3d8e9b42b 100644 --- a/src/main/java/io/appium/java_client/pagefactory/AppiumFieldDecorator.java +++ b/src/main/java/io/appium/java_client/pagefactory/AppiumFieldDecorator.java @@ -66,6 +66,7 @@ public class AppiumFieldDecorator implements FieldDecorator { WebElement.class, AppiumWebElement.class ); + /** The default timeout of waiting for an element presence. */ public static final Duration DEFAULT_WAITING_TIMEOUT = ofSeconds(1); private final WeakReference webDriverReference; private final DefaultFieldDecorator defaultElementFieldDecorator; @@ -96,6 +97,12 @@ context, duration, new WidgetByBuilder(platform, automation) ); } + /** + * Creates field decorator based on {@link SearchContext} and the default timeout. + * + * @param context is an instance of {@link SearchContext}, for example {@link WebDriver}, + * {@link WebElement} or {@link Widget}. + */ public AppiumFieldDecorator(SearchContext context) { this(context, DEFAULT_WAITING_TIMEOUT); } diff --git a/src/main/java/io/appium/java_client/pagefactory/DefaultElementByBuilder.java b/src/main/java/io/appium/java_client/pagefactory/DefaultElementByBuilder.java index 2b967317b..5c5b078f2 100644 --- a/src/main/java/io/appium/java_client/pagefactory/DefaultElementByBuilder.java +++ b/src/main/java/io/appium/java_client/pagefactory/DefaultElementByBuilder.java @@ -46,6 +46,7 @@ import static java.util.Arrays.asList; import static java.util.Optional.ofNullable; +/** Builds locators of elements from Appium-specific page object annotations. */ public class DefaultElementByBuilder extends AppiumByBuilder { private static final String PRIORITY = "priority"; @@ -53,6 +54,12 @@ public class DefaultElementByBuilder extends AppiumByBuilder { private static final Class[] ANNOTATION_ARGUMENTS = new Class[]{}; private static final Object[] ANNOTATION_PARAMETERS = new Object[]{}; + /** + * Creates a new builder. + * + * @param platform the name of the current platform + * @param automation the name of the current automation + */ public DefaultElementByBuilder(String platform, String automation) { super(platform, automation); } diff --git a/src/main/java/io/appium/java_client/pagefactory/ElementInterceptor.java b/src/main/java/io/appium/java_client/pagefactory/ElementInterceptor.java index 2c84013c1..94cd74808 100644 --- a/src/main/java/io/appium/java_client/pagefactory/ElementInterceptor.java +++ b/src/main/java/io/appium/java_client/pagefactory/ElementInterceptor.java @@ -31,6 +31,12 @@ */ public class ElementInterceptor extends InterceptorOfASingleElement { + /** + * Creates a new interceptor. + * + * @param locator the locator of the element + * @param driver the reference to the driver + */ public ElementInterceptor(ElementLocator locator, WeakReference driver) { super(locator, driver); } diff --git a/src/main/java/io/appium/java_client/pagefactory/ElementListInterceptor.java b/src/main/java/io/appium/java_client/pagefactory/ElementListInterceptor.java index c6c56d4a0..4fdc62378 100644 --- a/src/main/java/io/appium/java_client/pagefactory/ElementListInterceptor.java +++ b/src/main/java/io/appium/java_client/pagefactory/ElementListInterceptor.java @@ -30,6 +30,11 @@ */ public class ElementListInterceptor extends InterceptorOfAListOfElements { + /** + * Creates a new interceptor. + * + * @param locator the locator of the elements + */ public ElementListInterceptor(ElementLocator locator) { super(locator); } diff --git a/src/main/java/io/appium/java_client/pagefactory/HowToUseLocators.java b/src/main/java/io/appium/java_client/pagefactory/HowToUseLocators.java index cdeb9da1e..a94f83bd1 100644 --- a/src/main/java/io/appium/java_client/pagefactory/HowToUseLocators.java +++ b/src/main/java/io/appium/java_client/pagefactory/HowToUseLocators.java @@ -21,6 +21,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** Defines how groups of platform-specific locator annotations are used. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE}) public @interface HowToUseLocators { /** diff --git a/src/main/java/io/appium/java_client/pagefactory/LocatorGroupStrategy.java b/src/main/java/io/appium/java_client/pagefactory/LocatorGroupStrategy.java index 0b70cc8b0..31951ab10 100644 --- a/src/main/java/io/appium/java_client/pagefactory/LocatorGroupStrategy.java +++ b/src/main/java/io/appium/java_client/pagefactory/LocatorGroupStrategy.java @@ -16,6 +16,10 @@ package io.appium.java_client.pagefactory; +/** The strategy of using a group of locators. */ public enum LocatorGroupStrategy { - CHAIN, ALL_POSSIBLE; + /** The locators are applied one after another as a chain. */ + CHAIN, + /** Any of the locators may match. */ + ALL_POSSIBLE; } diff --git a/src/main/java/io/appium/java_client/pagefactory/Widget.java b/src/main/java/io/appium/java_client/pagefactory/Widget.java index 1b2fdaebe..3c30cb796 100644 --- a/src/main/java/io/appium/java_client/pagefactory/Widget.java +++ b/src/main/java/io/appium/java_client/pagefactory/Widget.java @@ -39,6 +39,11 @@ public abstract class Widget implements SearchContext, WrapsDriver, WrapsElement private final SearchContext element; + /** + * Creates a new widget. + * + * @param element the element the widget is based on + */ protected Widget(WebElement element) { this.element = element; } @@ -59,6 +64,11 @@ protected Widget(WebElement element) { return (WebElement) element; } + /** + * Returns the reference to this widget. + * + * @return this widget + */ public Widget getSelfReference() { return this; } diff --git a/src/main/java/io/appium/java_client/pagefactory/WidgetByBuilder.java b/src/main/java/io/appium/java_client/pagefactory/WidgetByBuilder.java index b87996357..749632702 100644 --- a/src/main/java/io/appium/java_client/pagefactory/WidgetByBuilder.java +++ b/src/main/java/io/appium/java_client/pagefactory/WidgetByBuilder.java @@ -28,8 +28,15 @@ import static io.appium.java_client.pagefactory.OverrideWidgetReader.getMobileNativeWidgetClass; import static java.util.Optional.ofNullable; +/** Builds locators of widgets from Appium-specific page object annotations. */ public class WidgetByBuilder extends DefaultElementByBuilder { + /** + * Creates a new builder. + * + * @param platform the name of the current platform + * @param automation the name of the current automation + */ public WidgetByBuilder(String platform, String automation) { super(platform, automation); } diff --git a/src/main/java/io/appium/java_client/pagefactory/WidgetInterceptor.java b/src/main/java/io/appium/java_client/pagefactory/WidgetInterceptor.java index 57061dd7b..4a26839f9 100644 --- a/src/main/java/io/appium/java_client/pagefactory/WidgetInterceptor.java +++ b/src/main/java/io/appium/java_client/pagefactory/WidgetInterceptor.java @@ -37,6 +37,7 @@ import static io.appium.java_client.pagefactory.utils.WebDriverUnpackUtility.getCurrentContentType; import static java.util.Optional.ofNullable; +/** Proxy interceptor class for widgets. */ public class WidgetInterceptor extends InterceptorOfASingleElement { private final Map> instantiationMap; @@ -45,7 +46,13 @@ public class WidgetInterceptor extends InterceptorOfASingleElement { private WeakReference cachedElementReference; /** - * Proxy interceptor class for widgets. + * Creates a new interceptor. + * + * @param locator the locator of the widget element + * @param driverReference the reference to the driver + * @param cachedElementReference the reference to the cached widget element + * @param instantiationMap the widget constructors mapped by the content type + * @param duration the timeout of waiting for an element presence */ public WidgetInterceptor( @Nullable CacheableLocator locator, diff --git a/src/main/java/io/appium/java_client/pagefactory/WidgetListInterceptor.java b/src/main/java/io/appium/java_client/pagefactory/WidgetListInterceptor.java index bb4bb1889..243ac8084 100644 --- a/src/main/java/io/appium/java_client/pagefactory/WidgetListInterceptor.java +++ b/src/main/java/io/appium/java_client/pagefactory/WidgetListInterceptor.java @@ -38,6 +38,7 @@ import static io.appium.java_client.pagefactory.utils.WebDriverUnpackUtility.getCurrentContentType; import static java.util.Optional.ofNullable; +/** Proxy interceptor class for lists of widgets. */ public class WidgetListInterceptor extends InterceptorOfAListOfElements { private final Map> instantiationMap; private final List cachedWidgets = new ArrayList<>(); @@ -47,7 +48,13 @@ public class WidgetListInterceptor extends InterceptorOfAListOfElements { private final List> cachedElementReferences = new ArrayList<>(); /** - * Proxy interceptor class for lists of widgets. + * Creates a new interceptor. + * + * @param locator the locator of the widget elements + * @param driver the reference to the driver + * @param instantiationMap the widget constructors mapped by the content type + * @param declaredType the declared widget type + * @param duration the timeout of waiting for an element presence */ public WidgetListInterceptor( @Nullable CacheableLocator locator, diff --git a/src/main/java/io/appium/java_client/pagefactory/WithTimeout.java b/src/main/java/io/appium/java_client/pagefactory/WithTimeout.java index 0b04dadf2..a209aa7e8 100644 --- a/src/main/java/io/appium/java_client/pagefactory/WithTimeout.java +++ b/src/main/java/io/appium/java_client/pagefactory/WithTimeout.java @@ -43,6 +43,9 @@ */ ChronoUnit chronoUnit(); + /** + * Builds a {@link Duration} from the {@link WithTimeout} annotation. + */ class DurationBuilder { private DurationBuilder() { } diff --git a/src/main/java/io/appium/java_client/pagefactory/bys/ContentMappedBy.java b/src/main/java/io/appium/java_client/pagefactory/bys/ContentMappedBy.java index 14967c6d7..534a03916 100644 --- a/src/main/java/io/appium/java_client/pagefactory/bys/ContentMappedBy.java +++ b/src/main/java/io/appium/java_client/pagefactory/bys/ContentMappedBy.java @@ -28,11 +28,17 @@ import static io.appium.java_client.pagefactory.bys.ContentType.NATIVE_MOBILE_SPECIFIC; import static java.util.Objects.requireNonNull; +/** Locator which selects the underlying locator by the current content type. */ @EqualsAndHashCode(callSuper = true) public class ContentMappedBy extends By { private final Map map; private ContentType currentContent = NATIVE_MOBILE_SPECIFIC; + /** + * Creates a new locator. + * + * @param map the locators mapped by the content type + */ public ContentMappedBy(Map map) { this.map = map; } diff --git a/src/main/java/io/appium/java_client/pagefactory/bys/ContentType.java b/src/main/java/io/appium/java_client/pagefactory/bys/ContentType.java index f5a17a219..d3a76d021 100644 --- a/src/main/java/io/appium/java_client/pagefactory/bys/ContentType.java +++ b/src/main/java/io/appium/java_client/pagefactory/bys/ContentType.java @@ -16,6 +16,10 @@ package io.appium.java_client.pagefactory.bys; +/** The type of the content an element belongs to. */ public enum ContentType { - HTML_OR_DEFAULT, NATIVE_MOBILE_SPECIFIC + /** The HTML (web) or default content. */ + HTML_OR_DEFAULT, + /** The native mobile content. */ + NATIVE_MOBILE_SPECIFIC } diff --git a/src/main/java/io/appium/java_client/pagefactory/bys/builder/AnnotatedElementContainer.java b/src/main/java/io/appium/java_client/pagefactory/bys/builder/AnnotatedElementContainer.java index 8b4d4957b..505aaa365 100644 --- a/src/main/java/io/appium/java_client/pagefactory/bys/builder/AnnotatedElementContainer.java +++ b/src/main/java/io/appium/java_client/pagefactory/bys/builder/AnnotatedElementContainer.java @@ -26,6 +26,12 @@ * This is the POJO for the setting/getting of an AnnotatedElement instances. */ public class AnnotatedElementContainer { + /** + * Creates a new instance. + */ + public AnnotatedElementContainer() { + } + @Getter(AccessLevel.PUBLIC) @Setter(AccessLevel.PACKAGE) private AnnotatedElement annotated; } diff --git a/src/main/java/io/appium/java_client/pagefactory/bys/builder/AppiumByBuilder.java b/src/main/java/io/appium/java_client/pagefactory/bys/builder/AppiumByBuilder.java index 649899cbd..5f9e2be23 100644 --- a/src/main/java/io/appium/java_client/pagefactory/bys/builder/AppiumByBuilder.java +++ b/src/main/java/io/appium/java_client/pagefactory/bys/builder/AppiumByBuilder.java @@ -45,6 +45,7 @@ * - Selenium Page Factory */ public abstract class AppiumByBuilder extends AbstractAnnotations { + /** The empty argument types of annotation methods. */ protected static final Class[] DEFAULT_ANNOTATION_METHOD_ARGUMENTS = new Class[]{}; private static final List METHODS_TO_BE_EXCLUDED_WHEN_ANNOTATION_IS_READ = new ArrayList() { @@ -58,10 +59,19 @@ public abstract class AppiumByBuilder extends AbstractAnnotations { .forEach(this::add); } }; + /** Holder of the annotated element to build the locator for. */ protected final AnnotatedElementContainer annotatedElementContainer; + /** The name of the current platform. */ protected final String platform; + /** The name of the current automation. */ protected final String automation; + /** + * Creates a new builder. + * + * @param platform the name of the current platform + * @param automation the name of the current automation + */ protected AppiumByBuilder(String platform, String automation) { this.annotatedElementContainer = new AnnotatedElementContainer(); this.platform = String.valueOf(platform); @@ -130,6 +140,13 @@ private static T getComplexMobileBy(Annotation[] annotations, Cla } } + /** + * Builds a locator from the given annotations. + * + * @param annotations the locator annotations + * @param howToUseLocators defines how to combine the annotations + * @return the locator or null if there are no annotations + */ @Nullable protected static By createBy(Annotation[] annotations, HowToUseSelectors howToUseLocators) { if (annotations == null || annotations.length == 0) { @@ -164,22 +181,47 @@ public void setAnnotated(AnnotatedElement annotated) { this.annotatedElementContainer.setAnnotated(annotated); } + /** + * Checks whether the current platform is Android. + * + * @return true if the platform is Android + */ protected boolean isAndroid() { return ANDROID.equalsIgnoreCase(platform); } + /** + * Checks whether the current platform is iOS. + * + * @return true if the platform is iOS + */ protected boolean isIOS() { return IOS.equalsIgnoreCase(platform); } + /** + * Checks whether the current platform is tvOS. + * + * @return true if the platform is tvOS + */ protected boolean isTvOS() { return TVOS.equalsIgnoreCase(platform); } + /** + * Checks whether the current platform is iOS and the automation is XCUITest. + * + * @return true if the platform is iOS and the automation is XCUITest + */ protected boolean isIOSXcuit() { return isIOS() && IOS_XCUI_TEST.equalsIgnoreCase(automation); } + /** + * Checks whether the current platform is Windows. + * + * @return true if the platform is Windows + */ protected boolean isWindows() { return WINDOWS.equalsIgnoreCase(platform); } @@ -196,9 +238,20 @@ protected boolean isWindows() { */ public abstract boolean isLookupCached(); + /** + * Builds the locator for the default (HTML or web) content. + * + * @return the locator or null if it is not defined + */ protected abstract By buildDefaultBy(); + /** + * Builds the locator for the native mobile content. + * + * @return the locator or null if it is not defined + */ protected abstract By buildMobileNativeBy(); + /** Verifies that the annotations of the annotated element are valid. */ protected abstract void assertValidAnnotations(); } diff --git a/src/main/java/io/appium/java_client/pagefactory/bys/builder/ByChained.java b/src/main/java/io/appium/java_client/pagefactory/bys/builder/ByChained.java index 94ff5f0d7..271b56d32 100644 --- a/src/main/java/io/appium/java_client/pagefactory/bys/builder/ByChained.java +++ b/src/main/java/io/appium/java_client/pagefactory/bys/builder/ByChained.java @@ -28,8 +28,10 @@ import static java.util.Objects.requireNonNull; +/** Finds an element by applying the given locators one after another. */ public class ByChained extends io.appium.java_client.support.pagefactory.ByChained { + /** The locators of the chain. */ private final By[] bys; private static Function getSearchingFunction(By by) { diff --git a/src/main/java/io/appium/java_client/pagefactory/bys/builder/HowToUseSelectors.java b/src/main/java/io/appium/java_client/pagefactory/bys/builder/HowToUseSelectors.java index a4d4f4fdb..7a27d34f5 100644 --- a/src/main/java/io/appium/java_client/pagefactory/bys/builder/HowToUseSelectors.java +++ b/src/main/java/io/appium/java_client/pagefactory/bys/builder/HowToUseSelectors.java @@ -16,6 +16,12 @@ package io.appium.java_client.pagefactory.bys.builder; +/** Defines how a group of locator annotations is used. */ public enum HowToUseSelectors { - USE_ONE, BUILD_CHAINED, USE_ANY + /** Only the first annotation is used. */ + USE_ONE, + /** The annotations are applied one after another as a chain. */ + BUILD_CHAINED, + /** Any of the annotations may match. */ + USE_ANY } diff --git a/src/main/java/io/appium/java_client/pagefactory/iOSXCUITFindBy.java b/src/main/java/io/appium/java_client/pagefactory/iOSXCUITFindBy.java index dbc6d23c0..af2fec395 100644 --- a/src/main/java/io/appium/java_client/pagefactory/iOSXCUITFindBy.java +++ b/src/main/java/io/appium/java_client/pagefactory/iOSXCUITFindBy.java @@ -24,6 +24,7 @@ import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; +/** Marks a field or a type to be located by iOS XCUITest-specific locators. */ @Retention(RUNTIME) @Target({FIELD, TYPE}) @Repeatable(iOSXCUITFindBySet.class) public @interface iOSXCUITFindBy { diff --git a/src/main/java/io/appium/java_client/pagefactory/iOSXCUITFindBySet.java b/src/main/java/io/appium/java_client/pagefactory/iOSXCUITFindBySet.java index ce7464d2a..e851db1dd 100644 --- a/src/main/java/io/appium/java_client/pagefactory/iOSXCUITFindBySet.java +++ b/src/main/java/io/appium/java_client/pagefactory/iOSXCUITFindBySet.java @@ -23,6 +23,9 @@ import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; +/** + * Container of repeatable {@link iOSXCUITFindBy} annotations. + */ @Retention(RUNTIME) @Target({FIELD, TYPE}) public @interface iOSXCUITFindBySet { /** diff --git a/src/main/java/io/appium/java_client/pagefactory/interceptors/InterceptorOfAListOfElements.java b/src/main/java/io/appium/java_client/pagefactory/interceptors/InterceptorOfAListOfElements.java index 884184ff9..99a6bcfdf 100644 --- a/src/main/java/io/appium/java_client/pagefactory/interceptors/InterceptorOfAListOfElements.java +++ b/src/main/java/io/appium/java_client/pagefactory/interceptors/InterceptorOfAListOfElements.java @@ -26,13 +26,29 @@ import java.util.List; import java.util.concurrent.Callable; +/** Base class of interceptors of method calls on a list of elements. */ public abstract class InterceptorOfAListOfElements implements MethodCallListener { + /** The locator used to find the elements. */ protected final ElementLocator locator; + /** + * Creates a new interceptor. + * + * @param locator the locator of the elements + */ public InterceptorOfAListOfElements(@Nullable ElementLocator locator) { this.locator = locator; } + /** + * Handles the intercepted method call. + * + * @param elements the found elements + * @param method the intercepted method + * @param args the method arguments + * @return the call result + * @throws Throwable if the call fails + */ protected abstract Object getObject( List elements, Method method, Object[] args ) throws Throwable; diff --git a/src/main/java/io/appium/java_client/pagefactory/interceptors/InterceptorOfASingleElement.java b/src/main/java/io/appium/java_client/pagefactory/interceptors/InterceptorOfASingleElement.java index 1eec5b514..5aee0246e 100644 --- a/src/main/java/io/appium/java_client/pagefactory/interceptors/InterceptorOfASingleElement.java +++ b/src/main/java/io/appium/java_client/pagefactory/interceptors/InterceptorOfASingleElement.java @@ -29,10 +29,18 @@ import java.util.Objects; import java.util.concurrent.Callable; +/** Base class of interceptors of method calls on a single element. */ public abstract class InterceptorOfASingleElement implements MethodCallListener { + /** The locator used to find the element. */ protected final ElementLocator locator; private final WeakReference driverReference; + /** + * Creates a new interceptor. + * + * @param locator the locator of the element + * @param driverReference the reference to the driver + */ public InterceptorOfASingleElement( @Nullable ElementLocator locator, WeakReference driverReference @@ -41,6 +49,15 @@ public InterceptorOfASingleElement( this.driverReference = driverReference; } + /** + * Handles the intercepted method call. + * + * @param element the found element + * @param method the intercepted method + * @param args the method arguments + * @return the call result + * @throws Throwable if the call fails + */ protected abstract Object getObject(WebElement element, Method method, Object[] args) throws Throwable; private static boolean areElementsEqual(Object we1, Object we2) { diff --git a/src/main/java/io/appium/java_client/pagefactory/locator/CacheableElementLocatorFactory.java b/src/main/java/io/appium/java_client/pagefactory/locator/CacheableElementLocatorFactory.java index 688f504c5..9cfe0f7c1 100644 --- a/src/main/java/io/appium/java_client/pagefactory/locator/CacheableElementLocatorFactory.java +++ b/src/main/java/io/appium/java_client/pagefactory/locator/CacheableElementLocatorFactory.java @@ -21,9 +21,16 @@ import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Field; +/** Factory of locators whose lookup results may be cached. */ public interface CacheableElementLocatorFactory extends ElementLocatorFactory { CacheableLocator createLocator(Field field); + /** + * Creates a locator for the given annotated element. + * + * @param annotatedElement the element annotated with locator annotations + * @return the locator or null if the element has no locator annotations + */ CacheableLocator createLocator(AnnotatedElement annotatedElement); } diff --git a/src/main/java/io/appium/java_client/pagefactory/locator/CacheableLocator.java b/src/main/java/io/appium/java_client/pagefactory/locator/CacheableLocator.java index fe8d7fce3..32fddf65f 100644 --- a/src/main/java/io/appium/java_client/pagefactory/locator/CacheableLocator.java +++ b/src/main/java/io/appium/java_client/pagefactory/locator/CacheableLocator.java @@ -18,6 +18,12 @@ import io.appium.java_client.support.pagefactory.ElementLocator; +/** Element locator whose lookup results may be cached. */ public interface CacheableLocator extends ElementLocator { + /** + * Checks whether the lookup result should be cached. + * + * @return true if the lookup result is cached + */ boolean isLookUpCached(); } diff --git a/src/main/java/io/appium/java_client/pagefactory/utils/WebDriverUnpackUtility.java b/src/main/java/io/appium/java_client/pagefactory/utils/WebDriverUnpackUtility.java index 841d16c6e..0ed8fde45 100644 --- a/src/main/java/io/appium/java_client/pagefactory/utils/WebDriverUnpackUtility.java +++ b/src/main/java/io/appium/java_client/pagefactory/utils/WebDriverUnpackUtility.java @@ -32,6 +32,9 @@ import static io.appium.java_client.pagefactory.bys.ContentType.NATIVE_MOBILE_SPECIFIC; import static java.util.Locale.ROOT; +/** + * Utilities to unpack drivers and related objects from a {@link SearchContext}. + */ public final class WebDriverUnpackUtility { private WebDriverUnpackUtility() { } @@ -40,6 +43,7 @@ private WebDriverUnpackUtility() { * This method extracts an instance of the given interface from the given {@link SearchContext}. * It is expected that the {@link SearchContext} itself or the object it wraps implements it. * + * @param the type of the object to extract * @param searchContext is an instance of {@link SearchContext}. It may be the instance of * {@link WebDriver} or {@link org.openqa.selenium.WebElement} or some other * user's extension/implementation. diff --git a/src/main/java/io/appium/java_client/plugins/storage/StorageClient.java b/src/main/java/io/appium/java_client/plugins/storage/StorageClient.java index 4e1b9e3c9..560bbf291 100644 --- a/src/main/java/io/appium/java_client/plugins/storage/StorageClient.java +++ b/src/main/java/io/appium/java_client/plugins/storage/StorageClient.java @@ -56,6 +56,7 @@ * for more details. */ public class StorageClient { + /** The route prefix of the storage plugin. */ public static final String PREFIX = "/appium/storage"; private static final String LEGACY_PREFIX = "/storage"; private static final Type MAP_TYPE = new TypeToken>() { }.getType(); diff --git a/src/main/java/io/appium/java_client/plugins/storage/StorageItem.java b/src/main/java/io/appium/java_client/plugins/storage/StorageItem.java index 17ae1472e..b07b18b02 100644 --- a/src/main/java/io/appium/java_client/plugins/storage/StorageItem.java +++ b/src/main/java/io/appium/java_client/plugins/storage/StorageItem.java @@ -2,9 +2,25 @@ import lombok.Value; +/** + * An item stored in the Appium server storage. + */ @Value public class StorageItem { String name; String path; long size; + + /** + * Creates a new storage item. + * + * @param name the item name + * @param path the item path on the server + * @param size the item size in bytes + */ + public StorageItem(String name, String path, long size) { + this.name = name; + this.path = path; + this.size = size; + } } diff --git a/src/main/java/io/appium/java_client/plugins/storage/StorageUtils.java b/src/main/java/io/appium/java_client/plugins/storage/StorageUtils.java index 93b98cb30..513d35419 100644 --- a/src/main/java/io/appium/java_client/plugins/storage/StorageUtils.java +++ b/src/main/java/io/appium/java_client/plugins/storage/StorageUtils.java @@ -27,6 +27,9 @@ import java.security.NoSuchAlgorithmException; import java.util.Formatter; +/** + * Helpers of the storage plugin client. + */ public class StorageUtils { private static final int BUFFER_SIZE = 0xFFFF; diff --git a/src/main/java/io/appium/java_client/proxy/ElementAwareWebDriverListener.java b/src/main/java/io/appium/java_client/proxy/ElementAwareWebDriverListener.java index c43a28647..78fc7f3dc 100644 --- a/src/main/java/io/appium/java_client/proxy/ElementAwareWebDriverListener.java +++ b/src/main/java/io/appium/java_client/proxy/ElementAwareWebDriverListener.java @@ -31,13 +31,23 @@ import static io.appium.java_client.proxy.Helpers.createProxy; import static net.bytebuddy.matcher.ElementMatchers.namedOneOf; +/** + * Proxies {@link AppiumWebElement} instances returned by a proxied WebDriver + * so that their method calls can be intercepted too. + */ public class ElementAwareWebDriverListener implements MethodCallListener, ProxyAwareListener { + /** + * Creates a new instance. + */ + public ElementAwareWebDriverListener() { + } + private WebDriver parent; /** * Attaches the WebDriver proxy instance to this listener. - *

- * The listener stores the WebDriver instance to associate it as parent to AppiumWebElement proxies. + * + *

The listener stores the WebDriver instance to associate it as parent to AppiumWebElement proxies. * * @param proxy A proxy instance of {@link WebDriver}. */ @@ -50,8 +60,8 @@ public void attachProxyInstance(Object proxy) { /** * Intercepts method calls on a proxied WebDriver. - *

- * If the result of the method call is a {@link AppiumWebElement}, + * + *

If the result of the method call is a {@link AppiumWebElement}, * it is wrapped with a proxy to allow further interception of AppiumWebElement method calls. * If the result is a list, each item is checked, and all AppiumWebElements are * individually proxied. All other return types are passed through unmodified. diff --git a/src/main/java/io/appium/java_client/proxy/HasMethodCallListeners.java b/src/main/java/io/appium/java_client/proxy/HasMethodCallListeners.java index b5807f71b..73a628232 100644 --- a/src/main/java/io/appium/java_client/proxy/HasMethodCallListeners.java +++ b/src/main/java/io/appium/java_client/proxy/HasMethodCallListeners.java @@ -16,6 +16,9 @@ package io.appium.java_client.proxy; +/** + * Gives access to the method call listeners of a proxy instance. + */ public interface HasMethodCallListeners { /** * The setter is dynamically created by ByteBuddy to store diff --git a/src/main/java/io/appium/java_client/proxy/Helpers.java b/src/main/java/io/appium/java_client/proxy/Helpers.java index ea1699d0a..8ee21706d 100644 --- a/src/main/java/io/appium/java_client/proxy/Helpers.java +++ b/src/main/java/io/appium/java_client/proxy/Helpers.java @@ -40,7 +40,13 @@ import static java.util.Objects.requireNonNull; import static net.bytebuddy.matcher.ElementMatchers.namedOneOf; +/** + * Helpers for creating transparent proxies of classes. + */ public class Helpers { + /** + * The names of the methods declared by {@link Object}, which are not proxied by default. + */ public static final Set OBJECT_METHOD_NAMES = Stream.of(Object.class.getMethods()) .map(Method::getName) .collect(Collectors.toSet()); diff --git a/src/main/java/io/appium/java_client/proxy/Interceptor.java b/src/main/java/io/appium/java_client/proxy/Interceptor.java index 7dd1c6eba..d85b0cdd6 100644 --- a/src/main/java/io/appium/java_client/proxy/Interceptor.java +++ b/src/main/java/io/appium/java_client/proxy/Interceptor.java @@ -29,6 +29,9 @@ import static io.appium.java_client.proxy.MethodCallListener.UNSET; +/** + * Wraps the public method calls of the proxied classes and delegates them to the listeners. + */ public class Interceptor { private static final Logger LOGGER = LoggerFactory.getLogger(Interceptor.class); @@ -48,6 +51,7 @@ private Interceptor() { * have no superclass implementation, so this may be null; unhandled calls retain * their {@link AbstractMethodError} behavior. * @return Either the original method result or the patched one. + * @throws Throwable if the original method or a listener throws */ @SuppressWarnings("unused") @RuntimeType diff --git a/src/main/java/io/appium/java_client/proxy/MethodCallListener.java b/src/main/java/io/appium/java_client/proxy/MethodCallListener.java index 7dfb5b299..3aa557084 100644 --- a/src/main/java/io/appium/java_client/proxy/MethodCallListener.java +++ b/src/main/java/io/appium/java_client/proxy/MethodCallListener.java @@ -20,7 +20,11 @@ import java.util.UUID; import java.util.concurrent.Callable; +/** + * Listens to the method calls of a proxied instance and may customize their behavior. + */ public interface MethodCallListener { + /** The marker returned by the callbacks that do not provide a result. */ UUID UNSET = UUID.randomUUID(); /** @@ -47,6 +51,7 @@ default void beforeCall(Object obj, Method method, Object[] args) { * @param args Array of method arguments * @param original The reference to the original method in case it is necessary to instrument its result. * @return The type of the returned result should be castable to the returned type of the original method. + * @throws Throwable if the replacement fails, the exception replaces the original one */ default Object call(Object obj, Method method, Object[] args, Callable original) throws Throwable { return UNSET; @@ -60,6 +65,7 @@ default Object call(Object obj, Method method, Object[] args, Callable origin * @param obj The proxy instance * @param method Method to be called * @param args Array of method arguments + * @param result The result of the method call or null if there is none */ default void afterCall(Object obj, Method method, Object[] args, Object result) { } @@ -75,6 +81,7 @@ default void afterCall(Object obj, Method method, Object[] args, Object result) * @return You could either (re)throw the exception in this callback or * overwrite the behavior and return a result from it. It is expected that the * type of the returned argument could be cast to the returned type of the original method. + * @throws Throwable if the exception is rethrown or replaced */ default Object onError(Object obj, Method method, Object[] args, Throwable e) throws Throwable { return UNSET; diff --git a/src/main/java/io/appium/java_client/proxy/NotImplementedException.java b/src/main/java/io/appium/java_client/proxy/NotImplementedException.java index 861c114c8..8b574301d 100644 --- a/src/main/java/io/appium/java_client/proxy/NotImplementedException.java +++ b/src/main/java/io/appium/java_client/proxy/NotImplementedException.java @@ -16,5 +16,14 @@ package io.appium.java_client.proxy; +/** + * Thrown by a listener callback to be skipped as not implemented. + */ public class NotImplementedException extends RuntimeException { + /** + * Creates a new instance. + */ + public NotImplementedException() { + } + } diff --git a/src/main/java/io/appium/java_client/proxy/ProxyAwareListener.java b/src/main/java/io/appium/java_client/proxy/ProxyAwareListener.java index 95d9c92fa..5c0686c62 100644 --- a/src/main/java/io/appium/java_client/proxy/ProxyAwareListener.java +++ b/src/main/java/io/appium/java_client/proxy/ProxyAwareListener.java @@ -18,21 +18,21 @@ /** * Extension of {@link MethodCallListener} that allows access to the proxy instance it depends on. - *

- * This interface is intended for listeners that need a reference to the proxy object. - *

- * The {@link #attachProxyInstance(Object)} method will be invoked immediately after the proxy is created, + * + *

This interface is intended for listeners that need a reference to the proxy object. + * + *

The {@link #attachProxyInstance(Object)} method will be invoked immediately after the proxy is created, * allowing the listener to bind to it before any method interception begins. - *

- * Example usage: Working with elements such as + * + *

Example usage: Working with elements such as * {@code AppiumWebElement} that require runtime mutation (e.g. setting parent driver or element ID). */ public interface ProxyAwareListener extends MethodCallListener { /** * Binds the listener to the proxy instance passed. - *

- * This is called once, immediately after proxy creation and before the proxy is returned to the caller. + * + *

This is called once, immediately after proxy creation and before the proxy is returned to the caller. * * @param proxy the proxy instance created via {@code createProxy} that this listener is attached to. */ diff --git a/src/main/java/io/appium/java_client/remote/AppiumCommandExecutor.java b/src/main/java/io/appium/java_client/remote/AppiumCommandExecutor.java index b04ae2f0f..aea8263c9 100644 --- a/src/main/java/io/appium/java_client/remote/AppiumCommandExecutor.java +++ b/src/main/java/io/appium/java_client/remote/AppiumCommandExecutor.java @@ -85,6 +85,13 @@ public AppiumCommandExecutor( this.serviceOptional = ofNullable(service); } + /** + * Creates an executor that talks to a local Appium service. + * + * @param additionalCommands the map of Appium commands + * @param service the local Appium service to send the commands to + * @param httpClientFactory the HTTP client factory, or {@code null} for the default one + */ public AppiumCommandExecutor(Map additionalCommands, AppiumDriverLocalService service, @Nullable Factory httpClientFactory) { @@ -92,39 +99,83 @@ public AppiumCommandExecutor(Map additionalCommands, AppiumClientConfig.defaultConfig().baseUrl(requireNonNull(service).getUrl())); } + /** + * Creates an executor that talks to the given server address. + * + * @param additionalCommands the map of Appium commands + * @param addressOfRemoteServer the address of the Appium server + * @param httpClientFactory the HTTP client factory, or {@code null} for the default one + */ public AppiumCommandExecutor(Map additionalCommands, URL addressOfRemoteServer, @Nullable Factory httpClientFactory) { this(additionalCommands, null, httpClientFactory, AppiumClientConfig.defaultConfig().baseUrl(requireNonNull(addressOfRemoteServer))); } + /** + * Creates an executor using the given client configuration. + * + * @param additionalCommands the map of Appium commands + * @param appiumClientConfig the HTTP client configuration + */ public AppiumCommandExecutor(Map additionalCommands, AppiumClientConfig appiumClientConfig) { this(additionalCommands, null, null, appiumClientConfig); } + /** + * Creates an executor that talks to the given server address. + * + * @param additionalCommands the map of Appium commands + * @param addressOfRemoteServer the address of the Appium server + */ public AppiumCommandExecutor(Map additionalCommands, URL addressOfRemoteServer) { this(additionalCommands, null, Factory.createDefault(), AppiumClientConfig.defaultConfig().baseUrl(requireNonNull(addressOfRemoteServer))); } + /** + * Creates an executor that talks to the given server address using the given client configuration. + * + * @param additionalCommands the map of Appium commands + * @param addressOfRemoteServer the address of the Appium server + * @param appiumClientConfig the HTTP client configuration + */ public AppiumCommandExecutor(Map additionalCommands, URL addressOfRemoteServer, AppiumClientConfig appiumClientConfig) { this(additionalCommands, null, Factory.createDefault(), appiumClientConfig.baseUrl(requireNonNull(addressOfRemoteServer))); } + /** + * Creates an executor that talks to a local Appium service. + * + * @param additionalCommands the map of Appium commands + * @param service the local Appium service to send the commands to + */ public AppiumCommandExecutor(Map additionalCommands, AppiumDriverLocalService service) { this(additionalCommands, service, Factory.createDefault(), AppiumClientConfig.defaultConfig().baseUrl(service.getUrl())); } + /** + * Creates an executor that talks to a local Appium service using the given client configuration. + * + * @param additionalCommands the map of Appium commands + * @param service the local Appium service to send the commands to + * @param appiumClientConfig the HTTP client configuration + */ public AppiumCommandExecutor(Map additionalCommands, AppiumDriverLocalService service, AppiumClientConfig appiumClientConfig) { this(additionalCommands, service, Factory.createDefault(), appiumClientConfig); } + /** + * Returns the additional (non-standard) commands known to this executor. + * + * @return the unmodifiable map of the additional commands + */ public Map getAdditionalCommands() { return Collections.unmodifiableMap(additionalCommands); } @@ -139,19 +190,39 @@ public URL getAddressOfRemoteServer() { return remoteServer; } + /** + * Returns the codec used to encode commands. + * + * @return the command codec, or {@code null} if the session has not been created yet + */ @Nullable protected CommandCodec getCommandCodec() { return this.commandCodec; } + /** + * Sets the codec used to encode commands. + * + * @param newCodec the command codec + */ public void setCommandCodec(CommandCodec newCodec) { this.commandCodec = newCodec; } + /** + * Sets the codec used to decode responses. + * + * @param codec the response codec + */ public void setResponseCodec(ResponseCodec codec) { this.responseCodec = codec; } + /** + * Returns the HTTP client used to send the commands. + * + * @return the HTTP client + */ public HttpClient getClient() { return this.client; } @@ -193,6 +264,7 @@ private Response createSession(Command command) { return response; } + /** Re-registers the additional commands in the current command codec. */ public void refreshAdditionalCommands() { getAdditionalCommands().forEach(this::defineCommand); } diff --git a/src/main/java/io/appium/java_client/remote/AppiumRemoteWebDriver.java b/src/main/java/io/appium/java_client/remote/AppiumRemoteWebDriver.java index 3dfd6f20b..f6745ca2d 100644 --- a/src/main/java/io/appium/java_client/remote/AppiumRemoteWebDriver.java +++ b/src/main/java/io/appium/java_client/remote/AppiumRemoteWebDriver.java @@ -85,6 +85,7 @@ public class AppiumRemoteWebDriver implements WebDriver, JavascriptExecutor, Has private final ElementLocation elementLocation = new ElementLocation(); private ErrorHandler errorHandler = new ErrorHandler(); private CommandExecutor executor; + /** The capabilities of the session. */ protected Capabilities capabilities; private @Nullable SessionId sessionId; private final ExecuteMethod executeMethod = (commandName, parameters) -> { @@ -126,11 +127,21 @@ public AppiumRemoteWebDriver(CommandExecutor executor, Capabilities capabilities } } + /** + * Returns the identifier of the current session. + * + * @return the session id, or {@code null} if there is no session + */ @Nullable public SessionId getSessionId() { return sessionId; } + /** + * Sets the identifier of the current session. + * + * @param opaqueKey the raw session id + */ protected void setSessionId(String opaqueKey) { sessionId = new SessionId(opaqueKey); } @@ -161,18 +172,38 @@ protected void startSession(Capabilities requestCapabilities) { this.sessionId = new SessionId(response.getSessionId()); } + /** + * Returns the handler of the error responses. + * + * @return the error handler + */ public ErrorHandler getErrorHandler() { return errorHandler; } + /** + * Sets the handler of the error responses. + * + * @param handler the error handler + */ public void setErrorHandler(ErrorHandler handler) { this.errorHandler = handler; } + /** + * Returns the executor of the commands. + * + * @return the command executor + */ public CommandExecutor getCommandExecutor() { return executor; } + /** + * Sets the executor of the commands. + * + * @param executor the command executor + */ protected void setCommandExecutor(CommandExecutor executor) { this.executor = executor; } @@ -389,10 +420,23 @@ protected Response execute(CommandPayload payload) { return response; } + /** + * Executes a command with the given parameters. + * + * @param driverCommand the name of the command + * @param parameters the parameters of the command + * @return the response of the server + */ protected Response execute(String driverCommand, Map parameters) { return execute(new CommandPayload(driverCommand, parameters)); } + /** + * Executes a command without parameters. + * + * @param command the name of the command + * @return the response of the server + */ protected Response execute(String command) { return execute(command, Map.of()); } @@ -407,6 +451,11 @@ private void populateWebDriverException(WebDriverException ex) { } } + /** + * Returns the helper that executes commands on behalf of extension code. + * + * @return the execute method + */ protected ExecuteMethod getExecuteMethod() { return executeMethod; } @@ -469,7 +518,16 @@ public String toString() { getSessionId()); } + /** + * The {@link Options} implementation backed by the remote session. + */ protected class RemoteWebDriverOptions implements Options { + /** + * Creates a new instance. + */ + protected RemoteWebDriverOptions() { + } + @Override public Logs logs() { return remoteLogs; @@ -548,7 +606,16 @@ public Window window() { return new RemoteWindow(); } + /** + * The {@link Timeouts} implementation backed by the remote session. + */ protected class RemoteTimeouts implements Timeouts { + /** + * Creates a new instance. + */ + protected RemoteTimeouts() { + } + @Override public Timeouts implicitlyWait(Duration duration) { execute(DriverCommand.SET_IMPLICIT_WAIT_TIMEOUT(duration)); @@ -589,7 +656,16 @@ private Duration getTimeout(String type) { } } + /** + * The {@link Window} implementation backed by the remote session. + */ protected class RemoteWindow implements Window { + /** + * Creates a new instance. + */ + protected RemoteWindow() { + } + @Override @SuppressWarnings("unchecked") public Dimension getSize() { @@ -661,7 +737,16 @@ public void refresh() { } } + /** + * The {@link TargetLocator} implementation backed by the remote session. + */ protected class RemoteTargetLocator implements TargetLocator { + /** + * Creates a new instance. + */ + protected RemoteTargetLocator() { + } + @Override public WebDriver frame(int frameIndex) { execute(DriverCommand.SWITCH_TO_FRAME(frameIndex)); diff --git a/src/main/java/io/appium/java_client/remote/AppiumW3CHttpResponseCodec.java b/src/main/java/io/appium/java_client/remote/AppiumW3CHttpResponseCodec.java index 33c78b321..7e40bd09d 100644 --- a/src/main/java/io/appium/java_client/remote/AppiumW3CHttpResponseCodec.java +++ b/src/main/java/io/appium/java_client/remote/AppiumW3CHttpResponseCodec.java @@ -36,6 +36,12 @@ * {@code W3CHttpResponseCodec} (Apache License 2.0). */ public class AppiumW3CHttpResponseCodec implements ResponseCodec { + /** + * Creates a new instance. + */ + public AppiumW3CHttpResponseCodec() { + } + private static final Type MAP_TYPE = new TypeToken>() { }.getType(); private final ErrorCodes errorCodes = new ErrorCodes(); diff --git a/src/main/java/io/appium/java_client/remote/AppiumWebElement.java b/src/main/java/io/appium/java_client/remote/AppiumWebElement.java index 87c786239..df40f5e62 100644 --- a/src/main/java/io/appium/java_client/remote/AppiumWebElement.java +++ b/src/main/java/io/appium/java_client/remote/AppiumWebElement.java @@ -44,28 +44,58 @@ * {@link AppiumRemoteWebDriver}. Adapted from Selenium's {@code RemoteWebElement} (Apache License 2.0). */ public class AppiumWebElement implements WebElement, Locatable, TakesScreenshot, WrapsDriver { + /** + * Creates a new instance. + */ + public AppiumWebElement() { + } + /** * The key of an element reference in the W3C protocol. */ public static final String ELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf"; private @Nullable String foundBy; + /** The element reference id assigned by the server. */ protected String id; + /** The driver that found this element. */ protected AppiumRemoteWebDriver parent; + /** + * Records how the element has been found. + * + * @param foundFrom the search context the element has been found in + * @param locator the name of the locator strategy + * @param term the locator value + */ protected void setFoundBy(SearchContext foundFrom, String locator, String term) { this.foundBy = String.format("[%s] -> %s: %s", foundFrom, locator, term); } + /** + * Sets the driver that found this element. + * + * @param parent the parent driver + */ public void setParent(AppiumRemoteWebDriver parent) { this.parent = parent; } + /** + * Returns the element reference id. + * + * @return the element id, or {@code null} if it is not set + */ @Nullable public String getId() { return id; } + /** + * Sets the element reference id. + * + * @param id the element id + */ public void setId(String id) { this.id = id; } @@ -182,6 +212,12 @@ public WebElement findElement(By locator) { return parent.findElement(this, (using, value) -> FIND_CHILD_ELEMENT(getId(), using, value), locator); } + /** + * Executes the command payload in the context of this element. + * + * @param payload the command payload + * @return the response of the server + */ protected Response execute(CommandPayload payload) { try { return parent.execute(payload); @@ -191,6 +227,13 @@ protected Response execute(CommandPayload payload) { } } + /** + * Executes the command in the context of this element. + * + * @param command the name of the command + * @param parameters the parameters of the command + * @return the response of the server + */ protected Response execute(String command, Map parameters) { try { return parent.execute(command, parameters); diff --git a/src/main/java/io/appium/java_client/remote/AutomationName.java b/src/main/java/io/appium/java_client/remote/AutomationName.java index e941d516b..ed5e9c699 100644 --- a/src/main/java/io/appium/java_client/remote/AutomationName.java +++ b/src/main/java/io/appium/java_client/remote/AutomationName.java @@ -16,28 +16,31 @@ package io.appium.java_client.remote; +/** + * The names of the automation backends (drivers) supported by Appium. + */ public interface AutomationName { // Officially supported drivers - // https://github.com/appium/appium-xcuitest-driver + /** The automation name of the XCUITest driver for iOS and tvOS. */ String IOS_XCUI_TEST = "XCuiTest"; - // https://github.com/appium/appium-uiautomator2-driver + /** The automation name of the UiAutomator2 driver for Android. */ String ANDROID_UIAUTOMATOR2 = "UIAutomator2"; - // https://github.com/appium/appium-espresso-driver + /** The automation name of the Espresso driver for Android. */ String ESPRESSO = "Espresso"; - // https://github.com/appium/appium-mac2-driver + /** The automation name of the Mac2 driver for macOS. */ String MAC2 = "Mac2"; - // https://github.com/appium/appium-windows-driver + /** The automation name of the Windows driver. */ String WINDOWS = "Windows"; - // https://github.com/appium/appium-safari-driver + /** The automation name of the Safari driver. */ String SAFARI = "Safari"; - // https://github.com/appium/appium-geckodriver + /** The automation name of the Gecko driver for Firefox. */ String GECKO = "Gecko"; - // https://github.com/appium/appium-chromium-driver + /** The automation name of the Chromium driver. */ String CHROMIUM = "Chromium"; // Third-party drivers - // https://github.com/YOU-i-Labs/appium-youiengine-driver + /** The automation name of the YouiEngine driver. */ String YOUI_ENGINE = "youiengine"; - //https://github.com/AppiumTestDistribution/appium-flutter-integration-driver + /** The automation name of the Flutter Integration driver. */ String FLUTTER_INTEGRATION = "FlutterIntegration"; } diff --git a/src/main/java/io/appium/java_client/remote/CapabilityType.java b/src/main/java/io/appium/java_client/remote/CapabilityType.java index 6a9bcaf36..6e401241b 100644 --- a/src/main/java/io/appium/java_client/remote/CapabilityType.java +++ b/src/main/java/io/appium/java_client/remote/CapabilityType.java @@ -20,7 +20,9 @@ * The names of the standard W3C capabilities that java-client refers to. */ public final class CapabilityType { + /** The name of the browser, as defined by W3C. */ public static final String BROWSER_NAME = "browserName"; + /** The name of the platform, as defined by W3C. */ public static final String PLATFORM_NAME = "platformName"; private CapabilityType() { diff --git a/src/main/java/io/appium/java_client/remote/Command.java b/src/main/java/io/appium/java_client/remote/Command.java index 4ccd5a50f..4f4f1122f 100644 --- a/src/main/java/io/appium/java_client/remote/Command.java +++ b/src/main/java/io/appium/java_client/remote/Command.java @@ -29,28 +29,62 @@ public class Command { private final @Nullable SessionId sessionId; private final CommandPayload payload; + /** + * Creates a command without parameters. + * + * @param sessionId the session the command is executed in + * @param name the name of the command + */ public Command(SessionId sessionId, String name) { this(sessionId, name, new HashMap<>()); } + /** + * Creates a command with parameters. + * + * @param sessionId the session the command is executed in, or {@code null} for session-less commands + * @param name the name of the command + * @param parameters the parameters of the command + */ public Command(@Nullable SessionId sessionId, String name, Map parameters) { this(sessionId, new CommandPayload(name, parameters)); } + /** + * Creates a command from a payload. + * + * @param sessionId the session the command is executed in, or {@code null} for session-less commands + * @param payload the name and the parameters of the command + */ public Command(@Nullable SessionId sessionId, CommandPayload payload) { this.sessionId = sessionId; this.payload = payload; } + /** + * Returns the session the command is executed in. + * + * @return the session id, or {@code null} for session-less commands + */ @Nullable public SessionId getSessionId() { return sessionId; } + /** + * Returns the name of the command. + * + * @return the command name + */ public String getName() { return payload.getName(); } + /** + * Returns the parameters of the command. + * + * @return the command parameters + */ public Map getParameters() { return payload.getParameters(); } diff --git a/src/main/java/io/appium/java_client/remote/CommandCodec.java b/src/main/java/io/appium/java_client/remote/CommandCodec.java index a100deb73..e4e285f8d 100644 --- a/src/main/java/io/appium/java_client/remote/CommandCodec.java +++ b/src/main/java/io/appium/java_client/remote/CommandCodec.java @@ -32,6 +32,12 @@ public interface CommandCodec { */ HttpRequest encode(Command command); + /** + * Checks whether the command is supported by this codec. + * + * @param commandName the name of the command + * @return {@code true} if the command is defined + */ boolean isSupported(String commandName); /** diff --git a/src/main/java/io/appium/java_client/remote/CommandPayload.java b/src/main/java/io/appium/java_client/remote/CommandPayload.java index 418885a09..09ce86f8d 100644 --- a/src/main/java/io/appium/java_client/remote/CommandPayload.java +++ b/src/main/java/io/appium/java_client/remote/CommandPayload.java @@ -29,15 +29,31 @@ public class CommandPayload { private final String name; private final Map parameters; + /** + * Creates a payload. + * + * @param name the name of the command + * @param parameters the parameters of the command + */ public CommandPayload(String name, Map parameters) { this.name = requireNonNull(name, "name"); this.parameters = requireNonNull(parameters, "parameters"); } + /** + * Returns the name of the command. + * + * @return the command name + */ public String getName() { return name; } + /** + * Returns the parameters of the command. + * + * @return the command parameters + */ public Map getParameters() { return parameters; } diff --git a/src/main/java/io/appium/java_client/remote/DirectConnect.java b/src/main/java/io/appium/java_client/remote/DirectConnect.java index fb1a05c51..c191c6eb8 100644 --- a/src/main/java/io/appium/java_client/remote/DirectConnect.java +++ b/src/main/java/io/appium/java_client/remote/DirectConnect.java @@ -28,6 +28,7 @@ import static io.appium.java_client.internal.CapabilityHelpers.APPIUM_PREFIX; +/** The direct connect settings that the server returns in the new session response. */ public class DirectConnect { private static final String DIRECT_CONNECT_PROTOCOL = "directConnectProtocol"; private static final String DIRECT_CONNECT_PATH = "directConnectPath"; diff --git a/src/main/java/io/appium/java_client/remote/DriverCommand.java b/src/main/java/io/appium/java_client/remote/DriverCommand.java index e3672c92c..407d4b95b 100644 --- a/src/main/java/io/appium/java_client/remote/DriverCommand.java +++ b/src/main/java/io/appium/java_client/remote/DriverCommand.java @@ -41,99 +41,194 @@ */ @SuppressWarnings({"checkstyle:MethodName", "checkstyle:AbbreviationAsWordInName"}) public final class DriverCommand { + /** Gets the capabilities of the session. */ public static final String GET_CAPABILITIES = "getCapabilities"; + /** Creates a new session. */ public static final String NEW_SESSION = "newSession"; + /** Gets the status of the server. */ public static final String STATUS = "status"; + /** Closes the current window. */ public static final String CLOSE = "close"; + /** Ends the session. */ public static final String QUIT = "quit"; + /** Navigates to the given URL. */ public static final String GET = "get"; + /** Navigates back in the browser history. */ public static final String GO_BACK = "goBack"; + /** Navigates forward in the browser history. */ public static final String GO_FORWARD = "goForward"; + /** Reloads the current page. */ public static final String REFRESH = "refresh"; + /** Adds a cookie. */ public static final String ADD_COOKIE = "addCookie"; + /** Gets all cookies. */ public static final String GET_ALL_COOKIES = "getCookies"; + /** Gets a cookie by name. */ public static final String GET_COOKIE = "getCookie"; + /** Deletes a cookie by name. */ public static final String DELETE_COOKIE = "deleteCookie"; + /** Deletes all cookies. */ public static final String DELETE_ALL_COOKIES = "deleteAllCookies"; + /** Finds an element. */ public static final String FIND_ELEMENT = "findElement"; + /** Finds multiple elements. */ public static final String FIND_ELEMENTS = "findElements"; + /** Finds an element inside another element. */ public static final String FIND_CHILD_ELEMENT = "findChildElement"; + /** Finds multiple elements inside another element. */ public static final String FIND_CHILD_ELEMENTS = "findChildElements"; + /** Clears the content of an element. */ public static final String CLEAR_ELEMENT = "clearElement"; + /** Clicks an element. */ public static final String CLICK_ELEMENT = "clickElement"; + /** Sends keys to an element. */ public static final String SEND_KEYS_TO_ELEMENT = "sendKeysToElement"; + /** Submits the form an element belongs to. */ public static final String SUBMIT_ELEMENT = "submitElement"; + /** Gets the handle of the current window. */ public static final String GET_CURRENT_WINDOW_HANDLE = "getCurrentWindowHandle"; + /** Gets the handles of all windows. */ public static final String GET_WINDOW_HANDLES = "getWindowHandles"; + /** Switches to the given window. */ public static final String SWITCH_TO_WINDOW = "switchToWindow"; + /** Creates a new window or tab and switches to it. */ public static final String SWITCH_TO_NEW_WINDOW = "newWindow"; + /** Switches to the given frame. */ public static final String SWITCH_TO_FRAME = "switchToFrame"; + /** Switches to the parent of the current frame. */ public static final String SWITCH_TO_PARENT_FRAME = "switchToParentFrame"; + /** Gets the element that currently has focus. */ public static final String GET_ACTIVE_ELEMENT = "getActiveElement"; + /** Gets the URL of the current page. */ public static final String GET_CURRENT_URL = "getCurrentUrl"; + /** Gets the source of the current page. */ public static final String GET_PAGE_SOURCE = "getPageSource"; + /** Gets the title of the current page. */ public static final String GET_TITLE = "getTitle"; + /** Executes a script synchronously. */ public static final String EXECUTE_SCRIPT = "executeScript"; + /** Executes a script asynchronously. */ public static final String EXECUTE_ASYNC_SCRIPT = "executeAsyncScript"; + /** Gets the visible text of an element. */ public static final String GET_ELEMENT_TEXT = "getElementText"; + /** Gets the tag name of an element. */ public static final String GET_ELEMENT_TAG_NAME = "getElementTagName"; + /** Checks whether an element is selected. */ public static final String IS_ELEMENT_SELECTED = "isElementSelected"; + /** Checks whether an element is enabled. */ public static final String IS_ELEMENT_ENABLED = "isElementEnabled"; + /** Checks whether an element is displayed. */ public static final String IS_ELEMENT_DISPLAYED = "isElementDisplayed"; + /** Gets the position and the size of an element. */ public static final String GET_ELEMENT_RECT = "getElementRect"; + /** Gets the position of an element. */ public static final String GET_ELEMENT_LOCATION = "getElementLocation"; + /** Gets the position of an element after it has been scrolled into view. */ public static final String GET_ELEMENT_LOCATION_ONCE_SCROLLED_INTO_VIEW = "getElementLocationOnceScrolledIntoView"; + /** Gets the size of an element. */ public static final String GET_ELEMENT_SIZE = "getElementSize"; + /** Gets a DOM property of an element. */ public static final String GET_ELEMENT_DOM_PROPERTY = "getElementDomProperty"; + /** Gets a DOM attribute of an element. */ public static final String GET_ELEMENT_DOM_ATTRIBUTE = "getElementDomAttribute"; + /** Gets an attribute or a property of an element. */ public static final String GET_ELEMENT_ATTRIBUTE = "getElementAttribute"; + /** Gets the value of a CSS property of an element. */ public static final String GET_ELEMENT_VALUE_OF_CSS_PROPERTY = "getElementValueOfCssProperty"; + /** Gets the ARIA role of an element. */ public static final String GET_ELEMENT_ARIA_ROLE = "getElementAriaRole"; + /** Gets the accessible name of an element. */ public static final String GET_ELEMENT_ACCESSIBLE_NAME = "getElementAccessibleName"; + /** Gets the shadow root of an element. */ public static final String GET_ELEMENT_SHADOW_ROOT = "getElementShadowRoot"; + /** Finds an element inside a shadow root. */ public static final String FIND_ELEMENT_FROM_SHADOW_ROOT = "findElementFromShadowRoot"; + /** Finds multiple elements inside a shadow root. */ public static final String FIND_ELEMENTS_FROM_SHADOW_ROOT = "findElementsFromShadowRoot"; + /** Adds a virtual authenticator. */ public static final String ADD_VIRTUAL_AUTHENTICATOR = "addVirtualAuthenticator"; + /** Removes a virtual authenticator. */ public static final String REMOVE_VIRTUAL_AUTHENTICATOR = "removeVirtualAuthenticator"; + /** Adds a credential to a virtual authenticator. */ public static final String ADD_CREDENTIAL = "addCredential"; + /** Gets the credentials of a virtual authenticator. */ public static final String GET_CREDENTIALS = "getCredentials"; + /** Removes a credential from a virtual authenticator. */ public static final String REMOVE_CREDENTIAL = "removeCredential"; + /** Removes all credentials from a virtual authenticator. */ public static final String REMOVE_ALL_CREDENTIALS = "removeAllCredentials"; + /** Sets whether the virtual authenticator reports the user as verified. */ public static final String SET_USER_VERIFIED = "setUserVerified"; + /** Cancels the federated credential management dialog. */ public static final String CANCEL_DIALOG = "cancelDialog"; + /** Selects an account in the federated credential management dialog. */ public static final String SELECT_ACCOUNT = "selectAccount"; + /** Clicks the button of the federated credential management dialog. */ public static final String CLICK_DIALOG = "clickDialog"; + /** Gets the accounts of the federated credential management dialog. */ public static final String GET_ACCOUNTS = "getAccounts"; + /** Gets the title of the federated credential management dialog. */ public static final String GET_FEDCM_TITLE = "getFedCmTitle"; + /** Gets the type of the federated credential management dialog. */ public static final String GET_FEDCM_DIALOG_TYPE = "getFedCmDialogType"; + /** Enables or disables the delay of the federated credential management dialog. */ public static final String SET_DELAY_ENABLED = "setDelayEnabled"; + /** Resets the cooldown of the federated credential management dialog. */ public static final String RESET_COOLDOWN = "resetCooldown"; + /** Takes a screenshot of the page. */ public static final String SCREENSHOT = "screenshot"; + /** Takes a screenshot of an element. */ public static final String ELEMENT_SCREENSHOT = "elementScreenshot"; + /** Accepts the alert. */ public static final String ACCEPT_ALERT = "acceptAlert"; + /** Dismisses the alert. */ public static final String DISMISS_ALERT = "dismissAlert"; + /** Gets the text of the alert. */ public static final String GET_ALERT_TEXT = "getAlertText"; + /** Types text into the alert prompt. */ public static final String SET_ALERT_VALUE = "setAlertValue"; + /** Gets the session timeouts. */ public static final String GET_TIMEOUTS = "getTimeouts"; + /** Sets a session timeout. */ public static final String SET_TIMEOUT = "setTimeout"; + /** Prints the page to PDF. */ public static final String PRINT_PAGE = "printPage"; + /** Sets the implicit wait timeout. */ public static final String IMPLICITLY_WAIT = "implicitlyWait"; + /** Sets the script timeout. */ public static final String SET_SCRIPT_TIMEOUT = "setScriptTimeout"; + /** Performs a sequence of input actions. */ public static final String ACTIONS = "actions"; + /** Releases all input actions that are currently pressed. */ public static final String CLEAR_ACTIONS_STATE = "clearActionState"; + /** Sets the position of the current window. */ public static final String SET_CURRENT_WINDOW_POSITION = "setWindowPosition"; + /** Gets the position of the current window. */ public static final String GET_CURRENT_WINDOW_POSITION = "getWindowPosition"; + /** Sets the size of the current window. */ public static final String SET_CURRENT_WINDOW_SIZE = "setCurrentWindowSize"; + /** Gets the size of the current window. */ public static final String GET_CURRENT_WINDOW_SIZE = "getCurrentWindowSize"; + /** Maximizes the current window. */ public static final String MAXIMIZE_CURRENT_WINDOW = "maximizeCurrentWindow"; + /** Minimizes the current window. */ public static final String MINIMIZE_CURRENT_WINDOW = "minimizeCurrentWindow"; + /** Makes the current window fullscreen. */ public static final String FULLSCREEN_CURRENT_WINDOW = "fullscreenCurrentWindow"; + /** Gets the available log types. */ public static final String GET_AVAILABLE_LOG_TYPES = "getAvailableLogTypes"; + /** Gets the log of the given type. */ public static final String GET_LOG = "getLog"; private DriverCommand() { } + /** + * Creates the new session payload for a single set of capabilities. + * + * @param capabilities the capabilities + * @return the command payload + */ public static CommandPayload NEW_SESSION(Capabilities capabilities) { return NEW_SESSION(singleton(requireNonNull(capabilities, "Capabilities"))); } @@ -152,138 +247,359 @@ public static CommandPayload NEW_SESSION(Collection capabilities) return new CommandPayload(NEW_SESSION, Map.of("capabilities", capabilities)); } + /** + * Creates the payload of the command that navigates to the given URL. + * + * @param url the URL to navigate to + * @return the command payload + */ public static CommandPayload GET(String url) { return new CommandPayload(GET, Map.of("url", url)); } + /** + * Creates the payload of the command that adds a cookie. + * + * @param cookie the cookie to add + * @return the command payload + */ public static CommandPayload ADD_COOKIE(Cookie cookie) { return new CommandPayload(ADD_COOKIE, Map.of("cookie", cookie)); } + /** + * Creates the payload of the command that deletes a cookie by name. + * + * @param name the cookie name + * @return the command payload + */ public static CommandPayload DELETE_COOKIE(String name) { return new CommandPayload(DELETE_COOKIE, Map.of("name", name)); } + /** + * Creates the payload of the command that finds an element. + * + * @param strategy the locator strategy + * @param value the locator value + * @return the command payload + */ public static CommandPayload FIND_ELEMENT(String strategy, Object value) { return new CommandPayload(FIND_ELEMENT, Map.of("using", strategy, "value", value)); } + /** + * Creates the payload of the command that finds multiple elements. + * + * @param strategy the locator strategy + * @param value the locator value + * @return the command payload + */ public static CommandPayload FIND_ELEMENTS(String strategy, Object value) { return new CommandPayload(FIND_ELEMENTS, Map.of("using", strategy, "value", value)); } + /** + * Creates the payload of the command that finds an element inside another element. + * + * @param id the element id + * @param strategy the locator strategy + * @param value the locator value + * @return the command payload + */ public static CommandPayload FIND_CHILD_ELEMENT(String id, String strategy, Object value) { return new CommandPayload(FIND_CHILD_ELEMENT, Map.of("id", id, "using", strategy, "value", value)); } + /** + * Creates the payload of the command that finds multiple elements inside another element. + * + * @param id the element id + * @param strategy the locator strategy + * @param value the locator value + * @return the command payload + */ public static CommandPayload FIND_CHILD_ELEMENTS(String id, String strategy, Object value) { return new CommandPayload(FIND_CHILD_ELEMENTS, Map.of("id", id, "using", strategy, "value", value)); } + /** + * Creates the payload of the command that clears the content of an element. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload CLEAR_ELEMENT(String id) { return new CommandPayload(CLEAR_ELEMENT, Map.of("id", id)); } + /** + * Creates the payload of the command that clicks an element. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload CLICK_ELEMENT(String id) { return new CommandPayload(CLICK_ELEMENT, Map.of("id", id)); } + /** + * Creates the payload of the command that sends keys to an element. + * + * @param id the element id + * @param keysToSend the keys to send + * @return the command payload + */ public static CommandPayload SEND_KEYS_TO_ELEMENT(String id, CharSequence[] keysToSend) { return new CommandPayload(SEND_KEYS_TO_ELEMENT, Map.of("id", id, "value", keysToSend)); } + /** + * Creates the payload of the command that submits the form an element belongs to. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload SUBMIT_ELEMENT(String id) { return new CommandPayload(SUBMIT_ELEMENT, Map.of("id", id)); } + /** + * Creates the payload of the command that switches to the given window. + * + * @param windowHandleOrName the window handle or name + * @return the command payload + */ public static CommandPayload SWITCH_TO_WINDOW(String windowHandleOrName) { return new CommandPayload(SWITCH_TO_WINDOW, Map.of("handle", windowHandleOrName)); } + /** + * Creates the payload of the command that creates a new window or tab and switches to it. + * + * @param typeHint the type of the new window + * @return the command payload + */ public static CommandPayload SWITCH_TO_NEW_WINDOW(WindowType typeHint) { return new CommandPayload(SWITCH_TO_NEW_WINDOW, Map.of("type", typeHint.toString())); } + /** + * Creates the payload of the command that switches to the given frame. + * + * @param frame the frame index, name, or element, or {@code null} for the top-level context + * @return the command payload + */ public static CommandPayload SWITCH_TO_FRAME(@Nullable Object frame) { return new CommandPayload(SWITCH_TO_FRAME, singletonMap("id", frame)); } + /** + * Creates the payload of the command that executes a script synchronously. + * + * @param script the script to execute + * @param args the script arguments + * @return the command payload + */ public static CommandPayload EXECUTE_SCRIPT(String script, List args) { return new CommandPayload(EXECUTE_SCRIPT, Map.of("script", script, "args", args)); } + /** + * Creates the payload of the command that executes a script asynchronously. + * + * @param script the script to execute + * @param args the script arguments + * @return the command payload + */ public static CommandPayload EXECUTE_ASYNC_SCRIPT(String script, List args) { return new CommandPayload(EXECUTE_ASYNC_SCRIPT, Map.of("script", script, "args", args)); } + /** + * Creates the payload of the command that gets the visible text of an element. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload GET_ELEMENT_TEXT(String id) { return new CommandPayload(GET_ELEMENT_TEXT, Map.of("id", id)); } + /** + * Creates the payload of the command that gets the tag name of an element. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload GET_ELEMENT_TAG_NAME(String id) { return new CommandPayload(GET_ELEMENT_TAG_NAME, Map.of("id", id)); } + /** + * Creates the payload of the command that checks whether an element is selected. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload IS_ELEMENT_SELECTED(String id) { return new CommandPayload(IS_ELEMENT_SELECTED, Map.of("id", id)); } + /** + * Creates the payload of the command that checks whether an element is enabled. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload IS_ELEMENT_ENABLED(String id) { return new CommandPayload(IS_ELEMENT_ENABLED, Map.of("id", id)); } + /** + * Creates the payload of the command that checks whether an element is displayed. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload IS_ELEMENT_DISPLAYED(String id) { return new CommandPayload(IS_ELEMENT_DISPLAYED, Map.of("id", id)); } + /** + * Creates the payload of the command that gets the position and the size of an element. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload GET_ELEMENT_RECT(String id) { return new CommandPayload(GET_ELEMENT_RECT, Map.of("id", id)); } + /** + * Creates the payload of the command that gets the position of an element. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload GET_ELEMENT_LOCATION(String id) { return new CommandPayload(GET_ELEMENT_LOCATION, Map.of("id", id)); } + /** + * Creates the payload of the command that gets the position of an element after it has been scrolled into view. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload GET_ELEMENT_LOCATION_ONCE_SCROLLED_INTO_VIEW(String id) { return new CommandPayload(GET_ELEMENT_LOCATION_ONCE_SCROLLED_INTO_VIEW, Map.of("id", id)); } + /** + * Creates the payload of the command that gets the size of an element. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload GET_ELEMENT_SIZE(String id) { return new CommandPayload(GET_ELEMENT_SIZE, Map.of("id", id)); } + /** + * Creates the payload of the command that gets a DOM property of an element. + * + * @param id the element id + * @param name the property name + * @return the command payload + */ public static CommandPayload GET_ELEMENT_DOM_PROPERTY(String id, String name) { return new CommandPayload(GET_ELEMENT_DOM_PROPERTY, Map.of("id", id, "name", name)); } + /** + * Creates the payload of the command that gets a DOM attribute of an element. + * + * @param id the element id + * @param name the attribute name + * @return the command payload + */ public static CommandPayload GET_ELEMENT_DOM_ATTRIBUTE(String id, String name) { return new CommandPayload(GET_ELEMENT_DOM_ATTRIBUTE, Map.of("id", id, "name", name)); } + /** + * Creates the payload of the command that gets an attribute or a property of an element. + * + * @param id the element id + * @param name the attribute name + * @return the command payload + */ public static CommandPayload GET_ELEMENT_ATTRIBUTE(String id, String name) { return new CommandPayload(GET_ELEMENT_ATTRIBUTE, Map.of("id", id, "name", name)); } + /** + * Creates the payload of the command that gets the value of a CSS property of an element. + * + * @param id the element id + * @param name the CSS property name + * @return the command payload + */ public static CommandPayload GET_ELEMENT_VALUE_OF_CSS_PROPERTY(String id, String name) { return new CommandPayload(GET_ELEMENT_VALUE_OF_CSS_PROPERTY, Map.of("id", id, "propertyName", name)); } + /** + * Creates the payload of the command that gets the ARIA role of an element. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload GET_ELEMENT_ARIA_ROLE(String id) { return new CommandPayload(GET_ELEMENT_ARIA_ROLE, Map.of("id", id)); } + /** + * Creates the payload of the command that gets the accessible name of an element. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload GET_ELEMENT_ACCESSIBLE_NAME(String id) { return new CommandPayload(GET_ELEMENT_ACCESSIBLE_NAME, Map.of("id", id)); } + /** + * Creates the payload of the command that gets the shadow root of an element. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload GET_ELEMENT_SHADOW_ROOT(String id) { return new CommandPayload(GET_ELEMENT_SHADOW_ROOT, Map.of("id", requireNonNull(id, "Element ID"))); } + /** + * Creates the payload of the command that finds an element inside a shadow root. + * + * @param shadowId the shadow root id + * @param strategy the locator strategy + * @param value the locator value + * @return the command payload + */ public static CommandPayload FIND_ELEMENT_FROM_SHADOW_ROOT(String shadowId, String strategy, Object value) { return new CommandPayload(FIND_ELEMENT_FROM_SHADOW_ROOT, shadowFinder(shadowId, strategy, value)); } + /** + * Creates the payload of the command that finds multiple elements inside a shadow root. + * + * @param shadowId the shadow root id + * @param strategy the locator strategy + * @param value the locator value + * @return the command payload + */ public static CommandPayload FIND_ELEMENTS_FROM_SHADOW_ROOT(String shadowId, String strategy, Object value) { return new CommandPayload(FIND_ELEMENTS_FROM_SHADOW_ROOT, shadowFinder(shadowId, strategy, value)); } @@ -294,50 +610,121 @@ private static Map shadowFinder(String shadowId, String strategy "value", requireNonNull(value, "Value for finding strategy")); } + /** + * Creates the payload of the command that selects an account in the federated credential management dialog. + * + * @param index the index of the account + * @return the command payload + */ public static CommandPayload SELECT_ACCOUNT(int index) { return new CommandPayload(SELECT_ACCOUNT, Map.of("accountIndex", index)); } + /** + * Creates the payload of the command that enables or disables the delay of the FedCM dialog. + * + * @param enabled whether the delay is enabled + * @return the command payload + */ public static CommandPayload SET_DELAY_ENABLED(boolean enabled) { return new CommandPayload(SET_DELAY_ENABLED, Map.of("enabled", enabled)); } + /** + * Creates the payload of the command that takes a screenshot of an element. + * + * @param id the element id + * @return the command payload + */ public static CommandPayload ELEMENT_SCREENSHOT(String id) { return new CommandPayload(ELEMENT_SCREENSHOT, Map.of("id", id)); } + /** + * Creates the payload of the command that types text into the alert prompt. + * + * @param keysToSend the text to type + * @return the command payload + */ public static CommandPayload SET_ALERT_VALUE(String keysToSend) { return new CommandPayload(SET_ALERT_VALUE, Map.of("text", keysToSend)); } + /** + * Creates the payload of the command that prints the page to PDF. + * + * @param options the print options + * @return the command payload + */ public static CommandPayload PRINT_PAGE(PrintOptions options) { return new CommandPayload(PRINT_PAGE, options.toMap()); } + /** + * Creates the payload of the command that sets the implicit wait timeout. + * + * @param duration the timeout value + * @return the command payload + */ public static CommandPayload SET_IMPLICIT_WAIT_TIMEOUT(Duration duration) { return new CommandPayload(SET_TIMEOUT, Map.of("implicit", duration.toMillis())); } + /** + * Creates the payload of the command that sets the script timeout. + * + * @param duration the timeout value + * @return the command payload + */ public static CommandPayload SET_SCRIPT_TIMEOUT(Duration duration) { return new CommandPayload(SET_TIMEOUT, Map.of("script", duration.toMillis())); } + /** + * Creates the payload of the command that sets the page load timeout. + * + * @param duration the timeout value + * @return the command payload + */ public static CommandPayload SET_PAGE_LOAD_TIMEOUT(Duration duration) { return new CommandPayload(SET_TIMEOUT, Map.of("pageLoad", duration.toMillis())); } + /** + * Creates the payload of the command that performs a sequence of input actions. + * + * @param actions the action sequences + * @return the command payload + */ public static CommandPayload ACTIONS(Collection actions) { return new CommandPayload(ACTIONS, Map.of("actions", actions)); } + /** + * Creates the payload of the command that sets the position of the current window. + * + * @param targetPosition the target position + * @return the command payload + */ public static CommandPayload SET_CURRENT_WINDOW_POSITION(Point targetPosition) { return new CommandPayload(SET_CURRENT_WINDOW_POSITION, Map.of("x", targetPosition.x, "y", targetPosition.y)); } + /** + * Creates the payload of the command that gets the position of the current window. + * + * @return the command payload + */ public static CommandPayload GET_CURRENT_WINDOW_POSITION() { return new CommandPayload(GET_CURRENT_WINDOW_POSITION, Map.of("windowHandle", "current")); } + /** + * Creates the payload of the command that sets the size of the current window. + * + * @param targetSize the target size + * @return the command payload + */ public static CommandPayload SET_CURRENT_WINDOW_SIZE(Dimension targetSize) { return new CommandPayload(SET_CURRENT_WINDOW_SIZE, Map.of("width", targetSize.width, "height", targetSize.height)); diff --git a/src/main/java/io/appium/java_client/remote/ErrorCodes.java b/src/main/java/io/appium/java_client/remote/ErrorCodes.java index 4054c4a4a..50ef2890d 100644 --- a/src/main/java/io/appium/java_client/remote/ErrorCodes.java +++ b/src/main/java/io/appium/java_client/remote/ErrorCodes.java @@ -52,36 +52,72 @@ * Adapted from Selenium's {@code ErrorCodes} (Apache License 2.0). */ public class ErrorCodes { + /** + * Creates a new instance. + */ + public ErrorCodes() { + } + + /** The W3C-style success status string. */ public static final String SUCCESS_STRING = "success"; + /** The status code of a successful command. */ public static final int SUCCESS = 0; + /** The session does not exist. */ public static final int NO_SUCH_SESSION = 6; + /** The element could not be found. */ public static final int NO_SUCH_ELEMENT = 7; + /** The frame could not be found. */ public static final int NO_SUCH_FRAME = 8; + /** The command is not known to the server. */ public static final int UNKNOWN_COMMAND = 9; + /** The element is no longer attached to the document. */ public static final int STALE_ELEMENT_REFERENCE = 10; + /** The element is in a state that does not allow the operation. */ public static final int INVALID_ELEMENT_STATE = 12; + /** An unknown server-side error occurred. */ public static final int UNHANDLED_ERROR = 13; + /** The executed script has thrown an error. */ public static final int JAVASCRIPT_ERROR = 17; + /** An XPath lookup failed. */ public static final int XPATH_LOOKUP_ERROR = 19; + /** The operation has timed out. */ public static final int TIMEOUT = 21; + /** The window could not be found. */ public static final int NO_SUCH_WINDOW = 23; + /** The cookie domain is not valid for the current page. */ public static final int INVALID_COOKIE_DOMAIN = 24; + /** The cookie could not be set. */ public static final int UNABLE_TO_SET_COOKIE = 25; + /** An unexpected alert is open. */ public static final int UNEXPECTED_ALERT_PRESENT = 26; + /** There is no alert to operate on. */ public static final int NO_ALERT_PRESENT = 27; + /** The asynchronous script has timed out. */ public static final int ASYNC_SCRIPT_TIMEOUT = 28; + /** The element locator is not valid. */ public static final int INVALID_SELECTOR_ERROR = 32; + /** The session could not be created. */ public static final int SESSION_NOT_CREATED = 33; + /** The move target is outside of the viewport. */ public static final int MOVE_TARGET_OUT_OF_BOUNDS = 34; + /** The XPath expression is not valid. */ public static final int INVALID_XPATH_SELECTOR = 51; + /** The XPath expression does not return the expected type. */ public static final int INVALID_XPATH_SELECTOR_RETURN_TYPER = 52; // The JSON wire protocol has no status codes for the W3C errors below, so they are made up + /** The element cannot be interacted with. */ public static final int ELEMENT_NOT_INTERACTABLE = 60; + /** An argument of the command is not valid. */ public static final int INVALID_ARGUMENT = 61; + /** The cookie could not be found. */ public static final int NO_SUCH_COOKIE = 62; + /** The screenshot could not be taken. */ public static final int UNABLE_TO_CAPTURE_SCREEN = 63; + /** The click has been intercepted by another element. */ public static final int ELEMENT_CLICK_INTERCEPTED = 64; + /** The shadow root could not be found. */ public static final int NO_SUCH_SHADOW_ROOT = 65; + /** The HTTP method is not allowed for the endpoint. */ public static final int METHOD_NOT_ALLOWED = 405; private static final List KNOWN_ERRORS = List.of( diff --git a/src/main/java/io/appium/java_client/remote/ErrorHandler.java b/src/main/java/io/appium/java_client/remote/ErrorHandler.java index a608ccca6..13111a8c9 100644 --- a/src/main/java/io/appium/java_client/remote/ErrorHandler.java +++ b/src/main/java/io/appium/java_client/remote/ErrorHandler.java @@ -35,10 +35,16 @@ public class ErrorHandler { private final ErrorCodes errorCodes; + /** Creates a handler with the default error codes. */ public ErrorHandler() { this(new ErrorCodes()); } + /** + * Creates a handler with the given error codes. + * + * @param codes the error codes mapping + */ public ErrorHandler(ErrorCodes codes) { this.errorCodes = codes; } diff --git a/src/main/java/io/appium/java_client/remote/HideKeyboardStrategy.java b/src/main/java/io/appium/java_client/remote/HideKeyboardStrategy.java index eb4be26ae..6cee93230 100644 --- a/src/main/java/io/appium/java_client/remote/HideKeyboardStrategy.java +++ b/src/main/java/io/appium/java_client/remote/HideKeyboardStrategy.java @@ -16,8 +16,13 @@ package io.appium.java_client.remote; +/** + * The strategies of hiding the on-screen keyboard. + */ public interface HideKeyboardStrategy { + /** Hides the keyboard by tapping outside of it. */ String TAP_OUTSIDE = "tapOutside"; + /** Hides the keyboard by pressing a key. */ String PRESS_KEY = "pressKey"; } diff --git a/src/main/java/io/appium/java_client/remote/MobileBrowserType.java b/src/main/java/io/appium/java_client/remote/MobileBrowserType.java index bcd0382a2..f9aabc2f3 100644 --- a/src/main/java/io/appium/java_client/remote/MobileBrowserType.java +++ b/src/main/java/io/appium/java_client/remote/MobileBrowserType.java @@ -16,10 +16,18 @@ package io.appium.java_client.remote; +/** + * The names of the mobile browsers. + */ public interface MobileBrowserType { + /** The stock Android browser. */ String ANDROID = "Android"; + /** The Safari browser. */ String SAFARI = "Safari"; + /** The generic default browser. */ String BROWSER = "Browser"; + /** The Chromium browser. */ String CHROMIUM = "Chromium"; + /** The Chrome browser. */ String CHROME = "Chrome"; } diff --git a/src/main/java/io/appium/java_client/remote/MobilePlatform.java b/src/main/java/io/appium/java_client/remote/MobilePlatform.java index 97e8deaf3..defd67eed 100644 --- a/src/main/java/io/appium/java_client/remote/MobilePlatform.java +++ b/src/main/java/io/appium/java_client/remote/MobilePlatform.java @@ -16,12 +16,21 @@ package io.appium.java_client.remote; +/** + * The names of the mobile and desktop platforms supported by Appium. + */ public interface MobilePlatform { + /** The Android platform. */ String ANDROID = "Android"; + /** The iOS platform. */ String IOS = "iOS"; + /** The Firefox OS platform. */ String FIREFOX_OS = "FirefoxOS"; + /** The Windows platform. */ String WINDOWS = "Windows"; + /** The tvOS platform. */ String TVOS = "tvOS"; + /** The macOS platform. */ String MAC = "Mac"; } diff --git a/src/main/java/io/appium/java_client/remote/Response.java b/src/main/java/io/appium/java_client/remote/Response.java index 3542f4e13..67ca0abec 100644 --- a/src/main/java/io/appium/java_client/remote/Response.java +++ b/src/main/java/io/appium/java_client/remote/Response.java @@ -29,9 +29,15 @@ public class Response { private volatile @Nullable Integer status; private volatile @Nullable String state; + /** Creates an empty response. */ public Response() { } + /** + * Creates a response bound to a session. + * + * @param sessionId the session the response belongs to + */ public Response(SessionId sessionId) { this.sessionId = String.valueOf(sessionId); } @@ -46,6 +52,11 @@ public Integer getStatus() { return status; } + /** + * Sets the legacy numeric status. + * + * @param status the status + */ public void setStatus(@Nullable Integer status) { this.status = status; } @@ -60,24 +71,49 @@ public String getState() { return state; } + /** + * Sets the W3C error code or "success". + * + * @param state the state + */ public void setState(@Nullable String state) { this.state = state; } + /** + * Returns the payload of the response. + * + * @return the value or null if it is not set + */ @Nullable public Object getValue() { return value; } + /** + * Sets the payload of the response. + * + * @param value the value + */ public void setValue(@Nullable Object value) { this.value = value; } + /** + * Returns the identifier of the session the response belongs to. + * + * @return the session id or null if it is not set + */ @Nullable public String getSessionId() { return sessionId; } + /** + * Sets the identifier of the session the response belongs to. + * + * @param sessionId the session id + */ public void setSessionId(@Nullable String sessionId) { this.sessionId = sessionId; } diff --git a/src/main/java/io/appium/java_client/remote/ResponseCodec.java b/src/main/java/io/appium/java_client/remote/ResponseCodec.java index 98e33fce9..8a43de53c 100644 --- a/src/main/java/io/appium/java_client/remote/ResponseCodec.java +++ b/src/main/java/io/appium/java_client/remote/ResponseCodec.java @@ -22,5 +22,11 @@ * Translates HTTP responses into command responses. */ public interface ResponseCodec { + /** + * Decodes an HTTP response. + * + * @param encodedResponse the HTTP response to decode + * @return the decoded response + */ Response decode(HttpResponse encodedResponse); } diff --git a/src/main/java/io/appium/java_client/remote/ScreenshotException.java b/src/main/java/io/appium/java_client/remote/ScreenshotException.java index 92629d160..8ea80dd7e 100644 --- a/src/main/java/io/appium/java_client/remote/ScreenshotException.java +++ b/src/main/java/io/appium/java_client/remote/ScreenshotException.java @@ -23,14 +23,30 @@ * Thrown if a screenshot cannot be taken, or if the server attached one to an error. */ public class ScreenshotException extends WebDriverException { + /** + * Creates an exception with a message. + * + * @param message the detail message + */ public ScreenshotException(String message) { super(message); } + /** + * Creates an exception with a cause. + * + * @param cause the cause + */ public ScreenshotException(Throwable cause) { super(cause); } + /** + * Creates an exception with a message and a cause. + * + * @param message the detail message + * @param cause the cause, or {@code null} if there is none + */ public ScreenshotException(String message, @Nullable Throwable cause) { super(message, cause); } diff --git a/src/main/java/io/appium/java_client/remote/SessionId.java b/src/main/java/io/appium/java_client/remote/SessionId.java index d7208b212..84274c93e 100644 --- a/src/main/java/io/appium/java_client/remote/SessionId.java +++ b/src/main/java/io/appium/java_client/remote/SessionId.java @@ -29,12 +29,23 @@ public class SessionId implements Serializable { private static final long serialVersionUID = 1L; + /** The raw session identifier. */ private final String opaqueKey; + /** + * Creates a session id from a UUID. + * + * @param uuid the UUID of the session + */ public SessionId(UUID uuid) { this(requireNonNull(uuid, "Session ID key").toString()); } + /** + * Creates a session id from a raw value. + * + * @param opaqueKey the raw session identifier + */ public SessionId(String opaqueKey) { this.opaqueKey = requireNonNull(opaqueKey, "Session ID key"); } diff --git a/src/main/java/io/appium/java_client/remote/SupportsContextSwitching.java b/src/main/java/io/appium/java_client/remote/SupportsContextSwitching.java index 06762901f..3f462fef9 100644 --- a/src/main/java/io/appium/java_client/remote/SupportsContextSwitching.java +++ b/src/main/java/io/appium/java_client/remote/SupportsContextSwitching.java @@ -30,6 +30,7 @@ import static java.util.Objects.requireNonNull; +/** Provides the ability to switch between native and web contexts. */ public interface SupportsContextSwitching extends WebDriver, ExecutesMethod { /** * Switches to the given context. diff --git a/src/main/java/io/appium/java_client/remote/SupportsLocation.java b/src/main/java/io/appium/java_client/remote/SupportsLocation.java index c19dcc96c..84f0095f5 100644 --- a/src/main/java/io/appium/java_client/remote/SupportsLocation.java +++ b/src/main/java/io/appium/java_client/remote/SupportsLocation.java @@ -27,6 +27,7 @@ import java.util.Map; import java.util.Optional; +/** Provides access to the geolocation of the device. */ public interface SupportsLocation extends WebDriver, ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/remote/SupportsRotation.java b/src/main/java/io/appium/java_client/remote/SupportsRotation.java index dd695933f..a39099552 100644 --- a/src/main/java/io/appium/java_client/remote/SupportsRotation.java +++ b/src/main/java/io/appium/java_client/remote/SupportsRotation.java @@ -26,6 +26,7 @@ import static java.util.Locale.ROOT; +/** Provides access to the rotation and the orientation of the device. */ public interface SupportsRotation extends WebDriver, ExecutesMethod { /** * Get device rotation. @@ -38,10 +39,20 @@ default DeviceRotation rotation() { return new DeviceRotation((Map) response.getValue()); } + /** + * Sets the device rotation. + * + * @param rotation the rotation to apply + */ default void rotate(DeviceRotation rotation) { execute(MobileCommand.SET_SCREEN_ROTATION, rotation.parameters()); } + /** + * Sets the device orientation. + * + * @param orientation the orientation to apply + */ default void rotate(ScreenOrientation orientation) { execute(MobileCommand.SET_SCREEN_ORIENTATION, Map.of("orientation", orientation.value().toUpperCase(ROOT))); diff --git a/src/main/java/io/appium/java_client/remote/UnreachableBrowserException.java b/src/main/java/io/appium/java_client/remote/UnreachableBrowserException.java index 408519fd5..1f1bab1ae 100644 --- a/src/main/java/io/appium/java_client/remote/UnreachableBrowserException.java +++ b/src/main/java/io/appium/java_client/remote/UnreachableBrowserException.java @@ -22,10 +22,21 @@ * Thrown if the server cannot be reached, because its address is invalid or it has died. */ public class UnreachableBrowserException extends WebDriverException { + /** + * Creates an exception with a message. + * + * @param message the detail message + */ public UnreachableBrowserException(String message) { super(message); } + /** + * Creates an exception with a message and a cause. + * + * @param message the detail message + * @param cause the cause + */ public UnreachableBrowserException(String message, Throwable cause) { super(message, cause); } diff --git a/src/main/java/io/appium/java_client/remote/options/BaseMapOptionData.java b/src/main/java/io/appium/java_client/remote/options/BaseMapOptionData.java index dc5ada3a5..02eb20220 100644 --- a/src/main/java/io/appium/java_client/remote/options/BaseMapOptionData.java +++ b/src/main/java/io/appium/java_client/remote/options/BaseMapOptionData.java @@ -24,17 +24,33 @@ import java.util.Map; import java.util.Optional; +/** + * Base class for option data objects that are stored as a key-value map. + * + * @param The concrete data type, used for chaining. + */ public abstract class BaseMapOptionData> { private Map options; private static final Gson GSON = new Gson(); + /** Creates an empty data object. */ public BaseMapOptionData() { } + /** + * Creates a data object backed by the given map. + * + * @param options The initial option values. + */ public BaseMapOptionData(Map options) { this.options = options; } + /** + * Creates a data object from a JSON object string. + * + * @param json The JSON representation of the initial option values. + */ public BaseMapOptionData(String json) { //noinspection unchecked this((Map) GSON.fromJson(json, Map.class)); @@ -73,10 +89,20 @@ public Optional getOptionValue(String name) { .map(opts -> (R) opts.getOrDefault(name, null)); } + /** + * Get the option values as a map. + * + * @return The option values; empty if none have been set. + */ public Map toMap() { return Optional.ofNullable(options).orElseGet(Collections::emptyMap); } + /** + * Get the option values as a JSON object. + * + * @return The JSON representation of the option values. + */ public JsonObject toJson() { return GSON.toJsonTree(toMap()).getAsJsonObject(); } diff --git a/src/main/java/io/appium/java_client/remote/options/CanSetCapability.java b/src/main/java/io/appium/java_client/remote/options/CanSetCapability.java index c992569c6..8716fafb9 100644 --- a/src/main/java/io/appium/java_client/remote/options/CanSetCapability.java +++ b/src/main/java/io/appium/java_client/remote/options/CanSetCapability.java @@ -16,7 +16,18 @@ package io.appium.java_client.remote.options; +/** + * Marks types that allow setting capabilities and provides a chainable way to do so. + * + * @param The concrete options type, used for chaining. + */ public interface CanSetCapability> { + /** + * Sets a capability. + * + * @param key Capability name. + * @param value Capability value. + */ void setCapability(String key, Object value); /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsAcceptInsecureCertsOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsAcceptInsecureCertsOption.java index 5146d7991..51a43b43c 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsAcceptInsecureCertsOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsAcceptInsecureCertsOption.java @@ -22,8 +22,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code acceptInsecureCerts} capability: whether insecure TLS certificates are accepted. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsAcceptInsecureCertsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code acceptInsecureCerts} capability. + */ String ACCEPT_INSECURE_CERTS_OPTION = "acceptInsecureCerts"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsAppOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsAppOption.java index 043904fde..98d37595a 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsAppOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsAppOption.java @@ -21,8 +21,16 @@ import java.net.URL; import java.util.Optional; +/** + * Support for the {@code app} capability: the application to test. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsAppOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code app} capability. + */ String APP_OPTION = "app"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsAutoWebViewOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsAutoWebViewOption.java index 3cd2d7e93..60316e608 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsAutoWebViewOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsAutoWebViewOption.java @@ -22,8 +22,17 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code autoWebview} capability: whether the session switches to the first available web view + * automatically. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsAutoWebViewOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code autoWebview} capability. + */ String AUTO_WEB_VIEW_OPTION = "autoWebview"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsAutomationNameOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsAutomationNameOption.java index 2fdb5870d..a71fb8545 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsAutomationNameOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsAutomationNameOption.java @@ -20,8 +20,16 @@ import java.util.Optional; +/** + * Support for the {@code automationName} capability: the automation backend (driver) name. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsAutomationNameOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code automationName} capability. + */ String AUTOMATION_NAME_OPTION = "automationName"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsBrowserNameOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsBrowserNameOption.java index b0506feda..84ac8fb53 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsBrowserNameOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsBrowserNameOption.java @@ -18,8 +18,16 @@ import org.openqa.selenium.Capabilities; +/** + * Support for the {@code browserName} capability: the browser name. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsBrowserNameOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code browserName} capability. + */ String BROWSER_NAME_OPTION = "browserName"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsBrowserVersionOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsBrowserVersionOption.java index 0e940b5d6..4993ea74a 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsBrowserVersionOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsBrowserVersionOption.java @@ -18,8 +18,16 @@ import org.openqa.selenium.Capabilities; +/** + * Support for the {@code browserVersion} capability: the browser version. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsBrowserVersionOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code browserVersion} capability. + */ String BROWSER_VERSION_OPTION = "browserVersion"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsClearSystemFilesOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsClearSystemFilesOption.java index d30001f3e..46a0da0e2 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsClearSystemFilesOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsClearSystemFilesOption.java @@ -22,8 +22,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code clearSystemFiles} capability: whether temporary files created by the driver are deleted. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsClearSystemFilesOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code clearSystemFiles} capability. + */ String CLEAR_SYSTEM_FILES_OPTION = "clearSystemFiles"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsDeviceNameOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsDeviceNameOption.java index f1d268d1a..a9cdf6cdb 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsDeviceNameOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsDeviceNameOption.java @@ -20,8 +20,16 @@ import java.util.Optional; +/** + * Support for the {@code deviceName} capability: the device name. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsDeviceNameOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code deviceName} capability. + */ String DEVICE_NAME_OPTION = "deviceName"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsEnablePerformanceLoggingOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsEnablePerformanceLoggingOption.java index cf3601925..c1af681b0 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsEnablePerformanceLoggingOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsEnablePerformanceLoggingOption.java @@ -22,8 +22,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code enablePerformanceLogging} capability: whether performance logging is enabled. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsEnablePerformanceLoggingOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code enablePerformanceLogging} capability. + */ String ENABLE_PERFORMANCE_LOGGING_OPTION = "enablePerformanceLogging"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsEnforceAppInstallOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsEnforceAppInstallOption.java index 5e343938c..e0b791a19 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsEnforceAppInstallOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsEnforceAppInstallOption.java @@ -22,8 +22,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code enforceAppInstall} capability: whether the application is reinstalled even if already present. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsEnforceAppInstallOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code enforceAppInstall} capability. + */ String ENFORCE_APP_INSTALL_OPTION = "enforceAppInstall"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsEventTimingsOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsEventTimingsOption.java index c961841f8..d50f84179 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsEventTimingsOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsEventTimingsOption.java @@ -22,8 +22,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code eventTimings} capability: whether Appium event timings are reported. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsEventTimingsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code eventTimings} capability. + */ String EVENT_TIMINGS_OPTION = "eventTimings"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsFullResetOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsFullResetOption.java index 667bb1f3d..1cc8ba7d9 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsFullResetOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsFullResetOption.java @@ -22,8 +22,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code fullReset} capability: whether a full reset is performed before the session. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsFullResetOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code fullReset} capability. + */ String FULL_RESET_OPTION = "fullReset"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsIsHeadlessOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsIsHeadlessOption.java index 759d7b8b6..2b7d421ae 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsIsHeadlessOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsIsHeadlessOption.java @@ -22,8 +22,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code isHeadless} capability: whether the device or browser is started in headless mode. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsIsHeadlessOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code isHeadless} capability. + */ String IS_HEADLESS_OPTION = "isHeadless"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsLanguageOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsLanguageOption.java index 92b41e9f6..a77d2021e 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsLanguageOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsLanguageOption.java @@ -20,8 +20,16 @@ import java.util.Optional; +/** + * Support for the {@code language} capability: the language used by the device or application. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsLanguageOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code language} capability. + */ String LANGUAGE_OPTION = "language"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsLocaleOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsLocaleOption.java index 37689be59..47f83f838 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsLocaleOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsLocaleOption.java @@ -20,8 +20,16 @@ import java.util.Optional; +/** + * Support for the {@code locale} capability: the locale used by the device or application. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsLocaleOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code locale} capability. + */ String LOCALE_OPTION = "locale"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsNewCommandTimeoutOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsNewCommandTimeoutOption.java index f9358fa95..c76c009f1 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsNewCommandTimeoutOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsNewCommandTimeoutOption.java @@ -23,8 +23,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Support for the {@code newCommandTimeout} capability: the idle timeout after which the session is terminated. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsNewCommandTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code newCommandTimeout} capability. + */ String NEW_COMMAND_TIMEOUT_OPTION = "newCommandTimeout"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsNoResetOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsNoResetOption.java index 9116cac48..4b183a128 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsNoResetOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsNoResetOption.java @@ -22,8 +22,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code noReset} capability: whether the application state is preserved between sessions. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsNoResetOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code noReset} capability. + */ String NO_RESET_OPTION = "noReset"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsOrientationOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsOrientationOption.java index 2f5ef1645..a0efdfb3d 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsOrientationOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsOrientationOption.java @@ -23,8 +23,16 @@ import static java.util.Locale.ROOT; +/** + * Support for the {@code orientation} capability: the screen orientation. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsOrientationOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code orientation} capability. + */ String ORIENTATION_OPTION = "orientation"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsOtherAppsOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsOtherAppsOption.java index fa08176bc..33e3f734e 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsOtherAppsOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsOtherAppsOption.java @@ -20,8 +20,16 @@ import java.util.Optional; +/** + * Support for the {@code otherApps} capability: additional applications to install before the session. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsOtherAppsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code otherApps} capability. + */ String OTHER_APPS_OPTION = "otherApps"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsPageLoadStrategyOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsPageLoadStrategyOption.java index 63511c9b0..a0d8ac941 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsPageLoadStrategyOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsPageLoadStrategyOption.java @@ -23,8 +23,16 @@ import static java.util.Locale.ROOT; +/** + * Support for the {@code pageLoadStrategy} capability: the page load strategy. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsPageLoadStrategyOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code pageLoadStrategy} capability. + */ String PAGE_LOAD_STRATEGY_OPTION = "pageLoadStrategy"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsPlatformVersionOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsPlatformVersionOption.java index fbb319f32..8afd1340f 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsPlatformVersionOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsPlatformVersionOption.java @@ -20,8 +20,16 @@ import java.util.Optional; +/** + * Support for the {@code platformVersion} capability: the platform version. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsPlatformVersionOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code platformVersion} capability. + */ String PLATFORM_VERSION_OPTION = "platformVersion"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsPostrunOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsPostrunOption.java index e055cb69f..d6844f246 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsPostrunOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsPostrunOption.java @@ -20,11 +20,31 @@ import java.util.Optional; +/** + * Support for the {@code postrun} capability: the script executed after the session is finished. + * + * @param the concrete options type, returned for chaining + * @param the concrete options type, returned for chaining + */ public interface SupportsPostrunOption, S extends SystemScript> extends Capabilities, CanSetCapability { + /** + * Name of the {@code postrun} capability. + */ String POSTRUN_OPTION = "postrun"; + /** + * Sets the script to execute after the session. + * + * @param script The script data. + * @return self instance for chaining. + */ T setPostrun(S script); + /** + * Get the script to execute after the session. + * + * @return The script data. + */ Optional getPostrun(); } diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsPrerunOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsPrerunOption.java index a44d2c53f..15c4d5b22 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsPrerunOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsPrerunOption.java @@ -20,11 +20,31 @@ import java.util.Optional; +/** + * Support for the {@code prerun} capability: the script executed before the session is started. + * + * @param the concrete options type, returned for chaining + * @param the concrete options type, returned for chaining + */ public interface SupportsPrerunOption, S extends SystemScript> extends Capabilities, CanSetCapability { + /** + * Name of the {@code prerun} capability. + */ String PRERUN_OPTION = "prerun"; + /** + * Sets the script to execute before the session. + * + * @param script The script data. + * @return self instance for chaining. + */ T setPrerun(S script); + /** + * Get the script to execute before the session. + * + * @return The script data. + */ Optional getPrerun(); } diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsPrintPageSourceOnFindFailureOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsPrintPageSourceOnFindFailureOption.java index 3d82738c5..99e55043e 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsPrintPageSourceOnFindFailureOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsPrintPageSourceOnFindFailureOption.java @@ -22,8 +22,17 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code printPageSourceOnFindFailure} capability: whether the page source is logged if an element + * lookup fails. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsPrintPageSourceOnFindFailureOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code printPageSourceOnFindFailure} capability. + */ String PRINT_PAGE_SOURCE_ON_FIND_FAILURE_OPTION = "printPageSourceOnFindFailure"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsProxyOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsProxyOption.java index d69be4d2b..5a258ffe0 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsProxyOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsProxyOption.java @@ -23,8 +23,16 @@ import java.util.Map; import java.util.Optional; +/** + * Support for the {@code proxy} capability: the proxy configuration. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsProxyOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code proxy} capability. + */ String PROXY_OPTION = "proxy"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsSetWindowRectOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsSetWindowRectOption.java index 046fb6cfa..b178b0bda 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsSetWindowRectOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsSetWindowRectOption.java @@ -22,8 +22,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code setWindowRect} capability: whether the window resize and reposition commands are supported. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSetWindowRectOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code setWindowRect} capability. + */ String SET_WINDOW_RECT_OPTION = "setWindowRect"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsSkipLogCaptureOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsSkipLogCaptureOption.java index 8da26009c..f3a93a434 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsSkipLogCaptureOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsSkipLogCaptureOption.java @@ -22,8 +22,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code skipLogCapture} capability: whether the driver skips capturing device logs. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSkipLogCaptureOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code skipLogCapture} capability. + */ String SKIP_LOG_CAPTURE_OPTION = "skipLogCapture"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsUdidOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsUdidOption.java index fc1364b3d..9136f677a 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsUdidOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsUdidOption.java @@ -20,8 +20,16 @@ import java.util.Optional; +/** + * Support for the {@code udid} capability: the unique device identifier. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsUdidOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code udid} capability. + */ String UDID_OPTION = "udid"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsUnhandledPromptBehaviorOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsUnhandledPromptBehaviorOption.java index a6fded38a..fafb1b934 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsUnhandledPromptBehaviorOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsUnhandledPromptBehaviorOption.java @@ -20,8 +20,16 @@ import java.util.Optional; +/** + * Support for the {@code unhandledPromptBehavior} capability: how unexpected user prompts are handled. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsUnhandledPromptBehaviorOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code unhandledPromptBehavior} capability. + */ String UNHANDLED_PROMPT_BEHAVIOR_OPTION = "unhandledPromptBehavior"; /** diff --git a/src/main/java/io/appium/java_client/remote/options/SupportsWebSocketUrlOption.java b/src/main/java/io/appium/java_client/remote/options/SupportsWebSocketUrlOption.java index 1e14174cc..95a115ae6 100644 --- a/src/main/java/io/appium/java_client/remote/options/SupportsWebSocketUrlOption.java +++ b/src/main/java/io/appium/java_client/remote/options/SupportsWebSocketUrlOption.java @@ -20,8 +20,16 @@ import java.util.Optional; +/** + * Support for the {@code webSocketUrl} capability: the WebDriver BiDi session. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsWebSocketUrlOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code webSocketUrl} capability. + */ String WEB_SOCKET_URL = "webSocketUrl"; /** @@ -36,6 +44,7 @@ default T enableBiDi() { /** * Whether to enable BiDi session support. * + * @param value True to enable BiDi support. * @return self instance for chaining. */ default T setWebSocketUrl(boolean value) { diff --git a/src/main/java/io/appium/java_client/remote/options/SystemScript.java b/src/main/java/io/appium/java_client/remote/options/SystemScript.java index 901d8e220..868d27d48 100644 --- a/src/main/java/io/appium/java_client/remote/options/SystemScript.java +++ b/src/main/java/io/appium/java_client/remote/options/SystemScript.java @@ -19,26 +19,59 @@ import java.util.Map; import java.util.Optional; +/** + * Base class for data objects that describe a system script, provided either as a script or as a command. + * + * @param The concrete data type, used for chaining. + */ public abstract class SystemScript> extends BaseMapOptionData { + /** Creates an empty data object. */ public SystemScript() { } + /** + * Creates a data object backed by the given map. + * + * @param options The initial option values. + */ public SystemScript(Map options) { super(options); } + /** + * Sets a multiline script. + * + * @param script The script content. + * @return self instance for chaining. + */ public T withScript(String script) { return assignOptionValue("script", script); } + /** + * Get the multiline script. + * + * @return The script content. + */ public Optional getScript() { return getOptionValue("script"); } + /** + * Sets a single-line command. + * + * @param command The command to execute. + * @return self instance for chaining. + */ public T withCommand(String command) { return assignOptionValue("command", command); } + /** + * Get the single-line command. + * + * @return The command to execute. + */ public Optional getCommand() { return getOptionValue("command"); } diff --git a/src/main/java/io/appium/java_client/remote/options/UnhandledPromptBehavior.java b/src/main/java/io/appium/java_client/remote/options/UnhandledPromptBehavior.java index 52c2ea9d5..373ca79ea 100644 --- a/src/main/java/io/appium/java_client/remote/options/UnhandledPromptBehavior.java +++ b/src/main/java/io/appium/java_client/remote/options/UnhandledPromptBehavior.java @@ -21,9 +21,19 @@ import static java.util.Locale.ROOT; +/** + * Supported values of the {@code unhandledPromptBehavior} capability. + */ public enum UnhandledPromptBehavior { - DISMISS, ACCEPT, - DISMISS_AND_NOTIFY, ACCEPT_AND_NOTIFY, + /** Dismisses the prompt. */ + DISMISS, + /** Accepts the prompt. */ + ACCEPT, + /** Dismisses the prompt and notifies about it. */ + DISMISS_AND_NOTIFY, + /** Accepts the prompt and notifies about it. */ + ACCEPT_AND_NOTIFY, + /** Leaves the prompt as is. */ IGNORE; @Override diff --git a/src/main/java/io/appium/java_client/remote/options/W3CCapabilityKeys.java b/src/main/java/io/appium/java_client/remote/options/W3CCapabilityKeys.java index 09ff1680f..a19491da1 100644 --- a/src/main/java/io/appium/java_client/remote/options/W3CCapabilityKeys.java +++ b/src/main/java/io/appium/java_client/remote/options/W3CCapabilityKeys.java @@ -20,7 +20,12 @@ import java.util.regex.Pattern; import java.util.stream.Stream; +/** + * Predicate matching the capability names defined by the W3C WebDriver specification + * (plus extension capabilities with a vendor prefix). + */ public class W3CCapabilityKeys implements Predicate { + /** The shared instance of the predicate. */ public static final W3CCapabilityKeys INSTANCE = new W3CCapabilityKeys(); private static final Predicate ACCEPTED_W3C_PATTERNS = Stream.of( "^[\\w-\\.]+:.*$", @@ -39,6 +44,9 @@ public class W3CCapabilityKeys implements Predicate { .map(Pattern::asPredicate) .reduce(identity -> false, Predicate::or); + /** + * Creates the predicate; use {@link #INSTANCE} instead. + */ protected W3CCapabilityKeys() { } diff --git a/src/main/java/io/appium/java_client/safari/SafariDriver.java b/src/main/java/io/appium/java_client/safari/SafariDriver.java index 406924784..0f85c9d25 100644 --- a/src/main/java/io/appium/java_client/safari/SafariDriver.java +++ b/src/main/java/io/appium/java_client/safari/SafariDriver.java @@ -41,42 +41,95 @@ public class SafariDriver extends AppiumDriver { private static final String PLATFORM_NAME = Platform.IOS.toString(); private static final String AUTOMATION_NAME = AutomationName.SAFARI; + /** + * Creates a new instance based on command {@code executor} and {@code capabilities}. + * + * @param executor is an instance of {@link AppiumCommandExecutor} + * or class that extends it. Default commands or another vendor-specific + * commands may be specified there. + * @param capabilities take a look at {@link Capabilities} + */ public SafariDriver(AppiumCommandExecutor executor, Capabilities capabilities) { super(executor, ensurePlatformAndAutomationNames(capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium server URL and {@code capabilities}. + * + * @param remoteAddress is the address of remotely/locally started Appium server + * @param capabilities take a look at {@link Capabilities} + */ public SafariDriver(URL remoteAddress, Capabilities capabilities) { super(remoteAddress, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium server URL, HTTP client factory and {@code capabilities}. + * + * @param remoteAddress is the address of remotely/locally started Appium server + * @param httpClientFactory take a look at {@link HttpClient.Factory} + * @param capabilities take a look at {@link Capabilities} + */ public SafariDriver(URL remoteAddress, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(remoteAddress, httpClientFactory, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium driver local service and {@code capabilities}. + * + * @param service take a look at {@link AppiumDriverLocalService} + * @param capabilities take a look at {@link Capabilities} + */ public SafariDriver(AppiumDriverLocalService service, Capabilities capabilities) { super(service, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium driver local service, HTTP client factory and {@code capabilities}. + * + * @param service take a look at {@link AppiumDriverLocalService} + * @param httpClientFactory take a look at {@link HttpClient.Factory} + * @param capabilities take a look at {@link Capabilities} + */ public SafariDriver(AppiumDriverLocalService service, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(service, httpClientFactory, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium service builder and {@code capabilities}. + * + * @param builder take a look at {@link AppiumServiceBuilder} + * @param capabilities take a look at {@link Capabilities} + */ public SafariDriver(AppiumServiceBuilder builder, Capabilities capabilities) { super(builder, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium service builder, HTTP client factory and {@code capabilities}. + * + * @param builder take a look at {@link AppiumServiceBuilder} + * @param httpClientFactory take a look at {@link HttpClient.Factory} + * @param capabilities take a look at {@link Capabilities} + */ public SafariDriver(AppiumServiceBuilder builder, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(builder, httpClientFactory, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on HTTP client factory and {@code capabilities}. + * + * @param httpClientFactory take a look at {@link HttpClient.Factory} + * @param capabilities take a look at {@link Capabilities} + */ public SafariDriver(HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(httpClientFactory, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); @@ -120,6 +173,11 @@ public SafariDriver(AppiumClientConfig appiumClientConfig, Capabilities capabili capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on {@code capabilities}. + * + * @param capabilities take a look at {@link Capabilities} + */ public SafariDriver(Capabilities capabilities) { super(ensurePlatformAndAutomationNames(capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } diff --git a/src/main/java/io/appium/java_client/safari/options/SafariOptions.java b/src/main/java/io/appium/java_client/safari/options/SafariOptions.java index 9639509a1..366eed70c 100644 --- a/src/main/java/io/appium/java_client/safari/options/SafariOptions.java +++ b/src/main/java/io/appium/java_client/safari/options/SafariOptions.java @@ -53,15 +53,26 @@ public class SafariOptions extends BaseOptions implements SupportsSetWindowRectOption, SupportsProxyOption, SupportsUnhandledPromptBehaviorOption { + /** Creates options with the default capabilities set. */ public SafariOptions() { setCommonOptions(); } + /** + * Creates options from the given capabilities. + * + * @param source The capabilities to copy. + */ public SafariOptions(Capabilities source) { super(source); setCommonOptions(); } + /** + * Creates options from the given capabilities map. + * + * @param source The capabilities to copy. + */ public SafariOptions(Map source) { super(source); setCommonOptions(); diff --git a/src/main/java/io/appium/java_client/safari/options/SupportsSafariAutomaticInspectionOption.java b/src/main/java/io/appium/java_client/safari/options/SupportsSafariAutomaticInspectionOption.java index 9b6e3ad29..75b7a5c3c 100644 --- a/src/main/java/io/appium/java_client/safari/options/SupportsSafariAutomaticInspectionOption.java +++ b/src/main/java/io/appium/java_client/safari/options/SupportsSafariAutomaticInspectionOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code safari:automaticInspection} capability: whether Web Inspector is opened automatically. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSafariAutomaticInspectionOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safari:automaticInspection} capability. + */ String SAFARI_AUTOMATIC_INSPECTION_OPTION = "safari:automaticInspection"; /** diff --git a/src/main/java/io/appium/java_client/safari/options/SupportsSafariAutomaticProfilingOption.java b/src/main/java/io/appium/java_client/safari/options/SupportsSafariAutomaticProfilingOption.java index 3fcc75215..86cd57972 100644 --- a/src/main/java/io/appium/java_client/safari/options/SupportsSafariAutomaticProfilingOption.java +++ b/src/main/java/io/appium/java_client/safari/options/SupportsSafariAutomaticProfilingOption.java @@ -24,8 +24,17 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code safari:automaticProfiling} capability: whether the Web Inspector timeline profiling is + * started automatically. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSafariAutomaticProfilingOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safari:automaticProfiling} capability. + */ String SAFARI_AUTOMATIC_PROFILING_OPTION = "safari:automaticProfiling"; /** diff --git a/src/main/java/io/appium/java_client/safari/options/SupportsSafariDeviceNameOption.java b/src/main/java/io/appium/java_client/safari/options/SupportsSafariDeviceNameOption.java index 4e814d01f..ecedbc265 100644 --- a/src/main/java/io/appium/java_client/safari/options/SupportsSafariDeviceNameOption.java +++ b/src/main/java/io/appium/java_client/safari/options/SupportsSafariDeviceNameOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Support for the {@code safari:deviceName} capability: the name of the device or simulator to run Safari on. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSafariDeviceNameOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safari:deviceName} capability. + */ String SAFARI_DEVICE_NAME_OPTION = "safari:deviceName"; /** diff --git a/src/main/java/io/appium/java_client/safari/options/SupportsSafariDeviceTypeOption.java b/src/main/java/io/appium/java_client/safari/options/SupportsSafariDeviceTypeOption.java index 12179de61..f6ee28a6c 100644 --- a/src/main/java/io/appium/java_client/safari/options/SupportsSafariDeviceTypeOption.java +++ b/src/main/java/io/appium/java_client/safari/options/SupportsSafariDeviceTypeOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Support for the {@code safari:deviceType} capability: the type of the device to run Safari on. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSafariDeviceTypeOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safari:deviceType} capability. + */ String SAFARI_DEVICE_TYPE_OPTION = "safari:deviceType"; /** diff --git a/src/main/java/io/appium/java_client/safari/options/SupportsSafariDeviceUdidOption.java b/src/main/java/io/appium/java_client/safari/options/SupportsSafariDeviceUdidOption.java index 80ae57856..c81e57999 100644 --- a/src/main/java/io/appium/java_client/safari/options/SupportsSafariDeviceUdidOption.java +++ b/src/main/java/io/appium/java_client/safari/options/SupportsSafariDeviceUdidOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Support for the {@code safari:deviceUdid} capability: the UDID of the device or simulator to run Safari on. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSafariDeviceUdidOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safari:deviceUdid} capability. + */ String SAFARI_DEVICE_UDID_OPTION = "safari:deviceUdid"; /** diff --git a/src/main/java/io/appium/java_client/safari/options/SupportsSafariPlatformBuildVersionOption.java b/src/main/java/io/appium/java_client/safari/options/SupportsSafariPlatformBuildVersionOption.java index d73993fe5..deb1e8e97 100644 --- a/src/main/java/io/appium/java_client/safari/options/SupportsSafariPlatformBuildVersionOption.java +++ b/src/main/java/io/appium/java_client/safari/options/SupportsSafariPlatformBuildVersionOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Support for the {@code safari:platformBuildVersion} capability: the platform build version of the device. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSafariPlatformBuildVersionOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safari:platformBuildVersion} capability. + */ String SAFARI_PLATFORM_BUILD_VERSION_OPTION = "safari:platformBuildVersion"; /** diff --git a/src/main/java/io/appium/java_client/safari/options/SupportsSafariPlatformVersionOption.java b/src/main/java/io/appium/java_client/safari/options/SupportsSafariPlatformVersionOption.java index f6800b310..73e60279d 100644 --- a/src/main/java/io/appium/java_client/safari/options/SupportsSafariPlatformVersionOption.java +++ b/src/main/java/io/appium/java_client/safari/options/SupportsSafariPlatformVersionOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Support for the {@code safari:platformVersion} capability: the platform version of the device. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSafariPlatformVersionOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safari:platformVersion} capability. + */ String SAFARI_PLATFORM_VERSION_OPTION = "safari:platformVersion"; /** diff --git a/src/main/java/io/appium/java_client/safari/options/SupportsSafariUseSimulatorOption.java b/src/main/java/io/appium/java_client/safari/options/SupportsSafariUseSimulatorOption.java index 948ef0a45..cf04f128b 100644 --- a/src/main/java/io/appium/java_client/safari/options/SupportsSafariUseSimulatorOption.java +++ b/src/main/java/io/appium/java_client/safari/options/SupportsSafariUseSimulatorOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code safari:useSimulator} capability: whether Safari is started in a simulator. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSafariUseSimulatorOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code safari:useSimulator} capability. + */ String SAFARI_USE_SIMULATOR_OPTION = "safari:useSimulator"; /** diff --git a/src/main/java/io/appium/java_client/safari/options/SupportsWebkitWebrtcOption.java b/src/main/java/io/appium/java_client/safari/options/SupportsWebkitWebrtcOption.java index e22309f65..a30948c57 100644 --- a/src/main/java/io/appium/java_client/safari/options/SupportsWebkitWebrtcOption.java +++ b/src/main/java/io/appium/java_client/safari/options/SupportsWebkitWebrtcOption.java @@ -23,8 +23,16 @@ import java.util.Map; import java.util.Optional; +/** + * Support for the {@code webkit:WebRTC} capability: the WebRTC behavior of Safari. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsWebkitWebrtcOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code webkit:WebRTC} capability. + */ String WEBKIT_WEB_RTC_OPTION = "webkit:WebRTC"; /** diff --git a/src/main/java/io/appium/java_client/safari/options/WebrtcData.java b/src/main/java/io/appium/java_client/safari/options/WebrtcData.java index b1343432e..ea8f7cd22 100644 --- a/src/main/java/io/appium/java_client/safari/options/WebrtcData.java +++ b/src/main/java/io/appium/java_client/safari/options/WebrtcData.java @@ -21,10 +21,19 @@ import java.util.Map; import java.util.Optional; +/** + * Data object holding the {@code webkit:WebRTC} capability values. + */ public class WebrtcData extends BaseMapOptionData { + /** Creates an empty data object. */ public WebrtcData() { } + /** + * Creates a data object backed by the given map. + * + * @param options The initial option values. + */ public WebrtcData(Map options) { super(options); } diff --git a/src/main/java/io/appium/java_client/screenrecording/BaseScreenRecordingOptions.java b/src/main/java/io/appium/java_client/screenrecording/BaseScreenRecordingOptions.java index fd75dc2d6..1abe38619 100644 --- a/src/main/java/io/appium/java_client/screenrecording/BaseScreenRecordingOptions.java +++ b/src/main/java/io/appium/java_client/screenrecording/BaseScreenRecordingOptions.java @@ -21,7 +21,18 @@ import static java.util.Objects.requireNonNull; import static java.util.Optional.ofNullable; +/** + * Base class for the screen recording options. + * + * @param the actual options type, used for chaining + */ public abstract class BaseScreenRecordingOptions> { + /** + * Creates a new instance. + */ + public BaseScreenRecordingOptions() { + } + private ScreenRecordingUploadOptions uploadOptions; /** diff --git a/src/main/java/io/appium/java_client/screenrecording/BaseStartScreenRecordingOptions.java b/src/main/java/io/appium/java_client/screenrecording/BaseStartScreenRecordingOptions.java index 55716b622..153ada96b 100644 --- a/src/main/java/io/appium/java_client/screenrecording/BaseStartScreenRecordingOptions.java +++ b/src/main/java/io/appium/java_client/screenrecording/BaseStartScreenRecordingOptions.java @@ -24,8 +24,19 @@ import static java.util.Objects.requireNonNull; import static java.util.Optional.ofNullable; +/** + * Base class for the options of the screen recording start. + * + * @param the actual options type, used for chaining + */ public abstract class BaseStartScreenRecordingOptions> extends BaseScreenRecordingOptions> { + /** + * Creates a new instance. + */ + public BaseStartScreenRecordingOptions() { + } + private Boolean forceRestart; private Duration timeLimit; diff --git a/src/main/java/io/appium/java_client/screenrecording/BaseStopScreenRecordingOptions.java b/src/main/java/io/appium/java_client/screenrecording/BaseStopScreenRecordingOptions.java index 7920b5c76..be1c6bee2 100644 --- a/src/main/java/io/appium/java_client/screenrecording/BaseStopScreenRecordingOptions.java +++ b/src/main/java/io/appium/java_client/screenrecording/BaseStopScreenRecordingOptions.java @@ -16,8 +16,18 @@ package io.appium.java_client.screenrecording; +/** + * Base class for the options of the screen recording stop. + * + * @param the actual options type, used for chaining + */ public abstract class BaseStopScreenRecordingOptions> extends BaseScreenRecordingOptions> { + /** + * Creates a new instance. + */ + public BaseStopScreenRecordingOptions() { + } /** * The remotePath upload option is the path to the remote location, diff --git a/src/main/java/io/appium/java_client/screenrecording/CanRecordScreen.java b/src/main/java/io/appium/java_client/screenrecording/CanRecordScreen.java index 9743edb0a..0a878de5a 100644 --- a/src/main/java/io/appium/java_client/screenrecording/CanRecordScreen.java +++ b/src/main/java/io/appium/java_client/screenrecording/CanRecordScreen.java @@ -24,6 +24,9 @@ import static io.appium.java_client.MobileCommand.startRecordingScreenCommand; import static io.appium.java_client.MobileCommand.stopRecordingScreenCommand; +/** + * Provides the screen recording of the device under test. + */ public interface CanRecordScreen extends ExecutesMethod { /** diff --git a/src/main/java/io/appium/java_client/screenrecording/ScreenRecordingUploadOptions.java b/src/main/java/io/appium/java_client/screenrecording/ScreenRecordingUploadOptions.java index e018b47ea..0f9b25f41 100644 --- a/src/main/java/io/appium/java_client/screenrecording/ScreenRecordingUploadOptions.java +++ b/src/main/java/io/appium/java_client/screenrecording/ScreenRecordingUploadOptions.java @@ -23,7 +23,16 @@ import static java.util.Objects.requireNonNull; import static java.util.Optional.ofNullable; +/** + * Options of the screen recording upload to a remote location. + */ public class ScreenRecordingUploadOptions { + /** + * Creates a new instance. + */ + public ScreenRecordingUploadOptions() { + } + private String remotePath; private String user; private String pass; @@ -32,6 +41,11 @@ public class ScreenRecordingUploadOptions { private Map headers; private Map formFields; + /** + * Creates an empty options instance. + * + * @return a new options instance + */ public static ScreenRecordingUploadOptions uploadOptions() { return new ScreenRecordingUploadOptions(); } @@ -61,8 +75,14 @@ public ScreenRecordingUploadOptions withAuthCredentials(String user, String pass return this; } + /** + * HTTP methods supported for the upload. + */ public enum RequestMethod { - POST, PUT + /** The POST method. */ + POST, + /** The PUT method. */ + PUT } /** diff --git a/src/main/java/io/appium/java_client/serverevents/CommandEvent.java b/src/main/java/io/appium/java_client/serverevents/CommandEvent.java index 960b4fddb..73b8e7809 100644 --- a/src/main/java/io/appium/java_client/serverevents/CommandEvent.java +++ b/src/main/java/io/appium/java_client/serverevents/CommandEvent.java @@ -2,9 +2,28 @@ import lombok.Data; +/** + * A server command with its execution time range. + */ @Data public class CommandEvent { + /** The command name. */ public final String name; + /** The command start time as a Unix timestamp. */ public final long startTimestamp; + /** The command end time as a Unix timestamp. */ public final long endTimestamp; + + /** + * Creates a new command event. + * + * @param name the command name + * @param startTimestamp the command start time as a Unix timestamp + * @param endTimestamp the command end time as a Unix timestamp + */ + public CommandEvent(String name, long startTimestamp, long endTimestamp) { + this.name = name; + this.startTimestamp = startTimestamp; + this.endTimestamp = endTimestamp; + } } diff --git a/src/main/java/io/appium/java_client/serverevents/CustomEvent.java b/src/main/java/io/appium/java_client/serverevents/CustomEvent.java index 66bab4cb5..04e3e3c63 100644 --- a/src/main/java/io/appium/java_client/serverevents/CustomEvent.java +++ b/src/main/java/io/appium/java_client/serverevents/CustomEvent.java @@ -2,8 +2,17 @@ import lombok.Data; +/** + * A custom event to be logged on the server. + */ @Data public class CustomEvent { + /** + * Creates a new instance. + */ + public CustomEvent() { + } + private String vendor; private String eventName; } \ No newline at end of file diff --git a/src/main/java/io/appium/java_client/serverevents/ServerEvents.java b/src/main/java/io/appium/java_client/serverevents/ServerEvents.java index 624dd1707..f9af4e22b 100644 --- a/src/main/java/io/appium/java_client/serverevents/ServerEvents.java +++ b/src/main/java/io/appium/java_client/serverevents/ServerEvents.java @@ -7,13 +7,38 @@ import java.nio.file.Path; import java.util.List; +/** + * The events log of a server session. + */ @Data public class ServerEvents { + /** The executed commands. */ public final List commands; + /** The timed events. */ public final List events; + /** The raw JSON data returned by the server. */ public final String jsonData; + /** + * Creates a new server events log. + * + * @param commands the executed commands + * @param events the timed events + * @param jsonData the raw JSON data returned by the server + */ + public ServerEvents(List commands, List events, String jsonData) { + this.commands = commands; + this.events = events; + this.jsonData = jsonData; + } + + /** + * Saves the raw JSON data to a file. + * + * @param output the file to write to + * @throws IOException if the file cannot be written + */ public void save(Path output) throws IOException { Files.write(output, this.jsonData.getBytes()); } diff --git a/src/main/java/io/appium/java_client/serverevents/TimedEvent.java b/src/main/java/io/appium/java_client/serverevents/TimedEvent.java index 999ecbd39..5ee0928fa 100644 --- a/src/main/java/io/appium/java_client/serverevents/TimedEvent.java +++ b/src/main/java/io/appium/java_client/serverevents/TimedEvent.java @@ -4,8 +4,24 @@ import java.util.List; +/** + * A named server event with the timestamps of its occurrences. + */ @Data public class TimedEvent { + /** The event name. */ public final String name; + /** The Unix timestamps of the event occurrences. */ public final List occurrences; + + /** + * Creates a new timed event. + * + * @param name the event name + * @param occurrences the Unix timestamps of the event occurrences + */ + public TimedEvent(String name, List occurrences) { + this.name = name; + this.occurrences = occurrences; + } } diff --git a/src/main/java/io/appium/java_client/service/local/AppiumDriverLocalService.java b/src/main/java/io/appium/java_client/service/local/AppiumDriverLocalService.java index dbd1082d4..b956fd7d6 100644 --- a/src/main/java/io/appium/java_client/service/local/AppiumDriverLocalService.java +++ b/src/main/java/io/appium/java_client/service/local/AppiumDriverLocalService.java @@ -50,6 +50,9 @@ import static org.slf4j.event.Level.DEBUG; import static org.slf4j.event.Level.INFO; +/** + * Manages an Appium server process started on the local machine. + */ public final class AppiumDriverLocalService implements Closeable { private static final String URL_MASK = "http://%s:%d/"; @@ -83,14 +86,31 @@ public final class AppiumDriverLocalService implements Closeable { this.url = new URL(String.format(URL_MASK, ipAddress, nodeJSPort)); } + /** + * Builds a service with the default settings. + * + * @return a new service instance + */ public static AppiumDriverLocalService buildDefaultService() { return buildService(new AppiumServiceBuilder()); } + /** + * Builds a service using the given builder. + * + * @param builder the service builder + * @return a new service instance + */ public static AppiumDriverLocalService buildService(AppiumServiceBuilder builder) { return builder.build(); } + /** + * Sets the base path of the server. + * + * @param basePath the base path the server is listening on + * @return self instance for chaining + */ public AppiumDriverLocalService withBasePath(String basePath) { this.basePath = basePath; return this; @@ -317,6 +337,7 @@ public void addOutPutStreams(List outputStreams) { /** * Remove the outputStream which is receiving server output data. * + * @param outputStream the {@link OutputStream} to remove * @return the outputStream has been removed if it is present */ public Optional removeOutPutStream(OutputStream outputStream) { diff --git a/src/main/java/io/appium/java_client/service/local/AppiumServerAvailabilityChecker.java b/src/main/java/io/appium/java_client/service/local/AppiumServerAvailabilityChecker.java index 2876c3707..6a2f8a3d8 100644 --- a/src/main/java/io/appium/java_client/service/local/AppiumServerAvailabilityChecker.java +++ b/src/main/java/io/appium/java_client/service/local/AppiumServerAvailabilityChecker.java @@ -30,7 +30,16 @@ import java.util.List; import java.util.Optional; +/** + * Checks the availability of an Appium server by polling its status endpoint. + */ public class AppiumServerAvailabilityChecker { + /** + * Creates a new instance. + */ + public AppiumServerAvailabilityChecker() { + } + private static final Duration CONNECT_TIMEOUT = Duration.ofMillis(500); private static final Duration READ_TIMEOUT = Duration.ofSeconds(1); private static final Duration MAX_POLL_INTERVAL = Duration.ofMillis(320); @@ -91,12 +100,18 @@ private boolean checkResponse(HttpURLConnection connection) throws IOException { throw new ConnectionError(connection.getURL(), responseCode, is); } + /** + * Thrown if the server status endpoint responds with an error. + */ @Getter public static class ConnectionError extends RuntimeException { private static final int MAX_PAYLOAD_LEN = 1024; + /** The server status URL. */ private final URL statusUrl; + /** The response code received from the status URL. */ private final int responseCode; + /** The tail of the response body, if any. */ private final Optional payload; /** @@ -140,8 +155,12 @@ private static String abbreviate(List filo) { } } + /** + * Thrown if the server does not respond in time. + */ @Getter public static class ConnectionTimeout extends RuntimeException { + /** The timeout value. */ private final Duration timeout; /** diff --git a/src/main/java/io/appium/java_client/service/local/AppiumServerHasNotBeenStartedLocallyException.java b/src/main/java/io/appium/java_client/service/local/AppiumServerHasNotBeenStartedLocallyException.java index 9c0afb248..08f60985b 100644 --- a/src/main/java/io/appium/java_client/service/local/AppiumServerHasNotBeenStartedLocallyException.java +++ b/src/main/java/io/appium/java_client/service/local/AppiumServerHasNotBeenStartedLocallyException.java @@ -16,15 +16,34 @@ package io.appium.java_client.service.local; +/** + * Thrown if a local Appium server cannot be started. + */ public class AppiumServerHasNotBeenStartedLocallyException extends RuntimeException { + /** + * Creates an exception with the given message and cause. + * + * @param message the detail message + * @param cause the cause + */ public AppiumServerHasNotBeenStartedLocallyException(String message, Throwable cause) { super(message, cause); } + /** + * Creates an exception with the given message. + * + * @param message the detail message + */ public AppiumServerHasNotBeenStartedLocallyException(String message) { super(message); } + /** + * Creates an exception with the given cause. + * + * @param cause the cause + */ public AppiumServerHasNotBeenStartedLocallyException(Throwable cause) { super(cause); } diff --git a/src/main/java/io/appium/java_client/service/local/AppiumServiceBuilder.java b/src/main/java/io/appium/java_client/service/local/AppiumServiceBuilder.java index 328136b86..cd25cc702 100644 --- a/src/main/java/io/appium/java_client/service/local/AppiumServiceBuilder.java +++ b/src/main/java/io/appium/java_client/service/local/AppiumServiceBuilder.java @@ -51,6 +51,9 @@ import static java.util.Locale.ROOT; import static java.util.Objects.requireNonNull; +/** + * Builds {@link AppiumDriverLocalService} instances. + */ public final class AppiumServiceBuilder { /** @@ -66,9 +69,12 @@ public final class AppiumServiceBuilder { */ public static final String NODE_PATH = "NODE_BINARY_PATH"; + /** The IPv4 address to listen on all network interfaces. */ public static final String BROADCAST_IP4_ADDRESS = "0.0.0.0"; + /** The IPv6 address to listen on all network interfaces. */ public static final String BROADCAST_IP6_ADDRESS = "::"; private static final Path APPIUM_PATH_SUFFIX = Paths.get("appium", "build", "lib", "main.js"); + /** The default port of the Appium server. */ public static final int DEFAULT_APPIUM_PORT = 4723; private static final Duration DEFAULT_STARTUP_TIMEOUT = Duration.ofSeconds(20); private final Map serverArguments = new HashMap<>(); @@ -93,6 +99,9 @@ public final class AppiumServiceBuilder { SupportsAppOption.APP_OPTION ); + /** + * Creates a builder using the default port and the current process environment. + */ public AppiumServiceBuilder() { usingPort(DEFAULT_APPIUM_PORT); withEnvironment(System.getenv()); @@ -139,6 +148,12 @@ private static File findMainScript() { return mainAppiumJs; } + /** + * Locates the Node.js executable: the configured one, then {@link #NODE_PATH}, then the system PATH. + * + * @return the Node.js executable + * @throws InvalidServerInstanceException if the executable cannot be found + */ protected File findDefaultExecutable() { if (this.node != null) { validatePath(this.node.getAbsolutePath(), NODE_JS_NOT_EXIST_ERROR.apply(this.node)); @@ -252,6 +267,12 @@ public AppiumServiceBuilder withAppiumJS(File appiumJS) { return this; } + /** + * Sets the IP address the server listens on. + * + * @param ipAddress the IP address + * @return the self-reference. + */ public AppiumServiceBuilder withIPAddress(String ipAddress) { this.ipAddress = ipAddress; return this; diff --git a/src/main/java/io/appium/java_client/service/local/InvalidNodeJSInstance.java b/src/main/java/io/appium/java_client/service/local/InvalidNodeJSInstance.java index 4766e8723..99a5a3e9a 100644 --- a/src/main/java/io/appium/java_client/service/local/InvalidNodeJSInstance.java +++ b/src/main/java/io/appium/java_client/service/local/InvalidNodeJSInstance.java @@ -16,10 +16,19 @@ package io.appium.java_client.service.local; +/** + * Thrown if the Node.js instance is invalid. + */ public class InvalidNodeJSInstance extends RuntimeException { private static final long serialVersionUID = 1L; + /** + * Creates an exception with the given message and cause. + * + * @param message the detail message + * @param t the cause + */ public InvalidNodeJSInstance(String message, Throwable t) { super(message, t); } diff --git a/src/main/java/io/appium/java_client/service/local/InvalidServerInstanceException.java b/src/main/java/io/appium/java_client/service/local/InvalidServerInstanceException.java index 6addfbd33..5d6efeaf8 100644 --- a/src/main/java/io/appium/java_client/service/local/InvalidServerInstanceException.java +++ b/src/main/java/io/appium/java_client/service/local/InvalidServerInstanceException.java @@ -16,15 +16,28 @@ package io.appium.java_client.service.local; - +/** + * Thrown if the Appium server instance is invalid. + */ public class InvalidServerInstanceException extends RuntimeException { private static final long serialVersionUID = 1L; + /** + * Creates an exception with the given message and cause. + * + * @param message the detail message + * @param t the cause + */ public InvalidServerInstanceException(String message, Throwable t) { super(message, t); } + /** + * Creates an exception with the given message. + * + * @param message the detail message + */ public InvalidServerInstanceException(String message) { super(message); } diff --git a/src/main/java/io/appium/java_client/service/local/flags/AndroidServerFlag.java b/src/main/java/io/appium/java_client/service/local/flags/AndroidServerFlag.java index f04427d6f..b8bdf3464 100644 --- a/src/main/java/io/appium/java_client/service/local/flags/AndroidServerFlag.java +++ b/src/main/java/io/appium/java_client/service/local/flags/AndroidServerFlag.java @@ -39,7 +39,7 @@ public enum AndroidServerFlag implements ServerArgument { * ChromeDriver executable full path. */ CHROME_DRIVER_EXECUTABLE("--chromedriver-executable"), - /* + /** * Reboot emulator after each session and kill it at the end. Default: false */ REBOOT("--reboot"); diff --git a/src/main/java/io/appium/java_client/service/local/flags/ServerArgument.java b/src/main/java/io/appium/java_client/service/local/flags/ServerArgument.java index 6686d37d5..1c6da645f 100644 --- a/src/main/java/io/appium/java_client/service/local/flags/ServerArgument.java +++ b/src/main/java/io/appium/java_client/service/local/flags/ServerArgument.java @@ -16,6 +16,14 @@ package io.appium.java_client.service.local.flags; +/** + * A server command line argument. + */ public interface ServerArgument { + /** + * Returns the argument name as it is passed to the server. + * + * @return the argument name + */ String getArgument(); } diff --git a/src/main/java/io/appium/java_client/support/AbstractFindByBuilder.java b/src/main/java/io/appium/java_client/support/AbstractFindByBuilder.java index 1fe1e18e3..7370772fc 100644 --- a/src/main/java/io/appium/java_client/support/AbstractFindByBuilder.java +++ b/src/main/java/io/appium/java_client/support/AbstractFindByBuilder.java @@ -31,8 +31,27 @@ * @param the annotation type handled by the builder */ public abstract class AbstractFindByBuilder { + /** + * Creates a new instance. + */ + public AbstractFindByBuilder() { + } + + /** + * Builds the locator from the annotation. + * + * @param annotation the annotation to read + * @param field the annotated field + * @return the locator + */ public abstract By buildIt(T annotation, Field field); + /** + * Builds the locator from the {@link FindBy} annotation. + * + * @param findBy the annotation to read + * @return the locator + */ protected By buildByFromFindBy(FindBy findBy) { assertValidFindBy(findBy); @@ -44,6 +63,12 @@ protected By buildByFromFindBy(FindBy findBy) { return ans; } + /** + * Builds the locator from the short form of {@link FindBy}, for example {@code id}. + * + * @param findBy the annotation to read + * @return the locator or null if no short form is used + */ @Nullable protected By buildByFromShortFindBy(FindBy findBy) { if (!"".equals(findBy.className())) { @@ -81,16 +106,33 @@ protected By buildByFromShortFindBy(FindBy findBy) { return null; } + /** + * Builds the locator from the long form of {@link FindBy}, which is {@code how} and {@code using}. + * + * @param findBy the annotation to read + * @return the locator + */ protected By buildByFromLongFindBy(FindBy findBy) { return findBy.how().buildBy(findBy.using()); } + /** + * Verifies that every {@link FindBy} in {@link FindBys} is valid. + * + * @param findBys the annotation to verify + */ protected void assertValidFindBys(FindBys findBys) { for (FindBy findBy : findBys.value()) { assertValidFindBy(findBy); } } + /** + * Verifies that at most one location strategy is set in {@link FindBy}. + * + * @param findBy the annotation to verify + * @throws IllegalArgumentException if several location strategies are set + */ protected void assertValidFindBy(FindBy findBy) { Set finders = new HashSet<>(); if (!"".equals(findBy.using())) { @@ -129,6 +171,11 @@ protected void assertValidFindBy(FindBy findBy) { } } + /** + * Verifies that every {@link FindBy} in {@link FindAll} is valid. + * + * @param findBys the annotation to verify + */ protected void assertValidFindAll(FindAll findBys) { for (FindBy findBy : findBys.value()) { assertValidFindBy(findBy); diff --git a/src/main/java/io/appium/java_client/support/ByIdOrName.java b/src/main/java/io/appium/java_client/support/ByIdOrName.java index 820c16aae..4de13c6a4 100644 --- a/src/main/java/io/appium/java_client/support/ByIdOrName.java +++ b/src/main/java/io/appium/java_client/support/ByIdOrName.java @@ -34,8 +34,11 @@ public class ByIdOrName extends By implements Serializable { private static final long serialVersionUID = 3986638402799576701L; + /** The locator by id. */ private final By idFinder; + /** The locator by name. */ private final By nameFinder; + /** The id or name value to look for. */ private final String idOrName; /** diff --git a/src/main/java/io/appium/java_client/support/FindAll.java b/src/main/java/io/appium/java_client/support/FindAll.java index 68784c486..ed56f80ac 100644 --- a/src/main/java/io/appium/java_client/support/FindAll.java +++ b/src/main/java/io/appium/java_client/support/FindAll.java @@ -49,7 +49,16 @@ */ FindBy[] value(); + /** + * Builds the {@link By} locator from {@link FindAll}. + */ class FindByBuilder extends AbstractFindByBuilder { + /** + * Creates a new instance. + */ + public FindByBuilder() { + } + @Override public By buildIt(FindAll findBys, Field field) { assertValidFindAll(findBys); diff --git a/src/main/java/io/appium/java_client/support/FindBy.java b/src/main/java/io/appium/java_client/support/FindBy.java index 20762e4ec..6cdf34a07 100644 --- a/src/main/java/io/appium/java_client/support/FindBy.java +++ b/src/main/java/io/appium/java_client/support/FindBy.java @@ -115,7 +115,16 @@ */ String xpath() default ""; + /** + * Builds the {@link By} locator from {@link FindBy}. + */ class FindByBuilder extends AbstractFindByBuilder { + /** + * Creates a new instance. + */ + public FindByBuilder() { + } + @Override public By buildIt(FindBy findBy, Field field) { assertValidFindBy(findBy); diff --git a/src/main/java/io/appium/java_client/support/FindBys.java b/src/main/java/io/appium/java_client/support/FindBys.java index 1a18c47f6..4cf54495d 100644 --- a/src/main/java/io/appium/java_client/support/FindBys.java +++ b/src/main/java/io/appium/java_client/support/FindBys.java @@ -48,7 +48,16 @@ */ FindBy[] value(); + /** + * Builds the {@link By} locator from {@link FindBys}. + */ class FindByBuilder extends AbstractFindByBuilder { + /** + * Creates a new instance. + */ + public FindByBuilder() { + } + @Override public By buildIt(FindBys findBys, Field field) { assertValidFindBys(findBys); diff --git a/src/main/java/io/appium/java_client/support/How.java b/src/main/java/io/appium/java_client/support/How.java index f563e5579..19c441475 100644 --- a/src/main/java/io/appium/java_client/support/How.java +++ b/src/main/java/io/appium/java_client/support/How.java @@ -23,60 +23,70 @@ * Adapted from Selenium's {@code org.openqa.selenium.support.How} (Apache License 2.0). */ public enum How { + /** Locates by class name. */ CLASS_NAME { @Override public By buildBy(String value) { return By.className(value); } }, + /** Locates by CSS selector. */ CSS { @Override public By buildBy(String value) { return By.cssSelector(value); } }, + /** Locates by id. */ ID { @Override public By buildBy(String value) { return By.id(value); } }, + /** Locates by id first and then by name. */ ID_OR_NAME { @Override public By buildBy(String value) { return new ByIdOrName(value); } }, + /** Locates by link text. */ LINK_TEXT { @Override public By buildBy(String value) { return By.linkText(value); } }, + /** Locates by name. */ NAME { @Override public By buildBy(String value) { return By.name(value); } }, + /** Locates by a part of link text. */ PARTIAL_LINK_TEXT { @Override public By buildBy(String value) { return By.partialLinkText(value); } }, + /** Locates by tag name. */ TAG_NAME { @Override public By buildBy(String value) { return By.tagName(value); } }, + /** Locates by XPath. */ XPATH { @Override public By buildBy(String value) { return By.xpath(value); } }, + /** No strategy is set, which falls back to locating by id. */ UNSET { @Override public By buildBy(String value) { @@ -84,5 +94,11 @@ public By buildBy(String value) { } }; + /** + * Builds the locator for the given value. + * + * @param value the value to locate by + * @return the locator + */ public abstract By buildBy(String value); } diff --git a/src/main/java/io/appium/java_client/support/pagefactory/AbstractAnnotations.java b/src/main/java/io/appium/java_client/support/pagefactory/AbstractAnnotations.java index 507385f46..272a0460d 100644 --- a/src/main/java/io/appium/java_client/support/pagefactory/AbstractAnnotations.java +++ b/src/main/java/io/appium/java_client/support/pagefactory/AbstractAnnotations.java @@ -25,6 +25,12 @@ * (Apache License 2.0). */ public abstract class AbstractAnnotations { + /** + * Creates a new instance. + */ + public AbstractAnnotations() { + } + /** * Defines how to transform given object (field, class, etc.) into {@link By} * class used by webdriver to locate elements. diff --git a/src/main/java/io/appium/java_client/support/pagefactory/ByAll.java b/src/main/java/io/appium/java_client/support/pagefactory/ByAll.java index cb6570d9b..4e2def133 100644 --- a/src/main/java/io/appium/java_client/support/pagefactory/ByAll.java +++ b/src/main/java/io/appium/java_client/support/pagefactory/ByAll.java @@ -37,8 +37,14 @@ public class ByAll extends By implements Serializable { private static final long serialVersionUID = 4573668832699497306L; + /** The locators to search with. */ private final By[] bys; + /** + * Creates a locator that matches elements found by any of the given locators. + * + * @param bys the locators to search with + */ public ByAll(By... bys) { this.bys = bys; } diff --git a/src/main/java/io/appium/java_client/support/pagefactory/ByChained.java b/src/main/java/io/appium/java_client/support/pagefactory/ByChained.java index 38e96df20..ff9c0e6b9 100644 --- a/src/main/java/io/appium/java_client/support/pagefactory/ByChained.java +++ b/src/main/java/io/appium/java_client/support/pagefactory/ByChained.java @@ -38,8 +38,14 @@ public class ByChained extends By implements Serializable { private static final long serialVersionUID = 1563769051170172451L; + /** The locators of the chain. */ private final By[] bys; + /** + * Creates a locator that applies the given locators one after another. + * + * @param bys the locators of the chain + */ public ByChained(By... bys) { this.bys = bys; } diff --git a/src/main/java/io/appium/java_client/support/pagefactory/DefaultFieldDecorator.java b/src/main/java/io/appium/java_client/support/pagefactory/DefaultFieldDecorator.java index 7ddee33eb..4b946ee9c 100644 --- a/src/main/java/io/appium/java_client/support/pagefactory/DefaultFieldDecorator.java +++ b/src/main/java/io/appium/java_client/support/pagefactory/DefaultFieldDecorator.java @@ -42,8 +42,14 @@ */ public class DefaultFieldDecorator implements FieldDecorator { + /** The factory of element locators. */ protected ElementLocatorFactory factory; + /** + * Creates a new decorator. + * + * @param factory the factory of element locators + */ public DefaultFieldDecorator(ElementLocatorFactory factory) { this.factory = factory; } @@ -69,6 +75,12 @@ public Object decorate(ClassLoader loader, Field field) { } } + /** + * Checks whether the field is a list of {@link WebElement} with a locator annotation. + * + * @param field the field to check + * @return true if the field can be decorated + */ protected boolean isDecoratableList(Field field) { if (!List.class.isAssignableFrom(field.getType())) { return false; @@ -91,12 +103,26 @@ protected boolean isDecoratableList(Field field) { || field.getAnnotation(FindAll.class) != null; } + /** + * Creates a proxy of an element found by the locator. + * + * @param loader the class loader of the proxy + * @param locator the element locator + * @return the element proxy + */ protected WebElement proxyForLocator(ClassLoader loader, ElementLocator locator) { InvocationHandler handler = new LocatingElementHandler(locator); return (WebElement) Proxy.newProxyInstance( loader, new Class[]{WebElement.class, WrapsElement.class, Locatable.class}, handler); } + /** + * Creates a proxy of a list of elements found by the locator. + * + * @param loader the class loader of the proxy + * @param locator the element locator + * @return the list proxy + */ @SuppressWarnings("unchecked") protected List proxyForListLocator(ClassLoader loader, ElementLocator locator) { InvocationHandler handler = new LocatingElementListHandler(locator); diff --git a/src/main/java/io/appium/java_client/support/pagefactory/internal/LocatingElementHandler.java b/src/main/java/io/appium/java_client/support/pagefactory/internal/LocatingElementHandler.java index f9bb1e6d9..22755b55c 100644 --- a/src/main/java/io/appium/java_client/support/pagefactory/internal/LocatingElementHandler.java +++ b/src/main/java/io/appium/java_client/support/pagefactory/internal/LocatingElementHandler.java @@ -32,6 +32,11 @@ public class LocatingElementHandler implements InvocationHandler { private final ElementLocator locator; + /** + * Creates a new handler. + * + * @param locator the locator of the element + */ public LocatingElementHandler(ElementLocator locator) { this.locator = locator; } diff --git a/src/main/java/io/appium/java_client/support/pagefactory/internal/LocatingElementListHandler.java b/src/main/java/io/appium/java_client/support/pagefactory/internal/LocatingElementListHandler.java index af78d3d7d..8e440d1fc 100644 --- a/src/main/java/io/appium/java_client/support/pagefactory/internal/LocatingElementListHandler.java +++ b/src/main/java/io/appium/java_client/support/pagefactory/internal/LocatingElementListHandler.java @@ -32,6 +32,11 @@ public class LocatingElementListHandler implements InvocationHandler { private final ElementLocator locator; + /** + * Creates a new handler. + * + * @param locator the locator of the elements + */ public LocatingElementListHandler(ElementLocator locator) { this.locator = locator; } diff --git a/src/main/java/io/appium/java_client/support/ui/FluentWait.java b/src/main/java/io/appium/java_client/support/ui/FluentWait.java index 2ee9e6ed6..9caea71c4 100644 --- a/src/main/java/io/appium/java_client/support/ui/FluentWait.java +++ b/src/main/java/io/appium/java_client/support/ui/FluentWait.java @@ -45,18 +45,26 @@ * @param The input type for each condition used with this instance. */ public class FluentWait implements Wait { + /** The default sleep timeout in milliseconds. */ protected static final long DEFAULT_SLEEP_TIMEOUT = 500; private static final Duration DEFAULT_WAIT_DURATION = Duration.ofMillis(DEFAULT_SLEEP_TIMEOUT); + /** The input value passed to the evaluated conditions. */ protected final T input; + /** The clock used to measure the timeout. */ protected final Clock clock; + /** The sleeper used between the condition evaluations. */ protected final Sleeper sleeper; + /** The maximum time to wait. */ protected Duration timeout = DEFAULT_WAIT_DURATION; + /** The interval between the condition evaluations. */ protected Duration interval = DEFAULT_WAIT_DURATION; + /** The supplier of the custom timeout message. */ protected Supplier<@Nullable String> messageSupplier = () -> null; + /** The exception types ignored while waiting. */ protected final List> ignoredExceptions = new ArrayList<>(); /** diff --git a/src/main/java/io/appium/java_client/support/ui/Sleeper.java b/src/main/java/io/appium/java_client/support/ui/Sleeper.java index 80ced1c8a..a7ffb8f99 100644 --- a/src/main/java/io/appium/java_client/support/ui/Sleeper.java +++ b/src/main/java/io/appium/java_client/support/ui/Sleeper.java @@ -23,6 +23,9 @@ * Adapted from Selenium's {@code org.openqa.selenium.support.ui.Sleeper} (Apache License 2.0). */ public interface Sleeper { + /** + * The sleeper based on {@link Thread#sleep(long)}. + */ Sleeper SYSTEM_SLEEPER = duration -> Thread.sleep(duration.toMillis()); /** diff --git a/src/main/java/io/appium/java_client/windows/WindowsDriver.java b/src/main/java/io/appium/java_client/windows/WindowsDriver.java index bdbc67161..5db88bf58 100644 --- a/src/main/java/io/appium/java_client/windows/WindowsDriver.java +++ b/src/main/java/io/appium/java_client/windows/WindowsDriver.java @@ -41,6 +41,10 @@ import static io.appium.java_client.MobileCommand.PUSH_FILE; import static java.util.Objects.requireNonNull; +/** + * WindowsDriver is an officially supported Appium driver created to automate Windows apps. + * Read https://github.com/appium/appium-windows-driver for more details. + */ public class WindowsDriver extends AppiumDriver implements PullsFiles, PushesFiles, @@ -48,45 +52,104 @@ public class WindowsDriver extends AppiumDriver implements private static final String PLATFORM_NAME = Platform.WINDOWS.name(); private static final String AUTOMATION_NAME = AutomationName.WINDOWS; + /** + * Creates a new instance based on command {@code executor} and {@code capabilities}. + * + * @param executor is an instance of {@link AppiumCommandExecutor} + * or class that extends it. Default commands or another vendor-specific + * commands may be specified there. + * @param capabilities take a look at {@link Capabilities} + */ public WindowsDriver(AppiumCommandExecutor executor, Capabilities capabilities) { super(executor, ensurePlatformAndAutomationNames(capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium server URL and {@code capabilities}. + * + * @param remoteAddress is the address of remotely/locally started Appium server + * @param capabilities take a look at {@link Capabilities} + */ public WindowsDriver(URL remoteAddress, Capabilities capabilities) { super(remoteAddress, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium server URL, HTTP client factory and {@code capabilities}. + * + * @param remoteAddress is the address of remotely/locally started Appium server + * @param httpClientFactory take a look at {@link HttpClient.Factory} + * @param capabilities take a look at {@link Capabilities} + */ public WindowsDriver(URL remoteAddress, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(remoteAddress, httpClientFactory, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium driver local service and {@code capabilities}. + * + * @param service take a look at {@link AppiumDriverLocalService} + * @param capabilities take a look at {@link Capabilities} + */ public WindowsDriver(AppiumDriverLocalService service, Capabilities capabilities) { super(service, ensurePlatformAndAutomationNames(capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium driver local service, HTTP client factory and {@code capabilities}. + * + * @param service take a look at {@link AppiumDriverLocalService} + * @param httpClientFactory take a look at {@link HttpClient.Factory} + * @param capabilities take a look at {@link Capabilities} + */ public WindowsDriver(AppiumDriverLocalService service, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(service, httpClientFactory, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium service builder and {@code capabilities}. + * + * @param builder take a look at {@link AppiumServiceBuilder} + * @param capabilities take a look at {@link Capabilities} + */ public WindowsDriver(AppiumServiceBuilder builder, Capabilities capabilities) { super(builder, ensurePlatformAndAutomationNames(capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on Appium service builder, HTTP client factory and {@code capabilities}. + * + * @param builder take a look at {@link AppiumServiceBuilder} + * @param httpClientFactory take a look at {@link HttpClient.Factory} + * @param capabilities take a look at {@link Capabilities} + */ public WindowsDriver(AppiumServiceBuilder builder, HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(builder, httpClientFactory, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on HTTP client factory and {@code capabilities}. + * + * @param httpClientFactory take a look at {@link HttpClient.Factory} + * @param capabilities take a look at {@link Capabilities} + */ public WindowsDriver(HttpClient.Factory httpClientFactory, Capabilities capabilities) { super(httpClientFactory, ensurePlatformAndAutomationNames( capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance connected to an already running driver session. + * Intended for debugging purposes only; the caller maintains the session state. + * + * @param remoteSessionAddress The address of the **running** session including the session identifier. + */ public WindowsDriver(URL remoteSessionAddress) { super(remoteSessionAddress, PLATFORM_NAME, AUTOMATION_NAME); } @@ -116,6 +179,11 @@ public WindowsDriver(AppiumClientConfig appiumClientConfig, Capabilities capabil capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } + /** + * Creates a new instance based on {@code capabilities}. + * + * @param capabilities take a look at {@link Capabilities} + */ public WindowsDriver(Capabilities capabilities) { super(ensurePlatformAndAutomationNames(capabilities, PLATFORM_NAME, AUTOMATION_NAME)); } diff --git a/src/main/java/io/appium/java_client/windows/WindowsStartScreenRecordingOptions.java b/src/main/java/io/appium/java_client/windows/WindowsStartScreenRecordingOptions.java index 8f5d5bc72..ef4a4b4bf 100644 --- a/src/main/java/io/appium/java_client/windows/WindowsStartScreenRecordingOptions.java +++ b/src/main/java/io/appium/java_client/windows/WindowsStartScreenRecordingOptions.java @@ -25,8 +25,15 @@ import static java.util.Optional.ofNullable; +/** Windows-specific options for starting a screen recording. */ public class WindowsStartScreenRecordingOptions extends BaseStartScreenRecordingOptions { + /** + * Creates a new instance. + */ + public WindowsStartScreenRecordingOptions() { + } + private Integer fps; private String videoFilter; private String preset; @@ -34,6 +41,11 @@ public class WindowsStartScreenRecordingOptions private Boolean captureClicks; private String audioInput; + /** + * Creates a new options instance. + * + * @return a new {@link WindowsStartScreenRecordingOptions} instance. + */ public static WindowsStartScreenRecordingOptions startScreenRecordingOptions() { return new WindowsStartScreenRecordingOptions(); } diff --git a/src/main/java/io/appium/java_client/windows/WindowsStopScreenRecordingOptions.java b/src/main/java/io/appium/java_client/windows/WindowsStopScreenRecordingOptions.java index 206e8c644..90c3a9fc6 100644 --- a/src/main/java/io/appium/java_client/windows/WindowsStopScreenRecordingOptions.java +++ b/src/main/java/io/appium/java_client/windows/WindowsStopScreenRecordingOptions.java @@ -18,9 +18,20 @@ import io.appium.java_client.screenrecording.BaseStopScreenRecordingOptions; +/** Windows-specific options for stopping a screen recording. */ public class WindowsStopScreenRecordingOptions extends BaseStopScreenRecordingOptions { + /** + * Creates a new instance. + */ + public WindowsStopScreenRecordingOptions() { + } + /** + * Creates a new options instance. + * + * @return a new {@link WindowsStopScreenRecordingOptions} instance. + */ public static WindowsStopScreenRecordingOptions stopScreenRecordingOptions() { return new WindowsStopScreenRecordingOptions(); } diff --git a/src/main/java/io/appium/java_client/windows/options/PowerShellData.java b/src/main/java/io/appium/java_client/windows/options/PowerShellData.java index 6dc97f495..f3562394d 100644 --- a/src/main/java/io/appium/java_client/windows/options/PowerShellData.java +++ b/src/main/java/io/appium/java_client/windows/options/PowerShellData.java @@ -21,10 +21,19 @@ import java.util.Map; import java.util.Optional; +/** + * Data object describing a PowerShell script to execute, either as a script or as a command. + */ public class PowerShellData extends SystemScript { + /** Creates an empty data object. */ public PowerShellData() { } + /** + * Creates a data object backed by the given map. + * + * @param options The initial option values. + */ public PowerShellData(Map options) { super(options); } diff --git a/src/main/java/io/appium/java_client/windows/options/SupportsAppArgumentsOption.java b/src/main/java/io/appium/java_client/windows/options/SupportsAppArgumentsOption.java index 1b4465a88..8e741ed1a 100644 --- a/src/main/java/io/appium/java_client/windows/options/SupportsAppArgumentsOption.java +++ b/src/main/java/io/appium/java_client/windows/options/SupportsAppArgumentsOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Support for the {@code appArguments} capability: the command line arguments for the application under test. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsAppArgumentsOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code appArguments} capability. + */ String APP_ARGUMENTS_OPTION = "appArguments"; /** diff --git a/src/main/java/io/appium/java_client/windows/options/SupportsAppTopLevelWindowOption.java b/src/main/java/io/appium/java_client/windows/options/SupportsAppTopLevelWindowOption.java index 8490398f1..b57967d38 100644 --- a/src/main/java/io/appium/java_client/windows/options/SupportsAppTopLevelWindowOption.java +++ b/src/main/java/io/appium/java_client/windows/options/SupportsAppTopLevelWindowOption.java @@ -22,8 +22,17 @@ import java.util.Optional; +/** + * Support for the {@code appTopLevelWindow} capability: the handle of an existing application top level window to + * attach to. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsAppTopLevelWindowOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code appTopLevelWindow} capability. + */ String APP_TOP_LEVEL_WINDOW_OPTION = "appTopLevelWindow"; /** diff --git a/src/main/java/io/appium/java_client/windows/options/SupportsAppWorkingDirOption.java b/src/main/java/io/appium/java_client/windows/options/SupportsAppWorkingDirOption.java index bc3e1e074..8086cbeaf 100644 --- a/src/main/java/io/appium/java_client/windows/options/SupportsAppWorkingDirOption.java +++ b/src/main/java/io/appium/java_client/windows/options/SupportsAppWorkingDirOption.java @@ -22,8 +22,16 @@ import java.util.Optional; +/** + * Support for the {@code appWorkingDir} capability: the working directory of the application under test. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsAppWorkingDirOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code appWorkingDir} capability. + */ String APP_WORKING_DIR_OPTION = "appWorkingDir"; /** diff --git a/src/main/java/io/appium/java_client/windows/options/SupportsCreateSessionTimeoutOption.java b/src/main/java/io/appium/java_client/windows/options/SupportsCreateSessionTimeoutOption.java index 334209fe8..b36174f28 100644 --- a/src/main/java/io/appium/java_client/windows/options/SupportsCreateSessionTimeoutOption.java +++ b/src/main/java/io/appium/java_client/windows/options/SupportsCreateSessionTimeoutOption.java @@ -25,8 +25,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Support for the {@code createSessionTimeout} capability: the timeout for creating a session. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsCreateSessionTimeoutOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code createSessionTimeout} capability. + */ String CREATE_SESSION_TIMEOUT_OPTION = "createSessionTimeout"; /** diff --git a/src/main/java/io/appium/java_client/windows/options/SupportsMsExperimentalWebDriverOption.java b/src/main/java/io/appium/java_client/windows/options/SupportsMsExperimentalWebDriverOption.java index a4415707a..ade5084df 100644 --- a/src/main/java/io/appium/java_client/windows/options/SupportsMsExperimentalWebDriverOption.java +++ b/src/main/java/io/appium/java_client/windows/options/SupportsMsExperimentalWebDriverOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; +/** + * Support for the {@code ms:experimental-webdriver} capability: whether experimental driver features are enabled. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsMsExperimentalWebDriverOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code ms:experimental-webdriver} capability. + */ String MS_EXPERIMENTAL_WEBDRIVER_OPTION = "ms:experimental-webdriver"; /** diff --git a/src/main/java/io/appium/java_client/windows/options/SupportsMsWaitForAppLaunchOption.java b/src/main/java/io/appium/java_client/windows/options/SupportsMsWaitForAppLaunchOption.java index 2066616ce..f57935d0e 100644 --- a/src/main/java/io/appium/java_client/windows/options/SupportsMsWaitForAppLaunchOption.java +++ b/src/main/java/io/appium/java_client/windows/options/SupportsMsWaitForAppLaunchOption.java @@ -25,8 +25,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toDuration; +/** + * Support for the {@code ms:waitForAppLaunch} capability: the time to wait for the application to launch. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsMsWaitForAppLaunchOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code ms:waitForAppLaunch} capability. + */ String MS_WAIT_FOR_APP_LAUNCH_OPTION = "ms:waitForAppLaunch"; /** diff --git a/src/main/java/io/appium/java_client/windows/options/SupportsSystemPortOption.java b/src/main/java/io/appium/java_client/windows/options/SupportsSystemPortOption.java index 65ab9fb31..8e12a01f8 100644 --- a/src/main/java/io/appium/java_client/windows/options/SupportsSystemPortOption.java +++ b/src/main/java/io/appium/java_client/windows/options/SupportsSystemPortOption.java @@ -24,8 +24,16 @@ import static io.appium.java_client.internal.CapabilityHelpers.toInteger; +/** + * Support for the {@code systemPort} capability: the port the driver server listens on. + * + * @param the concrete options type, returned for chaining + */ public interface SupportsSystemPortOption> extends Capabilities, CanSetCapability { + /** + * Name of the {@code systemPort} capability. + */ String SYSTEM_PORT_OPTION = "systemPort"; /** diff --git a/src/main/java/io/appium/java_client/windows/options/WindowsOptions.java b/src/main/java/io/appium/java_client/windows/options/WindowsOptions.java index 257c2807a..bbac0822f 100644 --- a/src/main/java/io/appium/java_client/windows/options/WindowsOptions.java +++ b/src/main/java/io/appium/java_client/windows/options/WindowsOptions.java @@ -41,15 +41,26 @@ public class WindowsOptions extends BaseOptions implements SupportsSystemPortOption, SupportsPrerunOption, SupportsPostrunOption { + /** Creates options with the default capabilities set. */ public WindowsOptions() { setCommonOptions(); } + /** + * Creates options from the given capabilities. + * + * @param source The capabilities to copy. + */ public WindowsOptions(Capabilities source) { super(source); setCommonOptions(); } + /** + * Creates options from the given capabilities map. + * + * @param source The capabilities to copy. + */ public WindowsOptions(Map source) { super(source); setCommonOptions(); diff --git a/src/main/java/io/appium/java_client/ws/CanHandleConnects.java b/src/main/java/io/appium/java_client/ws/CanHandleConnects.java index 033766158..6bdd92cd0 100644 --- a/src/main/java/io/appium/java_client/ws/CanHandleConnects.java +++ b/src/main/java/io/appium/java_client/ws/CanHandleConnects.java @@ -18,6 +18,9 @@ import java.util.List; +/** + * Supports handlers of the web socket connection events. + */ public interface CanHandleConnects { /** diff --git a/src/main/java/io/appium/java_client/ws/CanHandleDisconnects.java b/src/main/java/io/appium/java_client/ws/CanHandleDisconnects.java index 60f96f276..69fbff5ad 100644 --- a/src/main/java/io/appium/java_client/ws/CanHandleDisconnects.java +++ b/src/main/java/io/appium/java_client/ws/CanHandleDisconnects.java @@ -18,6 +18,9 @@ import java.util.List; +/** + * Supports handlers of the web socket disconnection events. + */ public interface CanHandleDisconnects { /** diff --git a/src/main/java/io/appium/java_client/ws/CanHandleErrors.java b/src/main/java/io/appium/java_client/ws/CanHandleErrors.java index 5bafb43a4..e7bbb058e 100644 --- a/src/main/java/io/appium/java_client/ws/CanHandleErrors.java +++ b/src/main/java/io/appium/java_client/ws/CanHandleErrors.java @@ -19,6 +19,9 @@ import java.util.List; import java.util.function.Consumer; +/** + * Supports handlers of the web socket errors. + */ public interface CanHandleErrors { /** diff --git a/src/main/java/io/appium/java_client/ws/CanHandleMessages.java b/src/main/java/io/appium/java_client/ws/CanHandleMessages.java index 6c1b9ffa6..6e72f4da7 100644 --- a/src/main/java/io/appium/java_client/ws/CanHandleMessages.java +++ b/src/main/java/io/appium/java_client/ws/CanHandleMessages.java @@ -19,6 +19,11 @@ import java.util.List; import java.util.function.Consumer; +/** + * Supports handlers of the web socket messages. + * + * @param the message type + */ public interface CanHandleMessages { /** * Returns a list of all registered web socket messages handlers. diff --git a/src/main/java/io/appium/java_client/ws/StringWebSocketClient.java b/src/main/java/io/appium/java_client/ws/StringWebSocketClient.java index cad6f8a5d..fb75f9409 100644 --- a/src/main/java/io/appium/java_client/ws/StringWebSocketClient.java +++ b/src/main/java/io/appium/java_client/ws/StringWebSocketClient.java @@ -29,6 +29,9 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.function.Consumer; +/** + * A web socket client that handles text messages. + */ public class StringWebSocketClient implements WebSocket.Listener, CanHandleMessages, CanHandleErrors, CanHandleConnects, CanHandleDisconnects { private final List> messageHandlers = new CopyOnWriteArrayList<>(); @@ -40,6 +43,11 @@ public class StringWebSocketClient implements WebSocket.Listener, private final WeakReference httpClient; + /** + * Creates a client. + * + * @param httpClient the HTTP client used to open the web socket + */ public StringWebSocketClient(HttpClient httpClient) { this.httpClient = new WeakReference<>(httpClient); } @@ -50,11 +58,21 @@ private void setEndpoint(URI endpoint) { this.endpoint = endpoint; } + /** + * Returns the endpoint the client is connected to. + * + * @return the endpoint or null if the client has not been connected yet + */ @Nullable public URI getEndpoint() { return this.endpoint; } + /** + * Checks whether the web socket is open. + * + * @return true if the client is listening + */ public boolean isListening() { return isListening; }