@SuppressWarnings("unchecked") @Override public List<WebElement> findElements(SearchContext context) { return (List<WebElement>) ((FindsByFluentSelector<?>) context) .findElements(selector.toString(), getLocatorString()); }
/** * Gather the output from the previously started screen recording to a media file. * * @param options see the documentation on the {@link BaseStopScreenRecordingOptions} * descendant for the particular platform. * @return Base-64 encoded content of the recorded media file or an empty string * if the file has been successfully uploaded to a remote location (depends on the actual options). */ default <T extends BaseStopScreenRecordingOptions> String stopRecordingScreen(T options) { return CommandExecutionHelper.execute(this, stopRecordingScreenCommand(options)); }
/** * Send a key event to the device. * * @param key code for the key pressed on the device. */ default void pressKeyCode(int key) { CommandExecutionHelper.execute(this, pressKeyCodeCommand(key)); }
@Override public WebElement findElement(SearchContext context) { return ((FindsByFluentSelector<?>) context) .findElement(selector.toString(), getLocatorString()); }
/** * Start asynchronous screen recording process. * * @param options see the documentation on the {@link BaseStartScreenRecordingOptions} * descendant for the particular platform. * @return Base-64 encoded content of the recorded media file or an empty string * if the file has been successfully uploaded to a remote location (depends on the actual options). */ default <T extends BaseStartScreenRecordingOptions> String startRecordingScreen(T options) { return CommandExecutionHelper.execute(this, startRecordingScreenCommand(options)); }
/** * Send a long key event to the device. * * @param key code for the key pressed on the device. */ default void longPressKeyCode(int key) { CommandExecutionHelper.execute(this, longPressKeyCodeCommand(key)); }
/** * Hides the keyboard by pressing the button specified by keyName if it is * showing. * * @param keyName The button pressed by the mobile driver to attempt hiding the * keyboard. */ default void hideKeyboard(String keyName) { CommandExecutionHelper.execute(this, hideKeyboardCommand(keyName)); }
/** * Unlock the device if it is locked. This method will return silently if the device * is not locked. */ default void unlockDevice() { CommandExecutionHelper.execute(this, unlockDeviceCommand()); }
/** * Lock the device (bring it to the lock screen) for a given number of * seconds or forever (until the command for unlocking is called). The call * is ignored if the device has been already locked. * * @param duration for how long to lock the screen. Minimum time resolution is one second. * A negative/zero value will lock the device and return immediately. */ default void lockDevice(Duration duration) { CommandExecutionHelper.execute(this, lockDeviceCommand(duration)); }
/** * Check if the device is locked. * * @return true if the device is locked or false otherwise. */ default boolean isDeviceLocked() { return CommandExecutionHelper.execute(this, getIsDeviceLockedCommand()); } }
/** * Set a setting for this test session It's probably better to use a * convenience function, rather than use this function directly. Try finding * the method for the specific setting you want to change. * * @param setting Setting you wish to set. * @param value value of the setting. */ default void setSetting(Setting setting, Object value) { CommandExecutionHelper.execute(this, setSettingsCommand(setting, value)); }
/** * Finds a list of elements that match the Windows UIAutomation selector supplied. * * @param selector a Windows UIAutomation selector * @return a list of elements that match the given selector * @throws WebDriverException This method is not applicable with browser/webview UI. */ default List<T> findElementsByWindowsUIAutomation(String selector) { return findElements(MobileSelector.WINDOWS_UI_AUTOMATION.toString(), selector); } }
/** * Check if the keyboard is displayed. * * @return true if keyboard is displayed. False otherwise */ default boolean isKeyboardShown() { return CommandExecutionHelper.execute(this, isKeyboardShownCommand()); } }
/** * Finds the first of elements that match the Windows UIAutomation selector supplied. * * @param selector a Windows UIAutomation selector * @return The first element that matches the given selector * @throws WebDriverException This method is not applicable with browser/webview UI. * @throws NoSuchElementException when no one element is found */ default T findElementByWindowsUIAutomation(String selector) { return findElement(MobileSelector.WINDOWS_UI_AUTOMATION.toString(), selector); }
/** * Method performs the searching for a list of elements by Android UIAutomator selector * and value of the given selector. * * @param using an Android UIAutomator selector * @return a list of elements that match the given selector * * @throws WebDriverException This method is not applicable with browser/webview UI. */ default List<T> findElementsByAndroidUIAutomator(String using) { return findElements(MobileSelector.ANDROID_UI_AUTOMATOR.toString(), using); } }
default List<T> findElementsByIosClassChain(String using) { return findElements(MobileSelector.IOS_CLASS_CHAIN.toString(), using); } }
/** * Method performs the searching for a list of elements by view tag selector * and value of the given selector. * * @param using an view tag selector * @return a list of elements that match the given selector * * @throws WebDriverException This method is not applicable with browser/webview UI. */ default List<T> findElementsByAndroidViewTag(String using) { return findElements(MobileSelector.ANDROID_VIEWTAG.toString(), using); } }
/** * Send a key event along with an Android metastate to an Android device. * Metastates are things like *shift* to get uppercase characters. * * @param key code for the key pressed on the Android device. * @param metastate metastate for the keypress. */ default void pressKeyCode(int key, Integer metastate) { CommandExecutionHelper.execute(this, pressKeyCodeCommand(key, metastate)); }
/** * Send a long key event along with an Android metastate to an Android device. * Metastates are things like *shift* to get uppercase characters. * * @param key code for the key pressed on the Android device. * @param metastate metastate for the keypress. */ default void longPressKeyCode(int key, Integer metastate) { CommandExecutionHelper.execute(this, longPressKeyCodeCommand(key, metastate)); } }
/** * Hides the keyboard if it is showing. Hiding the keyboard often * depends on the way an app is implemented, no single strategy always * works. * * @param strategy HideKeyboardStrategy. * @param keyName a String, representing the text displayed on the button of the * keyboard you want to press. For example: "Done". */ default void hideKeyboard(String strategy, String keyName) { CommandExecutionHelper.execute(this, hideKeyboardCommand(strategy, keyName)); } }