diff --git a/src/main/java/io/appium/java_client/DefaultGenericMobileDriver.java b/src/main/java/io/appium/java_client/DefaultGenericMobileDriver.java index 35f3ef8c1..3e7380309 100644 --- a/src/main/java/io/appium/java_client/DefaultGenericMobileDriver.java +++ b/src/main/java/io/appium/java_client/DefaultGenericMobileDriver.java @@ -22,7 +22,6 @@ import org.openqa.selenium.Capabilities; import org.openqa.selenium.WebDriverException; import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Mouse; import org.openqa.selenium.remote.CommandExecutor; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.remote.Response; @@ -156,13 +155,6 @@ public List findElementsByXPath(String using) { return super.findElementsByXPath(using); } - /** - * Mouse doesn't work on mobile devices and emulators. - */ - @Deprecated public Mouse getMouse() { - return super.getMouse(); - } - @Override public String toString() { return String.format("%s, Capabilities: %s", getClass().getCanonicalName(), diff --git a/src/main/java/io/appium/java_client/FindsByIosUIAutomation.java b/src/main/java/io/appium/java_client/FindsByIosUIAutomation.java deleted file mode 100644 index ce0c2598a..000000000 --- a/src/main/java/io/appium/java_client/FindsByIosUIAutomation.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client; - -import org.openqa.selenium.NoSuchElementException; -import org.openqa.selenium.WebDriverException; -import org.openqa.selenium.WebElement; - -import java.util.List; - -@Deprecated -public interface FindsByIosUIAutomation extends FindsByFluentSelector { - /** - * Method performs the searching for a single element by iOS UIAutomation selector - * and value of the given selector. - * - * @param using an iOS 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 findElementByIosUIAutomation(String using) { - return findElement(MobileSelector.IOS_UI_AUTOMATION.toString(), using); - } - - /** - * Method performs the searching for a list of elements by iOS UIAutomation selector - * and value of the given selector. - * - * @param using an iOS 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 findElementsByIosUIAutomation(String using) { - return findElements(MobileSelector.IOS_UI_AUTOMATION.toString(), using); - } -} diff --git a/src/main/java/io/appium/java_client/MobileBy.java b/src/main/java/io/appium/java_client/MobileBy.java index d86595725..e26a320b4 100644 --- a/src/main/java/io/appium/java_client/MobileBy.java +++ b/src/main/java/io/appium/java_client/MobileBy.java @@ -63,20 +63,6 @@ protected String getLocatorString() { .findElement(selector.toString(), getLocatorString()); } - /** - * Read https://developer.apple.com/library/tvos/documentation/DeveloperTools/ - * Conceptual/InstrumentsUserGuide/UIAutomation.html - * - * @param iOSAutomationText is iOS UIAutomation string - * @return an instance of {@link io.appium.java_client.MobileBy.ByIosUIAutomation} - * - * @deprecated UIAutomation is going to get deprecated. - * It is recommended to use XCUITest - */ - public static By IosUIAutomation(final String iOSAutomationText) { - return new ByIosUIAutomation(iOSAutomationText); - } - /** * Read http://developer.android.com/intl/ru/tools/testing-support-library/ * index.html#uia-apis @@ -162,69 +148,6 @@ public static By image(final String b64Template) { public static By custom(final String selector) { return new ByCustom(selector); } - - public static class ByIosUIAutomation extends MobileBy implements Serializable { - - public ByIosUIAutomation(String iOSAutomationText) { - super(MobileSelector.IOS_UI_AUTOMATION, iOSAutomationText); - } - - /** - * {@inheritDoc} - * - * @throws WebDriverException when current session doesn't support the given selector or when - * value of the selector is not consistent. - * @throws IllegalArgumentException when it is impossible to find something on the given - * {@link SearchContext} instance - */ - @SuppressWarnings("unchecked") - @Override - public List findElements(SearchContext context) throws WebDriverException, - IllegalArgumentException { - Class contextClass = context.getClass(); - - if (FindsByIosUIAutomation.class.isAssignableFrom(contextClass)) { - return FindsByIosUIAutomation.class.cast(context) - .findElementsByIosUIAutomation(getLocatorString()); - } - - if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) { - return super.findElements(context); - } - - throw formIllegalArgumentException(contextClass, FindsByIosUIAutomation.class, - FindsByFluentSelector.class); - } - - /** - * {@inheritDoc} - * - * @throws WebDriverException when current session doesn't support the given selector or when - * value of the selector is not consistent. - * @throws IllegalArgumentException when it is impossible to find something on the given - * {@link SearchContext} instance - */ - @Override public WebElement findElement(SearchContext context) throws WebDriverException, - IllegalArgumentException { - Class contextClass = context.getClass(); - - if (FindsByIosUIAutomation.class.isAssignableFrom(contextClass)) { - return ((FindsByIosUIAutomation) context) - .findElementByIosUIAutomation(getLocatorString()); - } - - if (FindsByFluentSelector.class.isAssignableFrom(contextClass)) { - return super.findElement(context); - } - - throw formIllegalArgumentException(contextClass, FindsByIosUIAutomation.class, - FindsByFluentSelector.class); - } - - @Override public String toString() { - return "By.IosUIAutomation: " + getLocatorString(); - } - } public static class ByAndroidUIAutomator extends MobileBy implements Serializable { diff --git a/src/main/java/io/appium/java_client/android/AndroidKeyCode.java b/src/main/java/io/appium/java_client/android/AndroidKeyCode.java deleted file mode 100644 index cbfefe32f..000000000 --- a/src/main/java/io/appium/java_client/android/AndroidKeyCode.java +++ /dev/null @@ -1,1380 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.android; - -/** - * Some common key codes for Android Key Events. - * @deprecated Use {@link io.appium.java_client.android.nativekey.AndroidKey} instead - * - */ -@Deprecated -public interface AndroidKeyCode { - - int BACK = 4; - int BACKSPACE = 67; - int DEL = 67; - int ENTER = 66; - int HOME = 3; - int MENU = 82; - int SETTINGS = 176; - int SPACE = 62; - - // getAction() value: the key has been pressed down. - // (0x00000000) - int ACTION_DOWN = 0; - - // getAction() value: multiple duplicate key events have occurred in a row, or a complex string - // is being delivered. If the key code is not {#link KEYCODE_UNKNOWN then the - // {#link getRepeatCount() method returns the number of times the given key code should be - // executed. Otherwise, if the key code is KEYCODE_UNKNOWN, then this is a sequence of - // characters as returned by getCharacters(). - // (0x00000002) - int ACTION_MULTIPLE = 2; - - // getAction() value: the key has been released. - // (0x00000001) - int ACTION_UP = 1; - - // When associated with up key events, this indicates that the key press has been canceled. - // Typically this is used with virtual touch screen keys, where the user can slide from - // the virtual key area on to the display: in that case, the application will receive a - // canceled up event and should not perform the action normally associated with the key. - // Note that for this to work, the application can not perform an action for a key until - // it receives an up or the long press timeout has expired. - // (0x00000020) - int FLAG_CANCELED = 32; - - // Set when a key event has FLAG_CANCELED set because a long press action - // was executed while it was down. - // (0x00000100) - int FLAG_CANCELED_LONG_PRESS = 256; - - // This mask is used for compatibility, to identify enter keys that are coming - // from an IME whose enter key has been auto-labelled "next" or "done". - // This allows TextView to dispatch these as normal enter keys for old applications, - // but still do the appropriate action when receiving them. - // (0x00000010) - int FLAG_EDITOR_ACTION = 16; - - // Set when a key event has been synthesized to implement default behavior for an - // event that the application did not handle. - // Fallback key events are generated by unhandled trackball motions (to emulate a directional - // keypad) and by certain unhandled key presses that are declared in the key map - // (such as special function numeric keypad keys when numlock is off). - // (0x00000400) - int FLAG_FALLBACK = 1024; - - // This mask is set if an event was known to come from a trusted part of the system. - // That is, the event is known to come from the user, and could not - // have been spoofed by a third party component. - // (0x00000008) - int FLAG_FROM_SYSTEM = 8; - - // This mask is set if we don't want the key event to cause us to leave touch mode. - // (0x00000004) - int FLAG_KEEP_TOUCH_MODE = 4; - - // This flag is set for the first key repeat that occurs after the long press timeout. - // (0x00000080) - int FLAG_LONG_PRESS = 128; - - // This mask is set if the key event was generated by a software keyboard. - // (0x00000002) - int FLAG_SOFT_KEYBOARD = 2; - - // Set for ACTION_UP when this event's key code is still being tracked from its initial down. - // That is, somebody requested that tracking started on the key down and a - // long press has not caused the tracking to be canceled. - // (0x00000200) - int FLAG_TRACKING = 512; - - // This key event was generated by a virtual (on-screen) hard key area. - // Typically this is an area of the touchscreen, outside of the regular display, - // dedicated to "hardware" buttons. - // (0x00000040) - int FLAG_VIRTUAL_HARD_KEY = 64; - - // This constant was deprecated in API level 20. - // This flag will never be set by the system since the system consumes all wake keys itself. - // This mask is set if the device woke because of this key event. - // (0x00000001) - int FLAG_WOKE_HERE = 1; - - // Key code constant: '0' key. - // (0x00000007) - int KEYCODE_0 = 7; - - // Key code constant: '1' key. - // (0x00000008) - int KEYCODE_1 = 8; - - // Key code constant: '11' key. - // (0x000000e3) - int KEYCODE_11 = 227; - - // Key code constant: '12' key. - // (0x000000e4) - int KEYCODE_12 = 228; - - // Key code constant: '2' key. - // (0x00000009) - int KEYCODE_2 = 9; - - // Key code constant: '3' key. - // (0x0000000a) - int KEYCODE_3 = 10; - - // Key code constant: 3D Mode key. Toggles the display between 2D and 3D mode. - // (0x000000ce) - int KEYCODE_3D_MODE = 206; - - // Key code constant: '4' key. - // (0x0000000b) - int KEYCODE_4 = 11; - - // Key code constant: '5' key. - // (0x0000000c) - int KEYCODE_5 = 12; - - // Key code constant: '6' key. - // (0x0000000d) - int KEYCODE_6 = 13; - - // Key code constant: '7' key. - // (0x0000000e) - int KEYCODE_7 = 14; - - // Key code constant: '8' key. - // (0x0000000f) - int KEYCODE_8 = 15; - - // Key code constant: '9' key. - // (0x00000010) - int KEYCODE_9 = 16; - - // Key code constant: 'A' key. - // (0x0000001d) - int KEYCODE_A = 29; - - // Key code constant: Left Alt modifier key. - // (0x00000039) - int KEYCODE_ALT_LEFT = 57; - - // Key code constant: Right Alt modifier key. - // (0x0000003a) - int KEYCODE_ALT_RIGHT = 58; - - // Key code constant: ''' (apostrophe) key. - // (0x0000004b) - int KEYCODE_APOSTROPHE = 75; - - // Key code constant: App switch key. Should bring up the application switcher dialog. - // (0x000000bb) - int KEYCODE_APP_SWITCH = 187; - - // Key code constant: Assist key. Launches the global assist activity. Not delivered to - // applications. - // (0x000000db) - int KEYCODE_ASSIST = 219; - - // Key code constant: '@' key. - // (0x0000004d) - int KEYCODE_AT = 77; - - // Key code constant: A/V Receiver input key. On TV remotes, switches the input mode on an - // external A/V Receiver. - // (0x000000b6) - int KEYCODE_AVR_INPUT = 182; - - // Key code constant: A/V Receiver power key. On TV remotes, toggles the power on an external - // A/V Receiver. - // (0x000000b5) - int KEYCODE_AVR_POWER = 181; - - // Key code constant: 'B' key. - // (0x0000001e) - int KEYCODE_B = 30; - - // Key code constant: Back key. - // (0x00000004) - int KEYCODE_BACK = 4; - - // Key code constant: '\' key. - // (0x00000049) - int KEYCODE_BACKSLASH = 73; - - // Key code constant: Bookmark key. On some TV remotes, bookmarks content or web pages. - // (0x000000ae) - int KEYCODE_BOOKMARK = 174; - - // Key code constant: Break / Pause key. - // (0x00000079) - int KEYCODE_BREAK = 121; - - // Key code constant: Brightness Down key. Adjusts the screen brightness down. - // (0x000000dc) - int KEYCODE_BRIGHTNESS_DOWN = 220; - - // Key code constant: Brightness Up key. Adjusts the screen brightness up. - // (0x000000dd) - int KEYCODE_BRIGHTNESS_UP = 221; - - // Key code constant: Generic Game Pad Button #1. - // (0x000000bc) - int KEYCODE_BUTTON_1 = 188; - - // Key code constant: Generic Game Pad Button #10. - // (0x000000c5) - int KEYCODE_BUTTON_10 = 197; - - // Key code constant: Generic Game Pad Button #11. - // (0x000000c6) - int KEYCODE_BUTTON_11 = 198; - - // Key code constant: Generic Game Pad Button #12. - // (0x000000c7) - int KEYCODE_BUTTON_12 = 199; - - // Key code constant: Generic Game Pad Button #13. - // (0x000000c8) - int KEYCODE_BUTTON_13 = 200; - - // Key code constant: Generic Game Pad Button #14. - // (0x000000c9) - int KEYCODE_BUTTON_14 = 201; - - // Key code constant: Generic Game Pad Button #15. - // (0x000000ca) - int KEYCODE_BUTTON_15 = 202; - - // Key code constant: Generic Game Pad Button #16. - // (0x000000cb) - int KEYCODE_BUTTON_16 = 203; - - // Key code constant: Generic Game Pad Button #2. - // (0x000000bd) - int KEYCODE_BUTTON_2 = 189; - - // Key code constant: Generic Game Pad Button #3. - // (0x000000be) - int KEYCODE_BUTTON_3 = 190; - - // Key code constant: Generic Game Pad Button #4. - // (0x000000bf) - int KEYCODE_BUTTON_4 = 191; - - // Key code constant: Generic Game Pad Button #5. - // (0x000000c0) - int KEYCODE_BUTTON_5 = 192; - - // Key code constant: Generic Game Pad Button #6. - // (0x000000c1) - int KEYCODE_BUTTON_6 = 193; - - // Key code constant: Generic Game Pad Button #7. - // (0x000000c2) - int KEYCODE_BUTTON_7 = 194; - - // Key code constant: Generic Game Pad Button #8. - // (0x000000c3) - int KEYCODE_BUTTON_8 = 195; - - // Key code constant: Generic Game Pad Button #9. - // (0x000000c4) - int KEYCODE_BUTTON_9 = 196; - - // Key code constant: A Button key. On a game controller, the A button should be either the - // button labeled A or the first button on the bottom row of controller buttons. - // (0x00000060) - int KEYCODE_BUTTON_A = 96; - - // Key code constant: B Button key. On a game controller, the B button should be either the - // button labeled B or the second button on the bottom row of controller buttons. - // (0x00000061) - int KEYCODE_BUTTON_B = 97; - - // Key code constant: C Button key. On a game controller, the C button should be either - // the button labeled C or the third button on the bottom row of controller buttons. - // (0x00000062) - int KEYCODE_BUTTON_C = 98; - - // Key code constant: L1 Button key. On a game controller, the L1 button should be either - // the button labeled L1 (or L) or the top left trigger button. - // (0x00000066) - int KEYCODE_BUTTON_L1 = 102; - - // Key code constant: L2 Button key. On a game controller, the L2 button should be either - // the button labeled L2 or the bottom left trigger button. - // (0x00000068) - int KEYCODE_BUTTON_L2 = 104; - - // Key code constant: Mode Button key. On a game controller, the button labeled Mode. - // (0x0000006e) - int KEYCODE_BUTTON_MODE = 110; - - // Key code constant: R1 Button key. On a game controller, the R1 button should be either - // the button labeled R1 (or R) or the top right trigger button. - // (0x00000067) - int KEYCODE_BUTTON_R1 = 103; - - // Key code constant: R2 Button key. On a game controller, the R2 button - // should be either the button labeled R2 or the bottom right trigger button. - // (0x00000069) - int KEYCODE_BUTTON_R2 = 105; - - // Key code constant: Select Button key. On a game controller, the button labeled Select. - // (0x0000006d) - int KEYCODE_BUTTON_SELECT = 109; - - // Key code constant: Start Button key. On a game controller, the button labeled Start. - // (0x0000006c) - int KEYCODE_BUTTON_START = 108; - - // Key code constant: Left Thumb Button key. On a game controller, the left thumb button - // indicates that the left (or only) joystick is pressed. - // (0x0000006a) - int KEYCODE_BUTTON_THUMBL = 106; - - // Key code constant: Right Thumb Button key. On a game controller, the right thumb - // button indicates that the right joystick is pressed. - // (0x0000006b) - int KEYCODE_BUTTON_THUMBR = 107; - - // Key code constant: X Button key. On a game controller, the X button should be - // either the button labeled X or the first button on the upper row of controller buttons. - // (0x00000063) - int KEYCODE_BUTTON_X = 99; - - // Key code constant: Y Button key. On a game controller, the Y button should be either - // the button labeled Y or the second button on the upper row of controller buttons. - // (0x00000064) - int KEYCODE_BUTTON_Y = 100; - - // Key code constant: Z Button key. On a game controller, the Z button should be either - // the button labeled Z or the third button on the upper row of controller buttons. - // (0x00000065) - int KEYCODE_BUTTON_Z = 101; - - // Key code constant: 'C' key. - // (0x0000001f) - int KEYCODE_C = 31; - - // Key code constant: Calculator special function key. Used to launch a calculator application. - // (0x000000d2) - int KEYCODE_CALCULATOR = 210; - - // Key code constant: Calendar special function key. Used to launch a calendar application. - // (0x000000d0) - int KEYCODE_CALENDAR = 208; - - // Key code constant: Call key. - // (0x00000005) - int KEYCODE_CALL = 5; - - // Key code constant: Camera key. Used to launch a camera application or take pictures. - // (0x0000001b) - int KEYCODE_CAMERA = 27; - - // Key code constant: Caps Lock key. - // (0x00000073) - int KEYCODE_CAPS_LOCK = 115; - - // Key code constant: Toggle captions key. Switches the mode for closed-captioning text, - // for example during television shows. - // (0x000000af) - int KEYCODE_CAPTIONS = 175; - - // Key code constant: Channel down key. On TV remotes, decrements the television channel. - // (0x000000a7) - int KEYCODE_CHANNEL_DOWN = 167; - - // Key code constant: Channel up key. On TV remotes, increments the television channel. - // (0x000000a6) - int KEYCODE_CHANNEL_UP = 166; - - // Key code constant: Clear key. - // (0x0000001c) - int KEYCODE_CLEAR = 28; - - // Key code constant: ',' key. - // (0x00000037) - int KEYCODE_COMMA = 55; - - // Key code constant: Contacts special function key. Used to launch an address book application. - // (0x000000cf) - int KEYCODE_CONTACTS = 207; - - // Key code constant: Left Control modifier key. - // (0x00000071) - int KEYCODE_CTRL_LEFT = 113; - - // Key code constant: Right Control modifier key. - // (0x00000072) - int KEYCODE_CTRL_RIGHT = 114; - - // Key code constant: 'D' key. - // (0x00000020) - int KEYCODE_D = 32; - - // Key code constant: Backspace key. Deletes characters before the insertion point, - // unlike KEYCODE_FORWARD_DEL. - // (0x00000043) - int KEYCODE_DEL = 67; - - // Key code constant: Directional Pad Center key. May also be synthesized from - // trackball motions. - // (0x00000017) - int KEYCODE_DPAD_CENTER = 23; - - // Key code constant: Directional Pad Down key. May also be synthesized - // from trackball motions. - // (0x00000014) - int KEYCODE_DPAD_DOWN = 20; - - // Key code constant: Directional Pad Left key. May also be synthesized - // from trackball motions. - // (0x00000015) - int KEYCODE_DPAD_LEFT = 21; - - // Key code constant: Directional Pad Right key. May also be synthesized from trackball motions. - // (0x00000016) - int KEYCODE_DPAD_RIGHT = 22; - - // Key code constant: Directional Pad Up key. May also be synthesized from trackball motions. - // (0x00000013) - int KEYCODE_DPAD_UP = 19; - - // Key code constant: DVR key. On some TV remotes, switches to a DVR mode for recorded shows. - // (0x000000ad) - int KEYCODE_DVR = 173; - - // Key code constant: 'E' key. - // (0x00000021) - int KEYCODE_E = 33; - - // Key code constant: Japanese alphanumeric key. - // (0x000000d4) - int KEYCODE_EISU = 212; - - // Key code constant: End Call key. - // (0x00000006) - int KEYCODE_ENDCALL = 6; - - // Key code constant: Enter key. - // (0x00000042) - int KEYCODE_ENTER = 66; - - // Key code constant: Envelope special function key. Used to launch a mail application. - // (0x00000041) - int KEYCODE_ENVELOPE = 65; - - // Key code constant: '=' key. - // (0x00000046) - int KEYCODE_EQUALS = 70; - - // Key code constant: Escape key. - // (0x0000006f) - int KEYCODE_ESCAPE = 111; - - // Key code constant: Explorer special function key. Used to launch a browser application. - // (0x00000040) - int KEYCODE_EXPLORER = 64; - - // Key code constant: 'F' key. - // (0x00000022) - int KEYCODE_F = 34; - - // Key code constant: F1 key. - // (0x00000083) - int KEYCODE_F1 = 131; - - // Key code constant: F10 key. - // (0x0000008c) - int KEYCODE_F10 = 140; - - // Key code constant: F11 key. - // (0x0000008d) - int KEYCODE_F11 = 141; - - // Key code constant: F12 key. - // (0x0000008e) - int KEYCODE_F12 = 142; - - // Key code constant: F2 key. - // (0x00000084) - int KEYCODE_F2 = 132; - - // Key code constant: F3 key. - // (0x00000085) - int KEYCODE_F3 = 133; - - // Key code constant: F4 key. - // (0x00000086) - int KEYCODE_F4 = 134; - - // Key code constant: F5 key. - // (0x00000087) - int KEYCODE_F5 = 135; - - // Key code constant: F6 key. - // (0x00000088) - int KEYCODE_F6 = 136; - - // Key code constant: F7 key. - // (0x00000089) - int KEYCODE_F7 = 137; - - // Key code constant: F8 key. - // (0x0000008a) - int KEYCODE_F8 = 138; - - // Key code constant: F9 key. - // (0x0000008b) - int KEYCODE_F9 = 139; - - // Key code constant: Camera Focus key. Used to focus the camera. - // (0x00000050) - int KEYCODE_FOCUS = 80; - - // Key code constant: Forward key. Navigates forward in the history stack. - // Complement of KEYCODE_BACK. - // (0x0000007d) - int KEYCODE_FORWARD = 125; - - // Key code constant: Forward Delete key. Deletes characters ahead of the insertion point, - // unlike KEYCODE_DEL. - // (0x00000070) - int KEYCODE_FORWARD_DEL = 112; - - // Key code constant: Function modifier key. - // (0x00000077) - int KEYCODE_FUNCTION = 119; - - // Key code constant: 'G' key. - // (0x00000023) - int KEYCODE_G = 35; - - // Key code constant: '`' (backtick) key. - // (0x00000044) - int KEYCODE_GRAVE = 68; - - // Key code constant: Guide key. On TV remotes, shows a programming guide. - // (0x000000ac) - int KEYCODE_GUIDE = 172; - - // Key code constant: 'H' key. - // (0x00000024) - int KEYCODE_H = 36; - - // Key code constant: Headset Hook key. Used to hang up calls and stop media. - // (0x0000004f) - int KEYCODE_HEADSETHOOK = 79; - - // Key code constant: Help key. - // (0x00000103) - int KEYCODE_HELP = 259; - - // Key code constant: Japanese conversion key. - // (0x000000d6) - int KEYCODE_HENKAN = 214; - - // Key code constant: Home key. This key is handled by the framework - // and is never delivered to applications. - // (0x00000003) - int KEYCODE_HOME = 3; - - // Key code constant: 'I' key. - // (0x00000025) - int KEYCODE_I = 37; - - // Key code constant: Info key. Common on TV remotes to show additional - // information related to what is currently being viewed. - // (0x000000a5) - int KEYCODE_INFO = 165; - - // Key code constant: Insert key. Toggles insert / overwrite edit mode. - // (0x0000007c) - int KEYCODE_INSERT = 124; - - // Key code constant: 'J' key. - // (0x00000026) - int KEYCODE_J = 38; - - // Key code constant: 'K' key. - // (0x00000027) - int KEYCODE_K = 39; - - // Key code constant: Japanese kana key. - // (0x000000da) - int KEYCODE_KANA = 218; - - // Key code constant: Japanese katakana / hiragana key. - // (0x000000d7) - int KEYCODE_KATAKANA_HIRAGANA = 215; - - // Key code constant: 'L' key. - // (0x00000028) - int KEYCODE_L = 40; - - // Key code constant: Language Switch key. Toggles the current input language such as - // switching between English and Japanese on a QWERTY keyboard. - // On some devices, the same function may be performed by pressing Shift+Spacebar. - // (0x000000cc) - int KEYCODE_LANGUAGE_SWITCH = 204; - - // Key code constant: Last Channel key. Goes to the last viewed channel. - // (0x000000e5) - int KEYCODE_LAST_CHANNEL = 229; - - // Key code constant: '[' key. - // (0x00000047) - int KEYCODE_LEFT_BRACKET = 71; - - // Key code constant: 'M' key. - // (0x00000029) - int KEYCODE_M = 41; - - // Key code constant: Manner Mode key. Toggles silent or vibrate mode on and off to make the - // device behave more politely in certain settings such as on a crowded train. - // On some devices, the key may only operate when long-pressed. - // (0x000000cd) - int KEYCODE_MANNER_MODE = 205; - - // Key code constant: Audio Track key. Switches the audio tracks. - // (0x000000de) - int KEYCODE_MEDIA_AUDIO_TRACK = 222; - - // Key code constant: Close media key. May be used to close a CD tray, for example. - // (0x00000080) - int KEYCODE_MEDIA_CLOSE = 128; - - // Key code constant: Eject media key. May be used to eject a CD tray, for example. - // (0x00000081) - int KEYCODE_MEDIA_EJECT = 129; - - // Key code constant: Fast Forward media key. - // (0x0000005a) - int KEYCODE_MEDIA_FAST_FORWARD = 90; - - // Key code constant: Play Next media key. - // (0x00000057) - int KEYCODE_MEDIA_NEXT = 87; - - // Key code constant: Pause media key. - // (0x0000007f) - int KEYCODE_MEDIA_PAUSE = 127; - - // Key code constant: Play media key. - // (0x0000007e) - int KEYCODE_MEDIA_PLAY = 126; - - // Key code constant: Play/Pause media key. - // (0x00000055) - int KEYCODE_MEDIA_PLAY_PAUSE = 85; - - // Key code constant: Play Previous media key. - // (0x00000058) - int KEYCODE_MEDIA_PREVIOUS = 88; - - // Key code constant: Record media key. - // (0x00000082) - int KEYCODE_MEDIA_RECORD = 130; - - // Key code constant: Rewind media key. - // (0x00000059) - int KEYCODE_MEDIA_REWIND = 89; - - // Key code constant: Stop media key. - // (0x00000056) - int KEYCODE_MEDIA_STOP = 86; - - // Key code constant: Media Top Menu key. Goes to the top of media menu. - // (0x000000e2) - int KEYCODE_MEDIA_TOP_MENU = 226; - - // Key code constant: Menu key. - // (0x00000052) - int KEYCODE_MENU = 82; - - // Key code constant: Left Meta modifier key. - // (0x00000075) - int KEYCODE_META_LEFT = 117; - - // Key code constant: Right Meta modifier key. - // (0x00000076) - int KEYCODE_META_RIGHT = 118; - - // Key code constant: '-'. - // (0x00000045) - int KEYCODE_MINUS = 69; - - // Key code constant: End Movement key. Used for scrolling or moving the cursor around to - // the end of a line or to the bottom of a list. - // (0x0000007b) - int KEYCODE_MOVE_END = 123; - - // Key code constant: Home Movement key. Used for scrolling or moving the cursor around to - // the start of a line or to the top of a list. - // (0x0000007a) - int KEYCODE_MOVE_HOME = 122; - - // Key code constant: Japanese non-conversion key. - // (0x000000d5) - int KEYCODE_MUHENKAN = 213; - - // Key code constant: Music special function key. Used to launch a music player application. - // (0x000000d1) - int KEYCODE_MUSIC = 209; - - // Key code constant: Mute key. Mutes the microphone, unlike KEYCODE_VOLUME_MUTE. - // (0x0000005b) - int KEYCODE_MUTE = 91; - - // Key code constant: 'N' key. - // (0x0000002a) - int KEYCODE_N = 42; - - // Key code constant: Notification key. - // (0x00000053) - int KEYCODE_NOTIFICATION = 83; - - // Key code constant: Number modifier key. Used to enter numeric symbols. This key is not - // Num Lock; it is more like KEYCODE_ALT_LEFT and is interpreted as an - // ALT key by MetaKeyKeyListener. - // (0x0000004e) - int KEYCODE_NUM = 78; - - // Key code constant: Numeric keypad '0' key. - // (0x00000090) - int KEYCODE_NUMPAD_0 = 144; - - // Key code constant: Numeric keypad '1' key. - // (0x00000091) - int KEYCODE_NUMPAD_1 = 145; - - // Key code constant: Numeric keypad '2' key. - // (0x00000092) - int KEYCODE_NUMPAD_2 = 146; - - // Key code constant: Numeric keypad '3' key. - // (0x00000093) - int KEYCODE_NUMPAD_3 = 147; - - // Key code constant: Numeric keypad '4' key. - // (0x00000094) - int KEYCODE_NUMPAD_4 = 148; - - // Key code constant: Numeric keypad '5' key. - // (0x00000095) - int KEYCODE_NUMPAD_5 = 149; - - // Key code constant: Numeric keypad '6' key. - // (0x00000096) - int KEYCODE_NUMPAD_6 = 150; - - // Key code constant: Numeric keypad '7' key. - // (0x00000097) - int KEYCODE_NUMPAD_7 = 151; - - // Key code constant: Numeric keypad '8' key. - // (0x00000098) - int KEYCODE_NUMPAD_8 = 152; - - // Key code constant: Numeric keypad '9' key. - // (0x00000099) - int KEYCODE_NUMPAD_9 = 153; - - // Key code constant: Numeric keypad '+' key (for addition). - // (0x0000009d) - int KEYCODE_NUMPAD_ADD = 157; - - // Key code constant: Numeric keypad ',' key (for decimals or digit grouping). - // (0x0000009f) - int KEYCODE_NUMPAD_COMMA = 159; - - // Key code constant: Numeric keypad '/' key (for division). - // (0x0000009a) - int KEYCODE_NUMPAD_DIVIDE = 154; - - // Key code constant: Numeric keypad '.' key (for decimals or digit grouping). - // (0x0000009e) - int KEYCODE_NUMPAD_DOT = 158; - - // Key code constant: Numeric keypad Enter key. - // (0x000000a0) - int KEYCODE_NUMPAD_ENTER = 160; - - // Key code constant: Numeric keypad '=' key. - // (0x000000a1) - int KEYCODE_NUMPAD_EQUALS = 161; - - // Key code constant: Numeric keypad '(' key. - // (0x000000a2) - int KEYCODE_NUMPAD_LEFT_PAREN = 162; - - // Key code constant: Numeric keypad '*' key (for multiplication). - // (0x0000009b) - int KEYCODE_NUMPAD_MULTIPLY = 155; - - // Key code constant: Numeric keypad ')' key. - // (0x000000a3) - int KEYCODE_NUMPAD_RIGHT_PAREN = 163; - - // Key code constant: Numeric keypad '-' key (for subtraction). - // (0x0000009c) - int KEYCODE_NUMPAD_SUBTRACT = 156; - - // Key code constant: Num Lock key. This is the Num Lock key; it is different from KEYCODE_NUM. - // This key alters the behavior of other keys on the numeric keypad. - // (0x0000008f) - int KEYCODE_NUM_LOCK = 143; - - // Key code constant: 'O' key. - // (0x0000002b) - int KEYCODE_O = 43; - - // Key code constant: 'P' key. - // (0x0000002c) - int KEYCODE_P = 44; - - // Key code constant: Page Down key. - // (0x0000005d) - int KEYCODE_PAGE_DOWN = 93; - - // Key code constant: Page Up key. - // (0x0000005c) - int KEYCODE_PAGE_UP = 92; - - // Key code constant: Pairing key. Initiates peripheral pairing mode. Useful for pairing - // remote control devices or game controllers, especially if no other input mode is available. - // (0x000000e1) - int KEYCODE_PAIRING = 225; - - // Key code constant: '.' key. - // (0x00000038) - int KEYCODE_PERIOD = 56; - - // Key code constant: Picture Symbols modifier key. Used to switch symbol sets - // (Emoji, Kao-moji). - // (0x0000005e) - int KEYCODE_PICTSYMBOLS = 94; - - // Key code constant: '+' key. - // (0x00000051) - int KEYCODE_PLUS = 81; - - // Key code constant: '#' key. - // (0x00000012) - int KEYCODE_POUND = 18; - - // Key code constant: Power key. - // (0x0000001a) - int KEYCODE_POWER = 26; - - // Key code constant: Blue "programmable" key. On TV remotes, - // acts as a contextual/programmable key. - // (0x000000ba) - int KEYCODE_PROG_BLUE = 186; - - // Key code constant: Green "programmable" key. On TV remotes, actsas a - // contextual/programmable key. - // (0x000000b8) - int KEYCODE_PROG_GREEN = 184; - - // Key code constant: Red "programmable" key. On TV remotes, acts as - // a contextual/programmable key. - // (0x000000b7) - int KEYCODE_PROG_RED = 183; - - // Key code constant: Yellow "programmable" key. On TV remotes, acts as - // a contextual/programmable key. - // (0x000000b9) - int KEYCODE_PROG_YELLOW = 185; - - // Key code constant: 'Q' key. - // (0x0000002d) - int KEYCODE_Q = 45; - - // Key code constant: 'R' key. - // (0x0000002e) - int KEYCODE_R = 46; - - // Key code constant: ']' key. - // (0x00000048) - int KEYCODE_RIGHT_BRACKET = 72; - - // Key code constant: Japanese Ro key. - // (0x000000d9) - int KEYCODE_RO = 217; - - // Key code constant: 'S' key. - // (0x0000002f) - int KEYCODE_S = 47; - - // Key code constant: Scroll Lock key. - // (0x00000074) - int KEYCODE_SCROLL_LOCK = 116; - - // Key code constant: Search key. - // (0x00000054) - int KEYCODE_SEARCH = 84; - - // Key code constant: ';' key. - // (0x0000004a) - int KEYCODE_SEMICOLON = 74; - - // Key code constant: Settings key. Starts the system settings activity. - // (0x000000b0) - int KEYCODE_SETTINGS = 176; - - // Key code constant: Left Shift modifier key. - // (0x0000003b) - int KEYCODE_SHIFT_LEFT = 59; - - // Key code constant: Right Shift modifier key. - // (0x0000003c) - int KEYCODE_SHIFT_RIGHT = 60; - - // Key code constant: '/' key. - // (0x0000004c) - int KEYCODE_SLASH = 76; - - // Key code constant: Sleep key. Puts the device to sleep. Behaves somewhat like - // KEYCODE_POWER but it has no effect if the device is already asleep. - // (0x000000df) - int KEYCODE_SLEEP = 223; - - // Key code constant: Soft Left key. Usually situated below the display on phones and - // used as a multi-function feature key for selecting a software defined function - // shown on the bottom left of the display. - // (0x00000001) - int KEYCODE_SOFT_LEFT = 1; - - // Key code constant: Soft Right key. Usually situated below the display on phones - // and used as a multi-function feature key for selecting a software defined function - // shown on the bottom right of the display. - // (0x00000002) - int KEYCODE_SOFT_RIGHT = 2; - - // Key code constant: Space key. - // (0x0000003e) - int KEYCODE_SPACE = 62; - - // Key code constant: '*' key. - // (0x00000011) - int KEYCODE_STAR = 17; - - // Key code constant: Set-top-box input key. On TV remotes, switches the input mode - // on an external Set-top-box. - // (0x000000b4) - int KEYCODE_STB_INPUT = 180; - - // Key code constant: Set-top-box power key. On TV remotes, toggles the power on an - // external Set-top-box. - // (0x000000b3) - int KEYCODE_STB_POWER = 179; - - // Key code constant: Switch Charset modifier key. Used to switch character sets - // (Kanji, Katakana). - // (0x0000005f) - int KEYCODE_SWITCH_CHARSET = 95; - - // Key code constant: Symbol modifier key. Used to enter alternate symbols. - // (0x0000003f) - int KEYCODE_SYM = 63; - - // Key code constant: System Request / Print Screen key. - // (0x00000078) - int KEYCODE_SYSRQ = 120; - - // Key code constant: 'T' key. - // (0x00000030) - int KEYCODE_T = 48; - - // Key code constant: Tab key. - // (0x0000003d) - int KEYCODE_TAB = 61; - - // Key code constant: TV key. On TV remotes, switches to viewing live TV. - // (0x000000aa) - int KEYCODE_TV = 170; - - // Key code constant: Antenna/Cable key. Toggles broadcast input source between - // antenna and cable. - // (0x000000f2) - int KEYCODE_TV_ANTENNA_CABLE = 242; - - // Key code constant: Audio description key. Toggles audio description off / on. - // (0x000000fc) - int KEYCODE_TV_AUDIO_DESCRIPTION = 252; - - // Key code constant: Audio description mixing volume down key. Lessen audio description - // volume as compared with normal audio volume. - // (0x000000fe) - int KEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN = 254; - - // Key code constant: Audio description mixing volume up key. Louden audio description - // volume as compared with normal audio volume. - // (0x000000fd) - int KEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP = 253; - - // Key code constant: Contents menu key. Goes to the title list. Corresponds to Contents - // Menu (0x0B) of CEC User Control Code - // (0x00000100) - int KEYCODE_TV_CONTENTS_MENU = 256; - - // Key code constant: TV data service key. Displays data services like weather, sports. - // (0x000000e6) - int KEYCODE_TV_DATA_SERVICE = 230; - - // Key code constant: TV input key. On TV remotes, switches the input on a television screen. - // (0x000000b2) - int KEYCODE_TV_INPUT = 178; - - // Key code constant: Component #1 key. Switches to component video input #1. - // (0x000000f9) - int KEYCODE_TV_INPUT_COMPONENT_1 = 249; - - // Key code constant: Component #2 key. Switches to component video input #2. - // (0x000000fa) - int KEYCODE_TV_INPUT_COMPONENT_2 = 250; - - // Key code constant: Composite #1 key. Switches to composite video input #1. - // (0x000000f7) - int KEYCODE_TV_INPUT_COMPOSITE_1 = 247; - - // Key code constant: Composite #2 key. Switches to composite video input #2. - // (0x000000f8) - int KEYCODE_TV_INPUT_COMPOSITE_2 = 248; - - // Key code constant: HDMI #1 key. Switches to HDMI input #1. - // (0x000000f3) - int KEYCODE_TV_INPUT_HDMI_1 = 243; - - // Key code constant: HDMI #2 key. Switches to HDMI input #2. - // (0x000000f4) - int KEYCODE_TV_INPUT_HDMI_2 = 244; - - // Key code constant: HDMI #3 key. Switches to HDMI input #3. - // (0x000000f5) - int KEYCODE_TV_INPUT_HDMI_3 = 245; - - // Key code constant: HDMI #4 key. Switches to HDMI input #4. - // (0x000000f6) - int KEYCODE_TV_INPUT_HDMI_4 = 246; - - // Key code constant: VGA #1 key. Switches to VGA (analog RGB) input #1. - // (0x000000fb) - int KEYCODE_TV_INPUT_VGA_1 = 251; - - // Key code constant: Media context menu key. Goes to the context menu of media contents. - // Corresponds to Media Context-sensitive Menu (0x11) of CEC User Control Code. - // (0x00000101) - int KEYCODE_TV_MEDIA_CONTEXT_MENU = 257; - - // Key code constant: Toggle Network key. Toggles selecting broacast services. - // (0x000000f1) - int KEYCODE_TV_NETWORK = 241; - - // Key code constant: Number entry key. Initiates to enter multi-digit channel nubmber when - // each digit key is assigned for selecting separate channel. - // Corresponds to Number Entry Mode (0x1D) of CEC User Control Code. - // (0x000000ea) - int KEYCODE_TV_NUMBER_ENTRY = 234; - - // Key code constant: TV power key. On TV remotes, toggles the power on a television screen. - // (0x000000b1) - int KEYCODE_TV_POWER = 177; - - // Key code constant: Radio key. Toggles TV service / Radio service. - // (0x000000e8) - int KEYCODE_TV_RADIO_SERVICE = 232; - - // Key code constant: Satellite key. Switches to digital satellite broadcast service. - // (0x000000ed) - int KEYCODE_TV_SATELLITE = 237; - - // Key code constant: BS key. Switches to BS digital satellite broadcasting service - // available in Japan. - // (0x000000ee) - int KEYCODE_TV_SATELLITE_BS = 238; - - // Key code constant: CS key. Switches to CS digital satellite broadcasting - // service available in Japan. - // (0x000000ef) - int KEYCODE_TV_SATELLITE_CS = 239; - - // Key code constant: BS/CS key. Toggles between BS and CS digital satellite services. - // (0x000000f0) - int KEYCODE_TV_SATELLITE_SERVICE = 240; - - // Key code constant: Teletext key. Displays Teletext service. - // (0x000000e9) - int KEYCODE_TV_TELETEXT = 233; - - // Key code constant: Analog Terrestrial key. Switches to analog terrestrial broadcast service. - // (0x000000eb) - int KEYCODE_TV_TERRESTRIAL_ANALOG = 235; - - // Key code constant: Digital Terrestrial key. Switches to digital terrestrial - // broadcast service. - // (0x000000ec) - int KEYCODE_TV_TERRESTRIAL_DIGITAL = 236; - - // Key code constant: Timer programming key. Goes to the timer recording menu. - // Corresponds to Timer Programming (0x54) of CEC User Control Code. - // (0x00000102) - int KEYCODE_TV_TIMER_PROGRAMMING = 258; - - // Key code constant: Zoom mode key. Changes Zoom mode (Normal, - // Full, Zoom, Wide-zoom, etc.) - // (0x000000ff) - int KEYCODE_TV_ZOOM_MODE = 255; - - // Key code constant: 'U' key. - // (0x00000031) - int KEYCODE_U = 49; - - // Key code constant: Unknown key code. - // (0x00000000) - int KEYCODE_UNKNOWN = 0; - - // Key code constant: 'V' key. - // (0x00000032) - int KEYCODE_V = 50; - - // Key code constant: Voice Assist key. Launches the global voice assist activity. - // Not delivered to applications. - // (0x000000e7) - int KEYCODE_VOICE_ASSIST = 231; - - // Key code constant: Volume Down key. Adjusts the speaker volume down. - // (0x00000019) - int KEYCODE_VOLUME_DOWN = 25; - - // Key code constant: Volume Mute key. Mutes the speaker, unlike KEYCODE_MUTE. - // This key should normally be implemented as a toggle such that - // the first press mutes the speaker and the second press restores the original volume. - // (0x000000a4) - int KEYCODE_VOLUME_MUTE = 164; - - // Key code constant: Volume Up key. Adjusts the speaker volume up. - // (0x00000018) - int KEYCODE_VOLUME_UP = 24; - - // Key code constant: 'W' key. - // (0x00000033) - int KEYCODE_W = 51; - - // Key code constant: Wakeup key. Wakes up the device. Behaves somewhat like - // KEYCODE_POWER but it has no effect if the device is already awake. - // (0x000000e0) - int KEYCODE_WAKEUP = 224; - - // Key code constant: Window key. On TV remotes, toggles picture-in-picture - // mode or other windowing functions. - // (0x000000ab) - int KEYCODE_WINDOW = 171; - - // Key code constant: 'X' key. - // (0x00000034) - int KEYCODE_X = 52; - - // Key code constant: 'Y' key. - // (0x00000035) - int KEYCODE_Y = 53; - - // Key code constant: Japanese Yen key. - // (0x000000d8) - int KEYCODE_YEN = 216; - - // Key code constant: 'Z' key. - // (0x00000036) - int KEYCODE_Z = 54; - - // Key code constant: Japanese full-width / half-width key. - // (0x000000d3) - int KEYCODE_ZENKAKU_HANKAKU = 211; - - // Key code constant: Zoom in key. - // (0x000000a8) - int KEYCODE_ZOOM_IN = 168; - - // Key code constant: Zoom out key. - // (0x000000a9) - int KEYCODE_ZOOM_OUT = 169; - - // This constant was deprecated in API level 3. - // There are now more than MAX_KEYCODE keycodes. Use getMaxKeyCode() instead. - // (0x00000054) - int MAX_KEYCODE = 84; - - // This mask is used to check whether the left ALT meta key is pressed. - // See Also - // isAltPressed() - // getMetaState() - // KEYCODE_ALT_LEFT - // (0x00000010) - int META_ALT_LEFT_ON = 16; - - // This mask is a combination of META_ALT_ON, META_ALT_LEFT_ON and META_ALT_RIGHT_ON. - // (0x00000032) - int META_ALT_MASK = 50; - - // This mask is used to check whether one of the ALT meta keys is pressed. - // See Also - // isAltPressed() - // getMetaState() - // KEYCODE_ALT_LEFT - // KEYCODE_ALT_RIGHT - // (0x00000002) - int META_ALT_ON = 2; - - // This mask is used to check whether the right the ALT meta key is pressed. - // See Also - // isAltPressed() - // getMetaState() - // KEYCODE_ALT_RIGHT - // (0x00000020) - int META_ALT_RIGHT_ON = 32; - - // This mask is used to check whether the CAPS LOCK meta key is on. - // See Also - // isCapsLockOn() - // getMetaState() - // KEYCODE_CAPS_LOCK - // (0x00100000) - int META_CAPS_LOCK_ON = 1048576; - - // This mask is used to check whether the left CTRL meta key is pressed. - // See Also - // isCtrlPressed() - // getMetaState() - // KEYCODE_CTRL_LEFT - // (0x00002000) - int META_CTRL_LEFT_ON = 8192; - - // This mask is a combination of META_CTRL_ON, META_CTRL_LEFT_ON and META_CTRL_RIGHT_ON. - // (0x00007000) - int META_CTRL_MASK = 28672; - - // This mask is used to check whether one of the CTRL meta keys is pressed. - // See Also - // isCtrlPressed() - // getMetaState() - // KEYCODE_CTRL_LEFT - // KEYCODE_CTRL_RIGHT - // (0x00001000) - int META_CTRL_ON = 4096; - - // This mask is used to check whether the right CTRL meta key is pressed. - // See Also - // isCtrlPressed() - // getMetaState() - // KEYCODE_CTRL_RIGHT - // (0x00004000) - int META_CTRL_RIGHT_ON = 16384; - - // This mask is used to check whether the FUNCTION meta key is pressed. - // See Also - // isFunctionPressed() - // getMetaState() - // (0x00000008) - int META_FUNCTION_ON = 8; - - // This mask is used to check whether the left META meta key is pressed. - // See Also - // isMetaPressed() - // getMetaState() - // KEYCODE_META_LEFT - // (0x00020000) - int META_META_LEFT_ON = 131072; - - // This mask is a combination of META_META_ON, META_META_LEFT_ON and META_META_RIGHT_ON. - // (0x00070000) - int META_META_MASK = 458752; - - // This mask is used to check whether one of the META meta keys is pressed. - // See Also - // isMetaPressed() - // getMetaState() - // KEYCODE_META_LEFT - // KEYCODE_META_RIGHT - // (0x00010000) - int META_META_ON = 65536; - - // This mask is used to check whether the right META meta key is pressed. - // See Also - // isMetaPressed() - // getMetaState() - // KEYCODE_META_RIGHT - // (0x00040000) - int META_META_RIGHT_ON = 262144; - - // This mask is used to check whether the NUM LOCK meta key is on. - // See Also - // isNumLockOn() - // getMetaState() - // KEYCODE_NUM_LOCK - // (0x00200000) - int META_NUM_LOCK_ON = 2097152; - - // This mask is used to check whether the SCROLL LOCK meta key is on. - // See Also - // isScrollLockOn() - // getMetaState() - // KEYCODE_SCROLL_LOCK - // (0x00400000) - int META_SCROLL_LOCK_ON = 4194304; - - // This mask is used to check whether the left SHIFT meta key is pressed. - // See Also - // isShiftPressed() - // getMetaState() - // KEYCODE_SHIFT_LEFT - // (0x00000040) - int META_SHIFT_LEFT_ON = 64; - - // This mask is a combination of META_SHIFT_ON, META_SHIFT_LEFT_ON and META_SHIFT_RIGHT_ON. - // (0x000000c1) - int META_SHIFT_MASK = 193; - - // This mask is used to check whether one of the SHIFT meta keys is pressed. - // See Also - // isShiftPressed() - // getMetaState() - // KEYCODE_SHIFT_LEFT - // KEYCODE_SHIFT_RIGHT - // (0x00000001) - int META_SHIFT_ON = 1; - - // This mask is used to check whether the right SHIFT meta key is pressed. - // See Also - // isShiftPressed() - // getMetaState() - // KEYCODE_SHIFT_RIGHT - // (0x00000080) - int META_SHIFT_RIGHT_ON = 128; - - // This mask is used to check whether the SYM meta key is pressed. - // See Also - // isSymPressed() - // getMetaState() - // (0x00000004) - int META_SYM_ON = 4; - -} diff --git a/src/main/java/io/appium/java_client/android/AndroidKeyMetastate.java b/src/main/java/io/appium/java_client/android/AndroidKeyMetastate.java deleted file mode 100644 index e03b5b709..000000000 --- a/src/main/java/io/appium/java_client/android/AndroidKeyMetastate.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.android; - -import io.appium.java_client.android.nativekey.KeyEventMetaModifier; - -/** - * Metastates for Android Key Events. - * @deprecated Use {@link KeyEventMetaModifier} instead - */ -@Deprecated -public interface AndroidKeyMetastate { - - int META_ALT_LEFT_ON = 16; - int META_ALT_ON = 2; - int META_ALT_RIGHT_ON = 32; - int META_CAPS_LOCK_ON = 1048576; - int META_CTRL_LEFT_ON = 8192; - int META_CTRL_ON = 4096; - int META_CTRL_RIGHT_ON = 16384; - int META_FUNCTION_ON = 8; - int META_META_LEFT_ON = 131072; - int META_META_ON = 65536; - int META_META_RIGHT_ON = 262144; - int META_NUM_LOCK_ON = 2097152; - int META_SCROLL_LOCK_ON = 4194304; - int META_SHIFT_LEFT_ON = 64; - int META_SHIFT_ON = 1; - int META_SHIFT_RIGHT_ON = 128; - int META_SYM_ON = 4; -} 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 620aca273..b4c39767c 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 @@ -18,8 +18,6 @@ import static io.appium.java_client.MobileCommand.LONG_PRESS_KEY_CODE; import static io.appium.java_client.MobileCommand.PRESS_KEY_CODE; -import static io.appium.java_client.MobileCommand.longPressKeyCodeCommand; -import static io.appium.java_client.MobileCommand.pressKeyCodeCommand; import io.appium.java_client.CommandExecutionHelper; import io.appium.java_client.ExecutesMethod; @@ -28,32 +26,6 @@ public interface PressesKey extends ExecutesMethod { - /** - * Send a key event to the device. - * - * @deprecated use {@link #pressKey(KeyEvent)} instead - * - * @param key code for the key pressed on the device. - */ - @Deprecated - default void pressKeyCode(int key) { - CommandExecutionHelper.execute(this, pressKeyCodeCommand(key)); - } - - /** - * Send a key event along with an Android metastate to an Android device. - * Metastates are things like *shift* to get uppercase characters. - * - * @deprecated use {@link #pressKey(KeyEvent)} instead - * - * @param key code for the key pressed on the Android device. - * @param metastate metastate for the keypress. - */ - @Deprecated - default void pressKeyCode(int key, Integer metastate) { - CommandExecutionHelper.execute(this, pressKeyCodeCommand(key, metastate)); - } - /** * Send a key event to the device under test. * @@ -64,32 +36,6 @@ default void pressKey(KeyEvent keyEvent) { new AbstractMap.SimpleEntry<>(PRESS_KEY_CODE, keyEvent.build())); } - /** - * Send a long key event to the device. - * - * @deprecated use {@link #longPressKey(KeyEvent)} instead - * - * @param key code for the key pressed on the device. - */ - @Deprecated - default void longPressKeyCode(int key) { - CommandExecutionHelper.execute(this, longPressKeyCodeCommand(key)); - } - - /** - * Send a long key event along with an Android metastate to an Android device. - * Metastates are things like *shift* to get uppercase characters. - * - * @deprecated use {@link #longPressKey(KeyEvent)} instead - * - * @param key code for the key pressed on the Android device. - * @param metastate metastate for the keypress. - */ - @Deprecated - default void longPressKeyCode(int key, Integer metastate) { - CommandExecutionHelper.execute(this, longPressKeyCodeCommand(key, metastate)); - } - /** * Send a long press key event to the device under test. * diff --git a/src/main/java/io/appium/java_client/ios/IOSDriver.java b/src/main/java/io/appium/java_client/ios/IOSDriver.java index 6f1f5e72b..218f642f6 100644 --- a/src/main/java/io/appium/java_client/ios/IOSDriver.java +++ b/src/main/java/io/appium/java_client/ios/IOSDriver.java @@ -26,7 +26,6 @@ import io.appium.java_client.AppiumDriver; import io.appium.java_client.FindsByIosClassChain; import io.appium.java_client.FindsByIosNSPredicate; -import io.appium.java_client.FindsByIosUIAutomation; import io.appium.java_client.HasOnScreenKeyboard; import io.appium.java_client.HidesKeyboardWithKeyName; import io.appium.java_client.LocksDevice; @@ -65,8 +64,8 @@ public class IOSDriver extends AppiumDriver implements HidesKeyboardWithKeyName, ShakesDevice, HasIOSSettings, HasOnScreenKeyboard, - FindsByIosUIAutomation, LocksDevice, PerformsTouchID, FindsByIosNSPredicate, - FindsByIosClassChain, PushesFiles, CanRecordScreen, HasIOSClipboard, ListensToSyslogMessages, + LocksDevice, PerformsTouchID, FindsByIosNSPredicate, FindsByIosClassChain, + PushesFiles, CanRecordScreen, HasIOSClipboard, ListensToSyslogMessages, HasBattery { private static final String IOS_PLATFORM = MobilePlatform.IOS; diff --git a/src/main/java/io/appium/java_client/ios/IOSElement.java b/src/main/java/io/appium/java_client/ios/IOSElement.java index 8702497aa..a406053a0 100644 --- a/src/main/java/io/appium/java_client/ios/IOSElement.java +++ b/src/main/java/io/appium/java_client/ios/IOSElement.java @@ -18,10 +18,8 @@ import io.appium.java_client.FindsByIosClassChain; import io.appium.java_client.FindsByIosNSPredicate; -import io.appium.java_client.FindsByIosUIAutomation; import io.appium.java_client.MobileElement; public class IOSElement extends MobileElement - implements FindsByIosUIAutomation, FindsByIosNSPredicate, - FindsByIosClassChain { + implements FindsByIosNSPredicate, FindsByIosClassChain { } 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 0aa5cf180..febee93d6 100644 --- a/src/main/java/io/appium/java_client/pagefactory/AppiumFieldDecorator.java +++ b/src/main/java/io/appium/java_client/pagefactory/AppiumFieldDecorator.java @@ -197,7 +197,7 @@ private Object decorateWidget(Field field) { CacheableLocator locator = widgetLocatorFactory.createLocator(field); Map> map = - OverrideWidgetReader.read(widgetType, field, platform, automation); + OverrideWidgetReader.read(widgetType, field, platform); if (isAlist) { return getEnhancedProxy(ArrayList.class, 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 473a5188e..40a990898 100644 --- a/src/main/java/io/appium/java_client/pagefactory/DefaultElementByBuilder.java +++ b/src/main/java/io/appium/java_client/pagefactory/DefaultElementByBuilder.java @@ -165,34 +165,22 @@ protected By buildMobileNativeBy() { Optional howToUseLocatorsOptional = ofNullable(howToUseLocators); - By result = null; - if (isSelendroidAutomation()) { - result = buildMobileBy(howToUseLocatorsOptional - .map(HowToUseLocators::selendroidAutomation).orElse(null), - getBys(SelendroidFindBy.class, SelendroidFindBys.class, SelendroidFindAll.class)); - } - - if (isAndroid() && result == null) { + if (isAndroid()) { return buildMobileBy(howToUseLocatorsOptional.map(HowToUseLocators::androidAutomation).orElse(null), getBys(AndroidFindBy.class, AndroidFindBys.class, AndroidFindAll.class)); } - if (isIOSXcuit()) { - result = buildMobileBy(howToUseLocatorsOptional.map(HowToUseLocators::iOSXCUITAutomation).orElse(null), + if (isIOSXcuit() || isIOS()) { + return buildMobileBy(howToUseLocatorsOptional.map(HowToUseLocators::iOSXCUITAutomation).orElse(null), getBys(iOSXCUITFindBy.class, iOSXCUITFindBys.class, iOSXCUITFindAll.class)); } - if (isIOS() && result == null) { - return buildMobileBy(howToUseLocatorsOptional.map(HowToUseLocators::iOSAutomation).orElse(null), - getBys(iOSFindBy.class, iOSFindBys.class, iOSFindAll.class)); - } - if (isWindows()) { return buildMobileBy(howToUseLocatorsOptional.map(HowToUseLocators::windowsAutomation).orElse(null), getBys(WindowsFindBy.class, WindowsFindBys.class, WindowsFindAll.class)); } - return ofNullable(result).orElse(null); + return null; } @Override 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 4c38b1152..88a9abb7d 100644 --- a/src/main/java/io/appium/java_client/pagefactory/HowToUseLocators.java +++ b/src/main/java/io/appium/java_client/pagefactory/HowToUseLocators.java @@ -33,35 +33,6 @@ */ LocatorGroupStrategy androidAutomation() default LocatorGroupStrategy.CHAIN; - /** - * The strategy which defines how to use locators which are described by the - * {@link SelendroidFindBy} annotation. These annotations can define the chained searching - * or the searching by all possible locators. - * - * @return the strategy which defines how to use locators which are described by the - * {@link SelendroidFindBy} annotation - * @deprecated Selendroid driver is going to be deprecated. - * Use {@link AndroidFindBy} instead. - * It is recommended to use UIAutomator1 for Android API below 21 - * and UIAutomator2 for API >= 21 - */ - @Deprecated - LocatorGroupStrategy selendroidAutomation() default LocatorGroupStrategy.CHAIN; - - /** - * The strategy which defines how to use locators which are described by the - * {@link iOSFindBy} annotation. These annotations can define the chained searching - * or the searching by all possible locators. - * - * @return the strategy which defines how to use locators which are described by the - * {@link iOSFindBy} annotation - * - * @deprecated UIAutomation is going to get deprecated. - * It is recommended to use XCUITest - */ - @Deprecated - LocatorGroupStrategy iOSAutomation() default LocatorGroupStrategy.CHAIN; - /** * The strategy which defines how to use locators which are described by the * {@link WindowsFindBy} annotation. These annotations can define the chained searching diff --git a/src/main/java/io/appium/java_client/pagefactory/OverrideWidget.java b/src/main/java/io/appium/java_client/pagefactory/OverrideWidget.java index 6e21bdc43..53bdee8f0 100644 --- a/src/main/java/io/appium/java_client/pagefactory/OverrideWidget.java +++ b/src/main/java/io/appium/java_client/pagefactory/OverrideWidget.java @@ -49,29 +49,6 @@ */ Class androidUIAutomator() default Widget.class; - /** - * This property is designed for iOS native content. - * A declared class should not be abstract. Declared class also should be a subclass - * of an annotated class/class which is declared by an annotated field. - * - * @return a class which extends {@link io.appium.java_client.pagefactory.Widget} - */ - Class iOSUIAutomation() default Widget.class; - - /** - * This property is designed for Android native content when - * {@link io.appium.java_client.remote.AutomationName#SELENDROID} automation is used. - * A declared class should not be abstract. Declared class also should be a subclass - * of an annotated class/class which is declared by an annotated field. - * @deprecated Selendroid driver is going to be deprecated. - * Use {@link io.appium.java_client.remote.AutomationName#ANDROID_UIAUTOMATOR2} instead. - * It is recommended to use UIAutomator1 for Android API below 21 - * and UIAutomator2 for API >= 21 - * @return a class which extends {@link io.appium.java_client.pagefactory.Widget} - */ - @Deprecated - Class selendroid() default Widget.class; - /** * This property is designed for iOS native content when * {@link io.appium.java_client.remote.AutomationName#IOS_XCUI_TEST} automation is used. diff --git a/src/main/java/io/appium/java_client/pagefactory/OverrideWidgetReader.java b/src/main/java/io/appium/java_client/pagefactory/OverrideWidgetReader.java index 6b2c42a1e..4060e4fae 100644 --- a/src/main/java/io/appium/java_client/pagefactory/OverrideWidgetReader.java +++ b/src/main/java/io/appium/java_client/pagefactory/OverrideWidgetReader.java @@ -34,8 +34,6 @@ class OverrideWidgetReader { private static final Class EMPTY = Widget.class; private static final String HTML = "html"; private static final String ANDROID_UI_AUTOMATOR = "androidUIAutomator"; - private static final String IOS_UI_AUTOMATION = "iOSUIAutomation"; - private static final String SELENDROID = "selendroid"; private static final String IOS_XCUIT_AUTOMATION = "iOSXCUITAutomation"; private static final String WINDOWS_AUTOMATION = "windowsAutomation"; @@ -73,24 +71,15 @@ static Class getDefaultOrHTMLWidgetClass( } static Class getMobileNativeWidgetClass(Class declaredClass, - AnnotatedElement annotatedElement, String platform, String automation) { + AnnotatedElement annotatedElement, String platform) { String transformedPlatform = String.valueOf(platform).toUpperCase().trim(); - String transformedAutomation = String.valueOf(automation).toUpperCase().trim(); if (ANDROID.equalsIgnoreCase(transformedPlatform)) { - if (AutomationName.SELENDROID.equalsIgnoreCase(transformedAutomation)) { - return getConvenientClass(declaredClass, annotatedElement, SELENDROID); - } - return getConvenientClass(declaredClass, annotatedElement, ANDROID_UI_AUTOMATOR); } if (IOS.equalsIgnoreCase(transformedPlatform)) { - if (AutomationName.IOS_XCUI_TEST.equalsIgnoreCase(transformedAutomation)) { - return getConvenientClass(declaredClass, annotatedElement, IOS_XCUIT_AUTOMATION); - } - - return getConvenientClass(declaredClass, annotatedElement, IOS_UI_AUTOMATION); + return getConvenientClass(declaredClass, annotatedElement, IOS_XCUIT_AUTOMATION); } if (WINDOWS.equalsIgnoreCase(transformedPlatform)) { @@ -108,22 +97,19 @@ private static Constructor getConstructorOfADefaultOrHTMLWidge } private static Constructor getConstructorOfAMobileNativeWidgets( - Class declaredClass, AnnotatedElement annotatedElement, String platform, - String automation) { + Class declaredClass, AnnotatedElement annotatedElement, String platform) { Class clazz = - getMobileNativeWidgetClass(declaredClass, annotatedElement, platform, automation); + getMobileNativeWidgetClass(declaredClass, annotatedElement, platform); return findConvenientConstructor(clazz); } protected static Map> read( - Class declaredClass, AnnotatedElement annotatedElement, String platform, - String automation) { + Class declaredClass, AnnotatedElement annotatedElement, String platform) { Map> result = new HashMap<>(); result.put(ContentType.HTML_OR_DEFAULT, getConstructorOfADefaultOrHTMLWidget(declaredClass, annotatedElement)); result.put(ContentType.NATIVE_MOBILE_SPECIFIC, - getConstructorOfAMobileNativeWidgets(declaredClass, annotatedElement, platform, - automation)); + getConstructorOfAMobileNativeWidgets(declaredClass, annotatedElement, platform)); return result; } } diff --git a/src/main/java/io/appium/java_client/pagefactory/SelendroidBy.java b/src/main/java/io/appium/java_client/pagefactory/SelendroidBy.java deleted file mode 100644 index d1bb5a117..000000000 --- a/src/main/java/io/appium/java_client/pagefactory/SelendroidBy.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.pagefactory; - - -/** - * Used to build a complex selendroid locator. - * @deprecated Selendroid driver is going to be deprecated. - * Use {@link AndroidBy} instead. - * It is recommended to use UIAutomator1 for Android API below 21 - * and UIAutomator2 for API >= 21 - */ -@Deprecated -public @interface SelendroidBy { - /** - * It is an id of the target element. - * - * @return an id of the target element - */ - String id() default ""; - - /** - * It is used in Selendroid mode instead of accessibility id. - * - * @return name - */ - String name() default ""; - - /** - * It is a className of the target element. - * - * @return a className of the target element - */ - String className() default ""; - - /** - * It is a desired element tag. - * - * @return a desired element tag - */ - String tagName() default ""; - - /** - * It is a xpath to the target element. - * - * @return a xpath to the target element - */ - String xpath() default ""; - - /** - * It is a text of the desired element. - * - * @return a text of the desired element - */ - String linkText() default ""; - - /** - * It is a part of the text of the desired element. - * - * @return a part of the text of the desired element - */ - String partialLinkText() default ""; - - /** - * Priority of the searching. Higher number means lower priority. - * - * @return priority of the searching - */ - int priority() default 0; -} diff --git a/src/main/java/io/appium/java_client/pagefactory/SelendroidFindAll.java b/src/main/java/io/appium/java_client/pagefactory/SelendroidFindAll.java deleted file mode 100644 index ce560cb1c..000000000 --- a/src/main/java/io/appium/java_client/pagefactory/SelendroidFindAll.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.pagefactory; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Used to mark a field on a Page/Screen Object to indicate that lookup should use a - * series of {@link SelendroidBy} tags - * It will then search for all elements that match any criteria. Note that elements - * are not guaranteed to be in document order. - * - * @deprecated Selendroid driver is going to be deprecated. - * Use {@link AndroidBy} instead. - * It is recommended to use UIAutomator1 for Android API below 21 - * and UIAutomator2 for API >= 21 - */ -@Retention(RUNTIME) @Target({FIELD, TYPE}) -@Deprecated -public @interface SelendroidFindAll { - /** - * It is a set of {@link SelendroidBy} strategies which may be used to find the target element. - * - * @return a collection of strategies which may be used to find the target element - */ - SelendroidBy[] value(); - - /** - * Priority of the searching. Higher number means lower priority. - * - * @return priority of the searching - */ - int priority() default 0; -} diff --git a/src/main/java/io/appium/java_client/pagefactory/SelendroidFindBy.java b/src/main/java/io/appium/java_client/pagefactory/SelendroidFindBy.java deleted file mode 100644 index 0dc060585..000000000 --- a/src/main/java/io/appium/java_client/pagefactory/SelendroidFindBy.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.pagefactory; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Repeatable; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - - -/** - * Used to mark a field on a Page Object to indicate an alternative mechanism for locating the - * element or a list of elements. Used in conjunction with - * {@link org.openqa.selenium.support.PageFactory} - * this allows users to quickly and easily create PageObjects. - * using Selendroid UI selectors like, id, name, class name, tag and xpath - * - * @deprecated Selendroid driver is going to be deprecated. - * Use {@link AndroidFindBy} instead. - * It is recommended to use UIAutomator1 for Android API below 21 - * and UIAutomator2 for API >= 21 - */ -@Retention(RUNTIME) @Target({FIELD, TYPE}) -@Repeatable(SelendroidFindBySet.class) -@Deprecated -public @interface SelendroidFindBy { - /** - * It is an id of the target element. - * - * @return an id of the target element - */ - String id() default ""; - - /** - * It is used in Selendroid mode instead of accessibility id. - * - * @return name - */ - String name() default ""; - - /** - * It is a className of the target element. - * - * @return a className of the target element - */ - String className() default ""; - - /** - * It is a desired element tag. - * - * @return a desired element tag - */ - String tagName() default ""; - - /** - * It is a xpath to the target element. - * - * @return a xpath to the target element - */ - String xpath() default ""; - - /** - * It is a text of the desired element. - * - * @return a text of the desired element - */ - String linkText() default ""; - - /** - * It is a part of the text of the desired element. - * - * @return a part of the text of the desired element - */ - String partialLinkText() default ""; - - /** - * Priority of the searching. Higher number means lower priority. - * - * @return priority of the searching - */ - int priority() default 0; -} diff --git a/src/main/java/io/appium/java_client/pagefactory/SelendroidFindByAllSet.java b/src/main/java/io/appium/java_client/pagefactory/SelendroidFindByAllSet.java deleted file mode 100644 index 8bee5f94f..000000000 --- a/src/main/java/io/appium/java_client/pagefactory/SelendroidFindByAllSet.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.pagefactory; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Defines set of chained/possible locators. Each one locator - * should be defined with {@link SelendroidFindAll} - * - * @deprecated Selendroid driver is going to be deprecated. - * Use {@link AndroidFindAll} instead. - * It is recommended to use UIAutomator1 for Android API below 21 - * and UIAutomator2 for API >= 21 - */ -@Target(value = {TYPE, FIELD}) -@Retention(value = RUNTIME) -@Deprecated -public @interface SelendroidFindByAllSet { - /** - * @return an array of {@link SelendroidFindAll} which builds a sequence of - * the chained searching for elements or a set of possible locators - */ - SelendroidFindAll[] value(); -} diff --git a/src/main/java/io/appium/java_client/pagefactory/SelendroidFindByChainSet.java b/src/main/java/io/appium/java_client/pagefactory/SelendroidFindByChainSet.java deleted file mode 100644 index 8b5cee026..000000000 --- a/src/main/java/io/appium/java_client/pagefactory/SelendroidFindByChainSet.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.pagefactory; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Defines set of chained/possible locators. Each one locator - * should be defined with {@link SelendroidFindBys} - * - * @deprecated Selendroid driver is going to be deprecated. - * Use {@link AndroidFindBys} instead. - * It is recommended to use UIAutomator1 for Android API below 21 - * and UIAutomator2 for API >= 21 - */ -@Target(value = {TYPE, FIELD}) -@Retention(value = RUNTIME) -@Deprecated -public @interface SelendroidFindByChainSet { - /** - * @return an array of {@link SelendroidFindBys} which builds a sequence of - * the chained searching for elements or a set of possible locators - */ - SelendroidFindBys[] value(); -} diff --git a/src/main/java/io/appium/java_client/pagefactory/SelendroidFindBySet.java b/src/main/java/io/appium/java_client/pagefactory/SelendroidFindBySet.java deleted file mode 100644 index e1e34acc6..000000000 --- a/src/main/java/io/appium/java_client/pagefactory/SelendroidFindBySet.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.pagefactory; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Defines set of chained/possible locators. Each one locator - * should be defined with {@link io.appium.java_client.pagefactory.SelendroidFindBy} - * - * @deprecated Selendroid driver is going to be deprecated. - * Use {@link AndroidFindBySet} instead. - * It is recommended to use UIAutomator1 for Android API below 21 - * and UIAutomator2 for API >= 21 - */ -@Target(value = {TYPE, FIELD}) -@Retention(value = RUNTIME) -@Deprecated -public @interface SelendroidFindBySet { - /** - * @return an array of {@link io.appium.java_client.pagefactory.SelendroidFindBy} which builds a sequence of - * the chained searching for elements or a set of possible locators - */ - SelendroidFindBy[] value(); -} diff --git a/src/main/java/io/appium/java_client/pagefactory/SelendroidFindBys.java b/src/main/java/io/appium/java_client/pagefactory/SelendroidFindBys.java deleted file mode 100644 index ffb945b68..000000000 --- a/src/main/java/io/appium/java_client/pagefactory/SelendroidFindBys.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.pagefactory; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Used to mark a field on a Page Object to indicate that lookup should - * use a series of {@link SelendroidBy} tags. - * - * @deprecated Selendroid driver is going to be deprecated. - * Use {@link AndroidBy} instead. - * It is recommended to use UIAutomator1 for Android API below 21 - * and UIAutomator2 for API >= 21 - */ -@Retention(RUNTIME) @Target({FIELD, TYPE}) -@Deprecated -public @interface SelendroidFindBys { - /** - * It is a set of {@link SelendroidBy} strategies which build the chain of the searching for the target element. - * - * @return a collection of strategies which build the chain of the searching for the target element - */ - SelendroidBy[] value(); - - /** - * Priority of the searching. Higher number means lower priority. - * - * @return priority of the searching - */ - int priority() default 0; -} 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 ee4a8c18c..4f509598b 100644 --- a/src/main/java/io/appium/java_client/pagefactory/WidgetByBuilder.java +++ b/src/main/java/io/appium/java_client/pagefactory/WidgetByBuilder.java @@ -70,7 +70,7 @@ private By getByFromDeclaredClass(WhatIsNeeded whatIsNeeded) { } else { convenientClass = getMobileNativeWidgetClass((Class) declaredClass, field, - platform, automation); + platform); } while (result == null && !convenientClass.equals(Object.class)) { 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 fe6cd8dec..a401ac456 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 @@ -175,10 +175,6 @@ protected boolean isAndroid() { return ANDROID.equalsIgnoreCase(platform); } - protected boolean isSelendroidAutomation() { - return isAndroid() && SELENDROID.equalsIgnoreCase(automation); - } - protected boolean isIOS() { return IOS.equalsIgnoreCase(platform); } diff --git a/src/main/java/io/appium/java_client/pagefactory/bys/builder/Strategies.java b/src/main/java/io/appium/java_client/pagefactory/bys/builder/Strategies.java index 8e4f5f877..a0e48eecd 100644 --- a/src/main/java/io/appium/java_client/pagefactory/bys/builder/Strategies.java +++ b/src/main/java/io/appium/java_client/pagefactory/bys/builder/Strategies.java @@ -20,7 +20,6 @@ import io.appium.java_client.pagefactory.AndroidBy; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.iOSBy; -import io.appium.java_client.pagefactory.iOSFindBy; import org.openqa.selenium.By; import java.lang.annotation.Annotation; @@ -37,10 +36,6 @@ enum Strategies { || annotation.annotationType().equals(AndroidBy.class)) { return MobileBy.AndroidUIAutomator(value); } - if (annotation.annotationType().equals(iOSFindBy.class) - || annotation.annotationType().equals(iOSBy.class)) { - return MobileBy.IosUIAutomation(value); - } return super.getBy(annotation); } }, diff --git a/src/main/java/io/appium/java_client/pagefactory/iOSFindAll.java b/src/main/java/io/appium/java_client/pagefactory/iOSFindAll.java deleted file mode 100644 index b18041dde..000000000 --- a/src/main/java/io/appium/java_client/pagefactory/iOSFindAll.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.pagefactory; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Repeatable; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Used to mark a field on a Page/Screen Object to indicate that lookup should use a series - * of {@link io.appium.java_client.pagefactory.iOSBy} tags. - * It will then search for all elements that match any criteria. Note that elements - * are not guaranteed to be in document order. - * - * @deprecated UIAutomation is going to get deprecated. - * Use {@link iOSXCUITFindAll} instead - * It is recommended to use XCUITest - */ -@Retention(RUNTIME) -@Target({FIELD, TYPE}) -@Repeatable(iOSFindByAllSet.class) -public @interface iOSFindAll { - /** - * It is a set of {@link iOSBy} strategies which may be used to find the target element. - * - * @return a collection of strategies which may be used to find the target element - */ - iOSBy[] value(); - - /** - * Priority of the searching. Higher number means lower priority. - * - * @return priority of the searching - */ - int priority() default 0; -} diff --git a/src/main/java/io/appium/java_client/pagefactory/iOSFindBy.java b/src/main/java/io/appium/java_client/pagefactory/iOSFindBy.java deleted file mode 100644 index d11596f5d..000000000 --- a/src/main/java/io/appium/java_client/pagefactory/iOSFindBy.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.pagefactory; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Repeatable; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - - -/** - * Used to mark a field on a Page Object to indicate an alternative mechanism for locating the - * element or a list of elements. Used in conjunction with - * {@link org.openqa.selenium.support.PageFactory} - * this allows users to quickly and easily create PageObjects. - * using iOS UI selectors, accessibility, id, name, class name, tag and xpath - * - * @deprecated UIAutomation is going to get deprecated. - * Use {@link iOSXCUITFindBy} instead - * It is recommended to use XCUITest - */ -@Retention(RUNTIME) -@Target({FIELD, TYPE}) -@Repeatable(iOSFindBySet.class) -public @interface iOSFindBy { - /** - * It is an iOS UIAutomation string. - * Read https://developer.apple.com/library/tvos/documentation/DeveloperTools/ - * Conceptual/InstrumentsUserGuide/UIAutomation.html - * - * @return an iOS UIAutomation string - */ - String uiAutomator() default ""; - - /** - * It an UI automation accessibility Id which is a convenient to iOS. - * About iOS accessibility - * See UIAccessibilityIdentification - * - * @return an UI automation accessibility Id - */ - String accessibility() default ""; - - /** - * It is an id of the target element. - * - * @return an id of the target element - */ - String id() default ""; - - /** - * It is a name of a type/class of the target element. - * - * @return a name of a type/class of the target element - */ - String className() default ""; - - /** - * It is a desired element tag. - * - * @return a desired element tag - */ - String tagName() default ""; - - /** - * It is a xpath to the target element. - * - * @return a xpath to the target element - */ - String xpath() default ""; - - /** - * Priority of the searching. Higher number means lower priority. - * - * @return priority of the searching - */ - int priority() default 0; -} diff --git a/src/main/java/io/appium/java_client/pagefactory/iOSFindByAllSet.java b/src/main/java/io/appium/java_client/pagefactory/iOSFindByAllSet.java deleted file mode 100644 index 838059965..000000000 --- a/src/main/java/io/appium/java_client/pagefactory/iOSFindByAllSet.java +++ /dev/null @@ -1,26 +0,0 @@ -package io.appium.java_client.pagefactory; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Defines set of chained/possible locators. Each one locator - * should be defined with {@link io.appium.java_client.pagefactory.iOSFindAll} - * - * @deprecated UIAutomation is going to get deprecated. - * Use {@link iOSXCUITFindByAllSet} instead - * It is recommended to use XCUITest - */ -@Target(value = {TYPE, FIELD}) -@Retention(value = RUNTIME) -public @interface iOSFindByAllSet { - /** - * @return an array of {@link io.appium.java_client.pagefactory.iOSFindAll} which builds a sequence of - * the chained searching for elements or a set of possible locators - */ - iOSFindAll[] value(); -} diff --git a/src/main/java/io/appium/java_client/pagefactory/iOSFindByChainSet.java b/src/main/java/io/appium/java_client/pagefactory/iOSFindByChainSet.java deleted file mode 100644 index 7a3493383..000000000 --- a/src/main/java/io/appium/java_client/pagefactory/iOSFindByChainSet.java +++ /dev/null @@ -1,26 +0,0 @@ -package io.appium.java_client.pagefactory; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Defines set of chained/possible locators. Each one locator - * should be defined with {@link io.appium.java_client.pagefactory.iOSFindBys} - * - * @deprecated UIAutomation is going to get deprecated. - * Use {@link iOSXCUITFindByChainSet} instead - * It is recommended to use XCUITest - */ -@Target(value = {TYPE, FIELD}) -@Retention(value = RUNTIME) -public @interface iOSFindByChainSet { - /** - * @return an array of {@link io.appium.java_client.pagefactory.iOSFindBys} which builds a sequence of - * the chained searching for elements or a set of possible locators - */ - iOSFindBys[] value(); -} diff --git a/src/main/java/io/appium/java_client/pagefactory/iOSFindBySet.java b/src/main/java/io/appium/java_client/pagefactory/iOSFindBySet.java deleted file mode 100644 index 4656f3c7e..000000000 --- a/src/main/java/io/appium/java_client/pagefactory/iOSFindBySet.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.pagefactory; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Defines set of chained/possible locators. Each one locator - * should be defined with {@link io.appium.java_client.pagefactory.iOSFindBy} - * - * @deprecated UIAutomation is going to get deprecated. - * Use {@link iOSXCUITFindBySet} instead - * It is recommended to use XCUITest - */ -@Target(value = {TYPE, FIELD}) -@Retention(value = RUNTIME) -public @interface iOSFindBySet { - /** - * @return an array of {@link io.appium.java_client.pagefactory.iOSFindBy} which builds a sequence of - * the chained searching for elements or a set of possible locators - */ - iOSFindBy[] value(); -} diff --git a/src/main/java/io/appium/java_client/pagefactory/iOSFindBys.java b/src/main/java/io/appium/java_client/pagefactory/iOSFindBys.java deleted file mode 100644 index 7f1b14515..000000000 --- a/src/main/java/io/appium/java_client/pagefactory/iOSFindBys.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.pagefactory; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Repeatable; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Used to mark a field on a Page Object to indicate that lookup should use - * a series of {@link io.appium.java_client.pagefactory.iOSBy} tags. - * - * @deprecated UIAutomation is going to get deprecated. - * Use {@link iOSXCUITFindBys} instead - * It is recommended to use XCUITest - */ -@Retention(RUNTIME) -@Target({FIELD, TYPE}) -@Repeatable(iOSFindByChainSet.class) -public @interface iOSFindBys { - /** - * It is a set of {@link iOSBy} strategies which build the chain of the searching for the target element. - * - * @return a collection of strategies which build the chain of the searching for the target element - */ - iOSBy[] value(); - - /** - * Priority of the searching. Higher number means lower priority. - * - * @return priority of the searching - */ - int priority() default 0; -} diff --git a/src/main/java/io/appium/java_client/remote/AndroidMobileCapabilityType.java b/src/main/java/io/appium/java_client/remote/AndroidMobileCapabilityType.java index 041f16207..60acb0b77 100644 --- a/src/main/java/io/appium/java_client/remote/AndroidMobileCapabilityType.java +++ b/src/main/java/io/appium/java_client/remote/AndroidMobileCapabilityType.java @@ -249,14 +249,6 @@ public interface AndroidMobileCapabilityType extends CapabilityType { */ String ANDROID_NATURAL_ORIENTATION = "androidNaturalOrientation"; - /** - * Selendroid driver is going to be deprecated. - * It is recommended to use UIAutomator1 for Android API below 21 - * and UIAutomator2 for API >= 21 - */ - @Deprecated - String SELENDROID_PORT = "selendroidPort"; - /** * The port number, which being used by UIAutomator2. */ 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 29f808ee1..f04427d6f 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 @@ -25,15 +25,6 @@ public enum AndroidServerFlag implements ServerArgument { * --bootstrap-port 4724 */ BOOTSTRAP_PORT_NUMBER("--bootstrap-port"), - /** - * Local port used for communication with Selendroid. Sample: - * --selendroid-port 8080 - * Selendroid driver is going to be deprecated. - * It is recommended to use UIAutomator1 for Android API below 21 - * and UIAutomator2 for API >= 21 - */ - @Deprecated - SELENDROID_PORT("--selendroid-port"), /** * If set, prevents Appium from killing the adb server * instance. Default: false diff --git a/src/test/java/io/appium/java_client/events/BaseListenerTest.java b/src/test/java/io/appium/java_client/events/BaseListenerTest.java index 6056e86cb..6d8ef0170 100644 --- a/src/test/java/io/appium/java_client/events/BaseListenerTest.java +++ b/src/test/java/io/appium/java_client/events/BaseListenerTest.java @@ -91,8 +91,6 @@ protected boolean assertThatSearchListenerWorksAgainstElements(EmptyWebDriver dr e.findElementByAccessibilityId("SomeAccessibility") .findElement(MobileBy.AndroidUIAutomator("Android UI Automator")); - els.get(0).findElementByAccessibilityId("SomeAccessibility") - .findElement(MobileBy.IosUIAutomation("iOS UI Automation")); assertThat(listener.messages, contains(prefix + "Attempt to find something using By.AndroidUIAutomator: Android UI Automator. " @@ -100,11 +98,6 @@ protected boolean assertThatSearchListenerWorksAgainstElements(EmptyWebDriver dr prefix + "The searching for something using By.AndroidUIAutomator: " + "Android UI Automator has " + "beed finished. " - + "The root element was io.appium.java_client.events.StubWebElement", - prefix + "Attempt to find something using By.IosUIAutomation: iOS UI Automation. " - + "The root element is io.appium.java_client.events.StubWebElement", - prefix + "The searching for something using By.IosUIAutomation: iOS UI Automation " - + "has beed finished. " + "The root element was io.appium.java_client.events.StubWebElement")); return true; } finally { diff --git a/src/test/java/io/appium/java_client/events/EmptyWebDriver.java b/src/test/java/io/appium/java_client/events/EmptyWebDriver.java index 802a01690..460c0b773 100644 --- a/src/test/java/io/appium/java_client/events/EmptyWebDriver.java +++ b/src/test/java/io/appium/java_client/events/EmptyWebDriver.java @@ -5,7 +5,6 @@ import io.appium.java_client.FindsByAccessibilityId; import io.appium.java_client.FindsByAndroidUIAutomator; import io.appium.java_client.FindsByFluentSelector; -import io.appium.java_client.FindsByIosUIAutomation; import org.apache.commons.lang3.StringUtils; import org.openqa.selenium.Alert; @@ -42,8 +41,7 @@ public class EmptyWebDriver implements WebDriver, ContextAware, Rotatable, FindsByClassName, FindsByCssSelector, FindsById, FindsByLinkText, FindsByTagName, FindsByXPath, FindsByAccessibilityId, FindsByAndroidUIAutomator, - FindsByIosUIAutomation, JavascriptExecutor, HasCapabilities, FindsByFluentSelector, - TakesScreenshot { + JavascriptExecutor, HasCapabilities, FindsByFluentSelector, TakesScreenshot { private static List createStubList() { return ImmutableList.of(new StubWebElement(), new StubWebElement()); @@ -211,14 +209,6 @@ public List findElements(String by, String using) throws WebDriv return createStubList(); } - @Override public StubWebElement findElementByIosUIAutomation(String using) { - return new StubWebElement(); - } - - @Override public List findElementsByIosUIAutomation(String using) { - return createStubList(); - } - @Override public Object executeScript(String script, Object... args) { return null; } diff --git a/src/test/java/io/appium/java_client/events/StubWebElement.java b/src/test/java/io/appium/java_client/events/StubWebElement.java index be2610dd8..36179206d 100644 --- a/src/test/java/io/appium/java_client/events/StubWebElement.java +++ b/src/test/java/io/appium/java_client/events/StubWebElement.java @@ -5,7 +5,6 @@ import io.appium.java_client.FindsByAccessibilityId; import io.appium.java_client.FindsByAndroidUIAutomator; import io.appium.java_client.FindsByFluentSelector; -import io.appium.java_client.FindsByIosUIAutomation; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; import org.openqa.selenium.NoSuchElementException; @@ -26,7 +25,7 @@ public class StubWebElement implements WebElement, FindsByClassName, FindsByCssSelector, FindsById, FindsByLinkText, FindsByTagName, FindsByXPath, FindsByAccessibilityId, - FindsByAndroidUIAutomator, FindsByIosUIAutomation, FindsByFluentSelector { + FindsByAndroidUIAutomator, FindsByFluentSelector { private static List createStubSubElementList() { return new ArrayList<>(ImmutableList.of(new StubWebElement(), new StubWebElement())); @@ -73,14 +72,6 @@ private static List createStubSubElementList() { return createStubSubElementList(); } - @Override public WebElement findElementByIosUIAutomation(String using) { - return new StubWebElement(); - } - - @Override public List findElementsByIosUIAutomation(String using) { - return createStubSubElementList(); - } - @Override public WebElement findElementByLinkText(String using) { return new StubWebElement(); } diff --git a/src/test/java/io/appium/java_client/ios/UIAutomationTest.java b/src/test/java/io/appium/java_client/ios/UIAutomationTest.java deleted file mode 100644 index 0ffd6fa8b..000000000 --- a/src/test/java/io/appium/java_client/ios/UIAutomationTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.ios; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; - -import io.appium.java_client.MobileBy; -import io.appium.java_client.MobileElement; -import org.junit.Test; - -public class UIAutomationTest extends UICatalogIOSTest { - - @Test public void scrollByDriver() { - MobileElement slider = driver - .findElement(MobileBy - .IosUIAutomation(".tableViews()[0]" - + ".scrollToElementWithPredicate(\"name CONTAINS 'Slider'\")")); - assertEquals(slider.getAttribute("name"), "Sliders"); - } - - @Test public void scrollByElement() { - MobileElement table = driver.findElement(MobileBy - .IosUIAutomation(".tableViews()[0]")); - MobileElement slider = table.findElement(MobileBy - .IosUIAutomation(".scrollToElementWithPredicate(\"name CONTAINS 'Slider'\")")); - assertEquals(slider.getAttribute("name"), "Sliders"); - } - - @Test public void findByByIosUIAutomationFromDriverTest() { - assertNotEquals(driver - .findElement(MobileBy.IosUIAutomation(".elements().withName(\"Answer\")")) - .getText(), null); - assertNotEquals(driver - .findElements(MobileBy.IosUIAutomation(".elements().withName(\"Answer\")")) - .size(), 0); - } - - @Test public void findByAccessibilityIdFromElementTest() { - assertNotEquals(driver.findElementsByClassName("UIAWindow").get(1) - .findElementsByAccessibilityId("ComputeSumButton").size(), 0); - } - - @Test public void findByByIosUIAutomationTest() { - assertNotEquals((driver.findElementsByClassName("UIAWindow") - .get(1)) - .findElementByIosUIAutomation(".elements().withName(\"Answer\")").getText(), null); - } -} diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/AndroidPageObjectTest.java b/src/test/java/io/appium/java_client/pagefactory_tests/AndroidPageObjectTest.java index 3d0053f3f..99121e990 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/AndroidPageObjectTest.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/AndroidPageObjectTest.java @@ -34,8 +34,6 @@ import io.appium.java_client.pagefactory.AndroidFindBys; import io.appium.java_client.pagefactory.AppiumFieldDecorator; import io.appium.java_client.pagefactory.HowToUseLocators; -import io.appium.java_client.pagefactory.SelendroidFindBy; -import io.appium.java_client.pagefactory.iOSFindBy; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.NoSuchElementException; @@ -59,10 +57,7 @@ public class AndroidPageObjectTest extends BaseAndroidTest { @AndroidFindBy(className = "android.widget.TextView") private List androidTextViews; - @iOSFindBy(uiAutomator = ".elements()[0]") - private List iosTextViews; - - @iOSFindBy(uiAutomator = ".elements()[0]") @AndroidFindBy(className = "android.widget.TextView") + @AndroidFindBy(className = "android.widget.TextView") private List androidOriOsTextViews; @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/text1\")") @@ -81,13 +76,9 @@ public class AndroidPageObjectTest extends BaseAndroidTest { @AndroidFindBy(className = "android.widget.TextView") private List chainElementViews; - @iOSFindBy(uiAutomator = ".elements()[0]") @iOSFindBy(xpath = "//someElement") - private List iosChainTextViews; - @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/content\")") @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/list\")") @AndroidFindBy(id = "android:id/text1") - @iOSFindBy(uiAutomator = ".elements()[0]") @iOSFindBy(xpath = "//someElement") private List chainAndroidOrIOSUIAutomatorViews; @FindBy(id = "android:id/text1") @@ -96,10 +87,7 @@ public class AndroidPageObjectTest extends BaseAndroidTest { @AndroidFindBy(className = "android.widget.TextView") private WebElement androidTextView; - @iOSFindBy(uiAutomator = ".elements()[0]") - private WebElement iosTextView; - - @AndroidFindBy(className = "android.widget.TextView") @iOSFindBy(uiAutomator = ".elements()[0]") + @AndroidFindBy(className = "android.widget.TextView") private WebElement androidOriOsTextView; @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/text1\")") @@ -118,13 +106,9 @@ public class AndroidPageObjectTest extends BaseAndroidTest { @AndroidFindBy(className = "android.widget.TextView") private WebElement chainElementView; - @iOSFindBy(uiAutomator = ".elements()[0]") @iOSFindBy(xpath = "//someElement") - private WebElement iosChainTextView; - @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/content\")") @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/list\")") @AndroidFindBy(id = "android:id/text1") - @iOSFindBy(uiAutomator = ".elements()[0]") @iOSFindBy(xpath = "//someElement") private WebElement chainAndroidOrIOSUIAutomatorView; @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/content\")") @@ -153,13 +137,13 @@ public class AndroidPageObjectTest extends BaseAndroidTest { @AndroidFindBy(id = "android:id/FakeId") private WebElement findAllElementView; - @AndroidFindBy(id = "android:id/text1") @SelendroidFindBy(id = "Invalid Identifier") + @AndroidFindBy(id = "android:id/text1") private WebElement textAndroidId; - @iOSFindBy(uiAutomator = ".elements()[0]") @FindBy(css = "e.e1.e2") + @FindBy(css = "e.e1.e2") private List elementsWhenAndroidLocatorIsNotDefinedAndThereIsInvalidFindBy; - @iOSFindBy(uiAutomator = ".elements()[0]") @FindBy(css = "e.e1.e2") + @FindBy(css = "e.e1.e2") private WebElement elementWhenAndroidLocatorIsNotDefinedAndThereIsInvalidFindBy; @FindBy(id = "fakeId") @@ -266,14 +250,6 @@ public class AndroidPageObjectTest extends BaseAndroidTest { assertNotEquals(null, androidTextView.getAttribute("text")); } - @Test public void checkThatElementsWereNotFoundByIOSUIAutomator() { - assertEquals(0, iosTextViews.size()); - } - - @Test(expected = NoSuchElementException.class) public void checkThatElementWasNotFoundByIOSUIAutomator() { - assertNotNull(iosTextView.getAttribute("text")); - } - @Test public void androidOrIOSFindByElementsTest() { assertNotEquals(0, androidOriOsTextViews.size()); } @@ -322,14 +298,6 @@ public class AndroidPageObjectTest extends BaseAndroidTest { assertNotEquals(null, chainElementView.getAttribute("text")); } - @Test public void checkThatElementsWereNotFoundByIOSUIAutomatorChain() { - assertEquals(0, iosChainTextViews.size()); - } - - @Test(expected = NoSuchElementException.class) public void checkThatElementWasNotFoundByIOSUIAutomatorChain() { - assertNotNull(iosChainTextView.getAttribute("text")); - } - @Test public void androidOrIOSFindByElementsTestChainSearches() { assertNotEquals(0, chainAndroidOrIOSUIAutomatorViews.size()); } diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/DesktopBrowserCompatibilityTest.java b/src/test/java/io/appium/java_client/pagefactory_tests/DesktopBrowserCompatibilityTest.java index b1fb7bd67..93fa1225e 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/DesktopBrowserCompatibilityTest.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/DesktopBrowserCompatibilityTest.java @@ -26,7 +26,7 @@ import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.AppiumFieldDecorator; import io.appium.java_client.pagefactory.HowToUseLocators; -import io.appium.java_client.pagefactory.iOSFindBy; +import io.appium.java_client.pagefactory.iOSXCUITFindBy; import org.junit.BeforeClass; import org.junit.Test; import org.openqa.selenium.WebDriver; @@ -41,9 +41,9 @@ public class DesktopBrowserCompatibilityTest { - @HowToUseLocators(iOSAutomation = ALL_POSSIBLE) + @HowToUseLocators(iOSXCUITAutomation = ALL_POSSIBLE) @AndroidFindBy(className = "someClass") - @iOSFindBy(xpath = "//selector[1]") @iOSFindBy(xpath = "//someTag") + @iOSXCUITFindBy(xpath = "//selector[1]") @iOSXCUITFindBy(xpath = "//someTag") @FindBys({@FindBy(id = "main"), @FindBy(tagName = "p")}) private List foundLinks; private List main; //this list is located by id="main" diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/IOSMobileBrowserCompatibilityTest.java b/src/test/java/io/appium/java_client/pagefactory_tests/IOSMobileBrowserCompatibilityTest.java index 6f2615033..42f9239c1 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/IOSMobileBrowserCompatibilityTest.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/IOSMobileBrowserCompatibilityTest.java @@ -21,7 +21,7 @@ import io.appium.java_client.ios.IOSDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.AppiumFieldDecorator; -import io.appium.java_client.pagefactory.iOSFindBy; +import io.appium.java_client.pagefactory.iOSXCUITFindBy; import io.appium.java_client.remote.IOSMobileCapabilityType; import io.appium.java_client.remote.MobileBrowserType; import io.appium.java_client.remote.MobileCapabilityType; @@ -46,10 +46,10 @@ public class IOSMobileBrowserCompatibilityTest { @FindBy(name = "q") @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/someId\")") - @iOSFindBy(className = "someClass") private WebElement searchTextField; + @iOSXCUITFindBy(className = "someClass") private WebElement searchTextField; @AndroidFindBy(className = "someClass") - @FindBys({@FindBy(className = "r"), @FindBy(tagName = "a")}) @iOSFindBy(className = "someClass") + @FindBys({@FindBy(className = "r"), @FindBy(tagName = "a")}) @iOSXCUITFindBy(className = "someClass") private List foundLinks; /** diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/IOSPageFactoryTest.java b/src/test/java/io/appium/java_client/pagefactory_tests/IOSPageFactoryTest.java deleted file mode 100644 index 0ccfaf91a..000000000 --- a/src/test/java/io/appium/java_client/pagefactory_tests/IOSPageFactoryTest.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.pagefactory_tests; - -import static io.appium.java_client.pagefactory.LocatorGroupStrategy.ALL_POSSIBLE; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import io.appium.java_client.MobileElement; - -import io.appium.java_client.ios.AppIOSTest; -import io.appium.java_client.ios.IOSElement; -import io.appium.java_client.pagefactory.AndroidFindBy; -import io.appium.java_client.pagefactory.AppiumFieldDecorator; -import io.appium.java_client.pagefactory.HowToUseLocators; -import io.appium.java_client.pagefactory.iOSFindBy; - -import org.junit.Before; -import org.junit.Test; - -import org.openqa.selenium.NoSuchElementException; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.remote.RemoteWebElement; -import org.openqa.selenium.support.CacheLookup; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; - -import java.util.List; - -public class IOSPageFactoryTest extends AppIOSTest { - - private boolean populated = false; - - @FindBy(className = "UIAButton") - private List uiButtons; - - @FindBy(className = "UIAButton") - private List iosUIButtons; - - @iOSFindBy(uiAutomator = ".elements()[0]") - private List iosUIAutomatorButtons; - - @iOSFindBy(uiAutomator = ".elements()[0]") - @AndroidFindBy(className = "android.widget.TextView") - private List androidOriOsTextViews; - - @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/text1\")") - private List androidUIAutomatorViews; - - @iOSFindBy(uiAutomator = ".elements()[0]") - private List mobileButtons; - - @FindBy(className = "UIAButton") - private List mobiletFindByButtons; - - @iOSFindBy(uiAutomator = ".elements()[0]") - private List remoteElementViews; - - @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/list\")") - @AndroidFindBy(className = "android.widget.TextView") - private List chainElementViews; - - - @FindBy(className = "UIAButton") - private WebElement uiButton; - - @CacheLookup - @FindBy(className = "UIAButton") - private MobileElement cached; - - @FindBy(className = "UIAButton") - private WebElement iosUIButton; - - @iOSFindBy(uiAutomator = ".elements()[0]") - private WebElement iosUIAutomatorButton; - - @AndroidFindBy(className = "android.widget.TextView") @iOSFindBy(uiAutomator = ".elements()[0]") - private WebElement androidOriOsTextView; - - @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/text1\")") - private WebElement androidUIAutomatorView; - - @iOSFindBy(uiAutomator = ".elements()[0]") - private MobileElement mobileButton; - - @FindBy(className = "UIAButton") - private MobileElement mobiletFindByButton; - - @iOSFindBy(uiAutomator = ".elements()[0]") - private RemoteWebElement remotetextVieW; - - @AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/list\")") - @AndroidFindBy(className = "android.widget.TextView") - private WebElement chainElementView; - - @iOSFindBy(uiAutomator = ".elements()[0]") - private IOSElement iosButton; - - @iOSFindBy(uiAutomator = ".elements()[0]") - private List iosButtons; - - @HowToUseLocators(iOSAutomation = ALL_POSSIBLE) - @iOSFindBy(id = "ComputeSumButton_Test") - @iOSFindBy(xpath = "//*[@name = \"ComputeSumButton\"]") - private WebElement findAllElement; - - @HowToUseLocators(iOSAutomation = ALL_POSSIBLE) - @iOSFindBy(id = "ComputeSumButton_Test") - @iOSFindBy(xpath = "//*[@name = \"ComputeSumButton\"]") - private List findAllElements; - - @AndroidFindBy(className = "android.widget.TextView") @FindBy(css = "e.e1.e2") - private List elementsWhenAndroidLocatorIsNotDefinedAndThereIsInvalidFindBy; - - @AndroidFindBy(className = "android.widget.TextView") @FindBy(css = "e.e1.e2") - private WebElement elementWhenAndroidLocatorIsNotDefinedAndThereIsInvalidFindBy; - - /** - * The setting up. - */ - @Before public void setUp() { - if (!populated) { - PageFactory.initElements(new AppiumFieldDecorator(driver), this); - } - - populated = true; - } - - @Test public void findByElementsTest() { - assertNotEquals(0, uiButtons.size()); - } - - @Test public void findByElementTest() { - assertNotEquals(null, uiButton.getText()); - } - - @Test public void checkCached() { - assertEquals(cached.getId(), cached.getId()); - } - - - @Test public void iosFindByElementsTest() { - assertNotEquals(0, iosUIButtons.size()); - } - - @Test public void iosFindByElementTest() { - assertNotEquals(null, iosUIButton.getText()); - } - - @Test public void checkThatElementsWereNotFoundByAndroidUIAutomator() { - assertEquals(0, androidUIAutomatorViews.size()); - } - - @Test(expected = NoSuchElementException.class) public void checkThatElementWasNotFoundByAndroidUIAutomator() { - assertNotNull(androidUIAutomatorView.getText()); - } - - @Test public void androidOriOSFindByElementsTest() { - assertNotEquals(0, androidOriOsTextViews.size()); - } - - @Test public void androidOrIOSFindByElementTest() { - assertNotEquals(null, androidOriOsTextView.getText()); - } - - @Test public void iosFindByUIAutomatorElementsTest() { - assertNotEquals(0, iosUIAutomatorButtons.size()); - } - - @Test public void iosFindByUIAutomatorElementTest() { - assertNotEquals(null, iosUIAutomatorButton.getText()); - } - - @Test public void areMobileElementsTest() { - assertNotEquals(0, mobileButtons.size()); - } - - @Test public void isMobileElementTest() { - assertNotEquals(null, mobileButton.getText()); - } - - @Test public void areMobileElementsFindByTest() { - assertNotEquals(0, mobiletFindByButtons.size()); - } - - @Test public void isMobileElementFindByTest() { - assertNotEquals(null, mobiletFindByButton.getText()); - } - - @Test public void areRemoteElementsTest() { - assertNotEquals(0, remoteElementViews.size()); - } - - @Test public void isRemoteElementTest() { - assertNotEquals(null, remotetextVieW.getText()); - } - - @Test public void checkThatElementsWereNotFoundByAndroidUIAutomatorChain() { - assertEquals(0, chainElementViews.size()); - } - - @Test(expected = NoSuchElementException.class) public void checkThatElementWasNotFoundByAndroidUIAutomatorChain() { - assertNotNull(chainElementView.getText()); - } - - @Test public void isIOSElementTest() { - assertNotEquals(null, iosButton.getText()); - } - - @Test public void areIOSElementsFindByTest() { - assertNotEquals(0, iosButtons.size()); - } - - @Test public void findAllElementsTest() { - assertNotEquals(0, findAllElements.size()); - } - - @Test public void findAllElementTest() { - assertNotEquals(null, findAllElement.getText()); - } - - @Test(expected = NoSuchElementException.class) public void checkThatTestWillNotBeFailedBecauseOfInvalidFindBy() { - assertNotNull(elementWhenAndroidLocatorIsNotDefinedAndThereIsInvalidFindBy - .getAttribute("text")); - } - - @Test public void checkThatTestWillNotBeFailedBecauseOfInvalidFindByList() { - assertEquals(0, elementsWhenAndroidLocatorIsNotDefinedAndThereIsInvalidFindBy.size()); - } -} diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/SelendroidModeTest.java b/src/test/java/io/appium/java_client/pagefactory_tests/SelendroidModeTest.java deleted file mode 100644 index 2c056c2ef..000000000 --- a/src/test/java/io/appium/java_client/pagefactory_tests/SelendroidModeTest.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.appium.java_client.pagefactory_tests; - -import static io.appium.java_client.pagefactory.LocatorGroupStrategy.ALL_POSSIBLE; -import static java.time.Duration.ofSeconds; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import io.appium.java_client.AppiumDriver; -import io.appium.java_client.android.AndroidDriver; - -import io.appium.java_client.android.AndroidElement; -import io.appium.java_client.pagefactory.AndroidFindBy; -import io.appium.java_client.pagefactory.AppiumFieldDecorator; -import io.appium.java_client.pagefactory.HowToUseLocators; -import io.appium.java_client.pagefactory.SelendroidFindBy; -import io.appium.java_client.remote.AndroidMobileCapabilityType; -import io.appium.java_client.remote.AutomationName; -import io.appium.java_client.remote.MobileCapabilityType; -import io.appium.java_client.service.local.AppiumDriverLocalService; -import io.appium.java_client.service.local.AppiumServiceBuilder; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.remote.DesiredCapabilities; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; - -import java.io.File; -import java.util.List; - -public class SelendroidModeTest { - private static int SELENDROID_PORT = 9999; - - private static AppiumDriver driver; - private static AppiumDriverLocalService service; - private boolean populated = false; - - @SelendroidFindBy(id = "text1") private WebElement textId; - - @AndroidFindBy(id = "Invalid Identifier") @SelendroidFindBy(id = "text1") - private WebElement textSelendroidId; - - @SelendroidFindBy(name = "Accessibility") - private WebElement textName; - - @AndroidFindBy(xpath = ".//*[@name = 'Accessibility']") - private WebElement textNameAndroid; - - @FindBy(name = "Accessibility") - private WebElement textNameDefault; - - @SelendroidFindBy(xpath = "//TextView[@value='Accessibility']") - private WebElement textXpath; - - @SelendroidFindBy(id = "content") - @SelendroidFindBy(id = "text1") - private WebElement textIds; - - @HowToUseLocators(selendroidAutomation = ALL_POSSIBLE) - @SelendroidFindBy(id = "text999") @SelendroidFindBy(id = "text1") - private WebElement textAll; - - @HowToUseLocators(selendroidAutomation = ALL_POSSIBLE) - @SelendroidFindBy(id = "text999") @SelendroidFindBy(id = "text1") - private List textsAll; - - @SelendroidFindBy(className = "android.widget.TextView") private WebElement textClass; - - @SelendroidFindBy(tagName = "TextView") private WebElement textTag; - - @SelendroidFindBy(linkText = "Accessibility") private WebElement textLink; - - @SelendroidFindBy(partialLinkText = "ccessibilit") private WebElement textPartialLink; - - /** - * initialization. - */ - @BeforeClass public static void beforeClass() { - AppiumServiceBuilder builder = new AppiumServiceBuilder(); - service = builder.build(); - service.start(); - - File appDir = new File("src/test/java/io/appium/java_client"); - File app = new File(appDir, "ApiDemos-debug.apk"); - DesiredCapabilities capabilities = new DesiredCapabilities(); - capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); - capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath()); - capabilities.setCapability(AndroidMobileCapabilityType.SELENDROID_PORT, SELENDROID_PORT); - capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.SELENDROID); - driver = new AndroidDriver<>(service.getUrl(), capabilities); - driver.context("NATIVE_APP"); - } - - /** - * finishing. - */ - @AfterClass public static void afterClass() { - if (driver != null) { - driver.quit(); - } - - if (service != null) { - service.stop(); - } - } - - /** - * The setting up. - */ - @Before public void setUp() { - if (!populated) { - //This time out is set because test can be run on slow Android SDK emulator - PageFactory.initElements(new AppiumFieldDecorator(driver, ofSeconds(5)), this); - } - - populated = true; - } - - @Test public void findByIdElementTest() { - assertNotEquals(null, textId.getAttribute("text")); - } - - @Test public void findBySelendroidSelectorTest() { - assertNotEquals(null, textSelendroidId.getAttribute("text")); - } - - @Test public void findByElementByNameTest() { - assertEquals("Accessibility", textName.getText()); - } - - @Test public void findByElementByNameAndroidTest() { - assertEquals("Accessibility", textNameAndroid.getText()); - } - - @Test public void findByElementByNameDefaultTest() { - assertEquals("Accessibility", textNameDefault.getText()); - } - - @Test public void findByElementByXpathTest() { - assertEquals("Accessibility", textXpath.getText()); - } - - @Test public void findByElementByIdsTest() { - assertNotNull(textIds.getText()); - } - - @Test public void findByElementByTestAllTest() { - assertNotNull(textAll.getText()); - } - - @Test public void findByElementByTextsAllTest() { - assertTrue(textsAll.size() > 1); - } - - @Test public void findByElementByCalssTest() { - assertNotEquals(null, textClass.getAttribute("text")); - } - - @Test public void findByElementByTagTest() { - assertNotEquals(null, textTag.getAttribute("text")); - } - - @Test public void findBySelendroidAnnotationOnlyTest() { - assertNotEquals(null, textSelendroidId.getAttribute("text")); - } - - @Test public void findBySelendroidLinkTextTest() { - assertEquals("Accessibility", textLink.getText()); - } - - @Test public void findBySelendroidPartialLinkTextTest() { - assertEquals("Accessibility", textPartialLink.getText()); - } -} diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/XCUITModeTest.java b/src/test/java/io/appium/java_client/pagefactory_tests/XCUITModeTest.java index 881d50496..c54bf9129 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/XCUITModeTest.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/XCUITModeTest.java @@ -32,7 +32,6 @@ import io.appium.java_client.ios.AppIOSTest; import io.appium.java_client.pagefactory.AppiumFieldDecorator; import io.appium.java_client.pagefactory.HowToUseLocators; -import io.appium.java_client.pagefactory.iOSFindBy; import io.appium.java_client.pagefactory.iOSXCUITFindBy; import org.junit.Before; import org.junit.FixMethodOrder; @@ -50,20 +49,19 @@ public class XCUITModeTest extends AppIOSTest { private boolean populated = false; private WebDriverWait waiting = new WebDriverWait(driver, 10000); - @HowToUseLocators(iOSAutomation = ALL_POSSIBLE) + @HowToUseLocators(iOSXCUITAutomation = ALL_POSSIBLE) @iOSXCUITFindBy(iOSNsPredicate = "label contains 'Compute'") @iOSXCUITFindBy(className = "XCUIElementTypeButton") private MobileElement computeButton; - @HowToUseLocators(iOSAutomation = CHAIN) - @iOSFindBy(id = "TestApp") + @HowToUseLocators(iOSXCUITAutomation = CHAIN) @iOSXCUITFindBy(iOSNsPredicate = "name like 'Answer'") private WebElement answer; @iOSXCUITFindBy(iOSNsPredicate = "name = 'IntegerA'") private MobileElement textField1; - @HowToUseLocators(iOSAutomation = ALL_POSSIBLE) + @HowToUseLocators(iOSXCUITAutomation = ALL_POSSIBLE) @iOSXCUITFindBy(iOSNsPredicate = "name = 'IntegerB'") @iOSXCUITFindBy(accessibility = "IntegerB") private MobileElement textField2; @@ -74,15 +72,14 @@ public class XCUITModeTest extends AppIOSTest { @iOSXCUITFindBy(className = "XCUIElementTypeSlider") private MobileElement slider; - @iOSFindBy(id = "locationStatus") + @iOSXCUITFindBy(id = "locationStatus") private MobileElement locationStatus; - @HowToUseLocators(iOSAutomation = CHAIN) - @iOSFindBy(id = "TestApp") @iOSXCUITFindBy(iOSNsPredicate = "name BEGINSWITH 'contact'") + @HowToUseLocators(iOSXCUITAutomation = CHAIN) + @iOSXCUITFindBy(iOSNsPredicate = "name BEGINSWITH 'contact'") private MobileElement contactAlert; - @HowToUseLocators(iOSAutomation = ALL_POSSIBLE) - @iOSFindBy(uiAutomator = ".elements()[0]") + @HowToUseLocators(iOSXCUITAutomation = ALL_POSSIBLE) @iOSXCUITFindBy(iOSNsPredicate = "name BEGINSWITH 'location'") private MobileElement locationAlert; diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/AbstractStubWebDriver.java b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/AbstractStubWebDriver.java index d5c5af560..218dea51f 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/AbstractStubWebDriver.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/AbstractStubWebDriver.java @@ -187,19 +187,6 @@ public String getAutomationName() { } } - public static class StubSelendroidDriver extends AbstractStubWebDriver { - - @Override - public String getPlatformName() { - return ANDROID; - } - - @Override - public String getAutomationName() { - return SELENDROID; - } - } - public static class StubIOSDriver extends AbstractStubWebDriver { @Override diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/AndroidApp.java b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/AndroidApp.java index 419bd4fba..bc9897e54 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/AndroidApp.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/AndroidApp.java @@ -1,7 +1,6 @@ package io.appium.java_client.pagefactory_tests.widget.tests.android; import io.appium.java_client.pagefactory.AndroidFindBy; -import io.appium.java_client.pagefactory.SelendroidFindBy; import io.appium.java_client.pagefactory_tests.widget.tests.ExtendedApp; import java.util.List; @@ -15,11 +14,9 @@ public class AndroidApp implements ExtendedApp { public static String SELENDROID_EXTERNALLY_DEFINED_WIDGET_LOCATOR = "SOME_SELENDROID_EXTERNALLY_DEFINED_LOCATOR"; @AndroidFindBy(uiAutomator = "SOME_ANDROID_DEFAULT_LOCATOR") - @SelendroidFindBy(linkText = "SOME_SELENDROID_DEFAULT_LOCATOR") private DefaultAndroidWidget singleAndroidWidget; @AndroidFindBy(uiAutomator = "SOME_ANDROID_DEFAULT_LOCATOR") - @SelendroidFindBy(linkText = "SOME_SELENDROID_DEFAULT_LOCATOR") private List multipleAndroidWidgets; /** @@ -58,7 +55,6 @@ public class AndroidApp implements ExtendedApp { * annotations that mark the field. */ @AndroidFindBy(uiAutomator = "SOME_ANDROID_EXTERNALLY_DEFINED_LOCATOR") - @SelendroidFindBy(linkText = "SOME_SELENDROID_EXTERNALLY_DEFINED_LOCATOR") private ExtendedAndroidWidget singleOverriddenAndroidWidget; /** @@ -69,7 +65,6 @@ public class AndroidApp implements ExtendedApp { * annotations that mark the field. */ @AndroidFindBy(uiAutomator = "SOME_ANDROID_EXTERNALLY_DEFINED_LOCATOR") - @SelendroidFindBy(linkText = "SOME_SELENDROID_EXTERNALLY_DEFINED_LOCATOR") private List multipleOverriddenAndroidWidgets; @Override diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/AnnotatedAndroidWidget.java b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/AnnotatedAndroidWidget.java index 2b1706e78..e58e14a2b 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/AnnotatedAndroidWidget.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/AnnotatedAndroidWidget.java @@ -1,11 +1,9 @@ package io.appium.java_client.pagefactory_tests.widget.tests.android; import io.appium.java_client.pagefactory.AndroidFindBy; -import io.appium.java_client.pagefactory.SelendroidFindBy; import org.openqa.selenium.WebElement; @AndroidFindBy(uiAutomator = "SOME_ROOT_LOCATOR") -@SelendroidFindBy(linkText = "SELENDROID_SOME_ROOT_LOCATOR") public class AnnotatedAndroidWidget extends DefaultAndroidWidget { public static String ANDROID_ROOT_WIDGET_LOCATOR = "SOME_ROOT_LOCATOR"; public static String SELENDROID_ROOT_WIDGET_LOCATOR = "SELENDROID_SOME_ROOT_LOCATOR"; diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/DefaultAndroidWidget.java b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/DefaultAndroidWidget.java index 461699939..59e9dc253 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/DefaultAndroidWidget.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/DefaultAndroidWidget.java @@ -1,7 +1,6 @@ package io.appium.java_client.pagefactory_tests.widget.tests.android; import io.appium.java_client.pagefactory.AndroidFindBy; -import io.appium.java_client.pagefactory.SelendroidFindBy; import io.appium.java_client.pagefactory_tests.widget.tests.DefaultStubWidget; import org.openqa.selenium.WebElement; @@ -13,11 +12,9 @@ public class DefaultAndroidWidget extends DefaultStubWidget { public static String SELENDROID_SUB_WIDGET_LOCATOR = "SELENDROID_SOME_SUB_LOCATOR"; @AndroidFindBy(uiAutomator = "SOME_SUB_LOCATOR") - @SelendroidFindBy(linkText = "SELENDROID_SOME_SUB_LOCATOR") private DefaultAndroidWidget singleWidget; @AndroidFindBy(uiAutomator = "SOME_SUB_LOCATOR") - @SelendroidFindBy(linkText = "SELENDROID_SOME_SUB_LOCATOR") private List multipleWidgets; protected DefaultAndroidWidget(WebElement element) { diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/SelendroidWidgetTest.java b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/SelendroidWidgetTest.java deleted file mode 100644 index 0166b4f16..000000000 --- a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/android/SelendroidWidgetTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package io.appium.java_client.pagefactory_tests.widget.tests.android; - -import static io.appium.java_client.pagefactory_tests.widget.tests.android.AndroidApp.ANDROID_SELENDROID_WIDGET_LOCATOR; -import static io.appium.java_client.pagefactory_tests.widget.tests.android.AndroidApp.SELENDROID_EXTERNALLY_DEFINED_WIDGET_LOCATOR; -import static io.appium.java_client.pagefactory_tests.widget.tests.android.AnnotatedAndroidWidget.SELENDROID_ROOT_WIDGET_LOCATOR; -import static io.appium.java_client.pagefactory_tests.widget.tests.android.DefaultAndroidWidget.SELENDROID_SUB_WIDGET_LOCATOR; -import static org.openqa.selenium.By.linkText; - -import io.appium.java_client.pagefactory_tests.widget.tests.AbstractStubWebDriver; -import io.appium.java_client.pagefactory_tests.widget.tests.ExtendedApp; -import io.appium.java_client.pagefactory_tests.widget.tests.ExtendedWidgetTest; - -public class SelendroidWidgetTest extends ExtendedWidgetTest { - public SelendroidWidgetTest() { - super(new AndroidApp(), new AbstractStubWebDriver.StubSelendroidDriver()); - } - - @Override - public void checkThatWidgetsAreCreatedCorrectly() { - checkThatLocatorsAreCreatedCorrectly(app.getWidget(), app.getWidgets(), - linkText(ANDROID_SELENDROID_WIDGET_LOCATOR), linkText(SELENDROID_SUB_WIDGET_LOCATOR)); - } - - @Override - public void checkCaseWhenWidgetClassHasDeclaredLocatorAnnotation() { - checkThatLocatorsAreCreatedCorrectly(((ExtendedApp) app).getAnnotatedWidget(), - ((ExtendedApp) app).getAnnotatedWidgets(), - linkText(SELENDROID_ROOT_WIDGET_LOCATOR), linkText(SELENDROID_SUB_WIDGET_LOCATOR)); - } - - @Override - public void checkCaseWhenWidgetClassHasNoDeclaredAnnotationButItHasSuperclass() { - checkThatLocatorsAreCreatedCorrectly(((ExtendedApp) app).getExtendedWidget(), - ((ExtendedApp) app).getExtendedWidgets(), - linkText(SELENDROID_ROOT_WIDGET_LOCATOR), linkText(SELENDROID_SUB_WIDGET_LOCATOR)); - } - - @Override - public void checkCaseWhenBothWidgetFieldAndClassHaveDelaredAnnotations() { - checkThatLocatorsAreCreatedCorrectly(((ExtendedApp) app).getExtendedWidgetWithOverriddenLocators(), - ((ExtendedApp) app).getExtendedWidgetsWithOverriddenLocators(), - linkText(SELENDROID_EXTERNALLY_DEFINED_WIDGET_LOCATOR), linkText(SELENDROID_SUB_WIDGET_LOCATOR)); - } -} diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/CombinedAppTest.java b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/CombinedAppTest.java index c74a0847e..a0d87a4f8 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/CombinedAppTest.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/CombinedAppTest.java @@ -12,7 +12,6 @@ import io.appium.java_client.pagefactory_tests.widget.tests.DefaultStubWidget; import io.appium.java_client.pagefactory_tests.widget.tests.WidgetTest; import io.appium.java_client.pagefactory_tests.widget.tests.android.DefaultAndroidWidget; -import io.appium.java_client.pagefactory_tests.widget.tests.ios.DefaultIosWidget; import io.appium.java_client.pagefactory_tests.widget.tests.windows.DefaultWindowsWidget; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -35,9 +34,6 @@ public class CombinedAppTest extends WidgetTest { public static Collection data() { return asList( dataArray(new CombinedApp(), new AbstractStubWebDriver.StubAndroidDriver(), DefaultAndroidWidget.class), - dataArray(new CombinedApp(), new AbstractStubWebDriver.StubSelendroidDriver(), - DefaultSelendroidWidget.class), - dataArray(new CombinedApp(), new AbstractStubWebDriver.StubIOSDriver(), DefaultIosWidget.class), dataArray(new CombinedApp(), new AbstractStubWebDriver.StubIOSXCUITDriver(), DefaultIosXCUITWidget.class), dataArray(new CombinedApp(), new AbstractStubWebDriver.StubWindowsDriver(), DefaultWindowsWidget.class), @@ -46,8 +42,6 @@ public static Collection data() { DefaultFindByWidget.class), dataArray(new PartiallyCombinedApp(), new AbstractStubWebDriver.StubAndroidDriver(), DefaultAndroidWidget.class), - dataArray(new PartiallyCombinedApp(), new AbstractStubWebDriver.StubSelendroidDriver(), - DefaultSelendroidWidget.class), dataArray(new PartiallyCombinedApp(), new AbstractStubWebDriver.StubIOSDriver(), DefaultStubWidget.class), dataArray(new PartiallyCombinedApp(), new AbstractStubWebDriver.StubIOSXCUITDriver(), @@ -83,20 +77,14 @@ public static class CombinedApp implements AbstractApp { @OverrideWidget(html = DefaultFindByWidget.class, androidUIAutomator = DefaultAndroidWidget.class, - selendroid = DefaultSelendroidWidget.class, - iOSUIAutomation = DefaultIosWidget.class, iOSXCUITAutomation = DefaultIosXCUITWidget.class, - windowsAutomation = DefaultWindowsWidget.class - ) + windowsAutomation = DefaultWindowsWidget.class) private DefaultStubWidget singleWidget; @OverrideWidget(html = DefaultFindByWidget.class, androidUIAutomator = DefaultAndroidWidget.class, - selendroid = DefaultSelendroidWidget.class, - iOSUIAutomation = DefaultIosWidget.class, iOSXCUITAutomation = DefaultIosXCUITWidget.class, - windowsAutomation = DefaultWindowsWidget.class - ) + windowsAutomation = DefaultWindowsWidget.class) private List multipleWidget; @Override @@ -113,15 +101,11 @@ public List getWidgets() { public static class PartiallyCombinedApp implements AbstractApp { @OverrideWidget(html = DefaultFindByWidget.class, - androidUIAutomator = DefaultAndroidWidget.class, - selendroid = DefaultSelendroidWidget.class - ) + androidUIAutomator = DefaultAndroidWidget.class) private DefaultStubWidget singleWidget; @OverrideWidget(html = DefaultFindByWidget.class, - androidUIAutomator = DefaultAndroidWidget.class, - selendroid = DefaultSelendroidWidget.class - ) + androidUIAutomator = DefaultAndroidWidget.class) private List multipleWidget; @Override diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/CombinedWidgetTest.java b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/CombinedWidgetTest.java index 4d6740f4a..253603e2d 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/CombinedWidgetTest.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/CombinedWidgetTest.java @@ -12,7 +12,6 @@ import io.appium.java_client.pagefactory_tests.widget.tests.DefaultStubWidget; import io.appium.java_client.pagefactory_tests.widget.tests.WidgetTest; import io.appium.java_client.pagefactory_tests.widget.tests.android.DefaultAndroidWidget; -import io.appium.java_client.pagefactory_tests.widget.tests.ios.DefaultIosWidget; import io.appium.java_client.pagefactory_tests.widget.tests.windows.DefaultWindowsWidget; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -39,10 +38,6 @@ public static Collection data() { return asList( dataArray(new AppWithCombinedWidgets(), new AbstractStubWebDriver.StubAndroidDriver(), DefaultAndroidWidget.class), - dataArray(new AppWithCombinedWidgets(), - new AbstractStubWebDriver.StubSelendroidDriver(), DefaultSelendroidWidget.class), - dataArray(new AppWithCombinedWidgets(), - new AbstractStubWebDriver.StubIOSDriver(), DefaultIosWidget.class), dataArray(new AppWithCombinedWidgets(), new AbstractStubWebDriver.StubIOSXCUITDriver(), DefaultIosXCUITWidget.class), dataArray(new AppWithCombinedWidgets(), @@ -53,8 +48,6 @@ public static Collection data() { new AbstractStubWebDriver.StubAndroidBrowserOrWebViewDriver(), DefaultFindByWidget.class), dataArray(new AppWithPartiallyCombinedWidgets(), new AbstractStubWebDriver.StubAndroidDriver(), DefaultAndroidWidget.class), - dataArray(new AppWithPartiallyCombinedWidgets(), - new AbstractStubWebDriver.StubSelendroidDriver(), DefaultSelendroidWidget.class), dataArray(new AppWithPartiallyCombinedWidgets(), new AbstractStubWebDriver.StubIOSDriver(), DefaultStubWidget.class), dataArray(new AppWithPartiallyCombinedWidgets(), @@ -93,8 +86,6 @@ public static class CombinedWidget extends DefaultStubWidget { @OverrideWidget(html = DefaultFindByWidget.class, androidUIAutomator = DefaultAndroidWidget.class, - selendroid = DefaultSelendroidWidget.class, - iOSUIAutomation = DefaultIosWidget.class, iOSXCUITAutomation = DefaultIosXCUITWidget.class, windowsAutomation = DefaultWindowsWidget.class ) @@ -102,8 +93,6 @@ public static class CombinedWidget extends DefaultStubWidget { @OverrideWidget(html = DefaultFindByWidget.class, androidUIAutomator = DefaultAndroidWidget.class, - selendroid = DefaultSelendroidWidget.class, - iOSUIAutomation = DefaultIosWidget.class, iOSXCUITAutomation = DefaultIosXCUITWidget.class, windowsAutomation = DefaultWindowsWidget.class ) @@ -128,15 +117,11 @@ public List getSubWidgets() { public static class PartiallyCombinedWidget extends DefaultStubWidget { @OverrideWidget(html = DefaultFindByWidget.class, - androidUIAutomator = DefaultAndroidWidget.class, - selendroid = DefaultSelendroidWidget.class - ) + androidUIAutomator = DefaultAndroidWidget.class) private DefaultStubWidget singleWidget; @OverrideWidget(html = DefaultFindByWidget.class, - androidUIAutomator = DefaultAndroidWidget.class, - selendroid = DefaultSelendroidWidget.class - ) + androidUIAutomator = DefaultAndroidWidget.class) private List multipleWidget; diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/DefaultIosXCUITWidget.java b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/DefaultIosXCUITWidget.java index e82cebe37..bb4f58037 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/DefaultIosXCUITWidget.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/DefaultIosXCUITWidget.java @@ -8,6 +8,8 @@ public class DefaultIosXCUITWidget extends DefaultStubWidget { + public static String XCUIT_SUB_WIDGET_LOCATOR = "XCUIT_SOME_SUB_LOCATOR"; + @iOSXCUITFindBy(iOSNsPredicate = "XCUIT_SOME_SUB_LOCATOR") private DefaultIosXCUITWidget singleWidget; diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/DefaultSelendroidWidget.java b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/DefaultSelendroidWidget.java deleted file mode 100644 index f777aaa4c..000000000 --- a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined/DefaultSelendroidWidget.java +++ /dev/null @@ -1,31 +0,0 @@ -package io.appium.java_client.pagefactory_tests.widget.tests.combined; - -import io.appium.java_client.pagefactory.SelendroidFindBy; -import io.appium.java_client.pagefactory_tests.widget.tests.DefaultStubWidget; -import org.openqa.selenium.WebElement; - -import java.util.List; - -@Deprecated -public class DefaultSelendroidWidget extends DefaultStubWidget { - - @SelendroidFindBy(linkText = "SELENDROID_SOME_SUB_LOCATOR") - private DefaultSelendroidWidget singleWidget; - - @SelendroidFindBy(linkText = "SELENDROID_SOME_SUB_LOCATOR") - private List multipleWidgets; - - protected DefaultSelendroidWidget(WebElement element) { - super(element); - } - - @Override - public DefaultSelendroidWidget getSubWidget() { - return singleWidget; - } - - @Override - public List getSubWidgets() { - return multipleWidgets; - } -} diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/AnnotatedIosWidget.java b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/AnnotatedIosWidget.java index f1eaa796e..b8978d89f 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/AnnotatedIosWidget.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/AnnotatedIosWidget.java @@ -1,13 +1,11 @@ package io.appium.java_client.pagefactory_tests.widget.tests.ios; -import io.appium.java_client.pagefactory.iOSFindBy; import io.appium.java_client.pagefactory.iOSXCUITFindBy; +import io.appium.java_client.pagefactory_tests.widget.tests.combined.DefaultIosXCUITWidget; import org.openqa.selenium.WebElement; -@iOSFindBy(uiAutomator = "SOME_ROOT_LOCATOR") @iOSXCUITFindBy(iOSNsPredicate = "XCUIT_SOME_ROOT_LOCATOR") -public class AnnotatedIosWidget extends DefaultIosWidget { - public static String IOS_ROOT_WIDGET_LOCATOR = "SOME_ROOT_LOCATOR"; +public class AnnotatedIosWidget extends DefaultIosXCUITWidget { public static String XCUIT_ROOT_WIDGET_LOCATOR = "XCUIT_SOME_ROOT_LOCATOR"; protected AnnotatedIosWidget(WebElement element) { diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/DefaultIosWidget.java b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/DefaultIosWidget.java deleted file mode 100644 index 61c75880a..000000000 --- a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/DefaultIosWidget.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.appium.java_client.pagefactory_tests.widget.tests.ios; - -import io.appium.java_client.pagefactory.iOSFindBy; -import io.appium.java_client.pagefactory.iOSXCUITFindBy; -import io.appium.java_client.pagefactory_tests.widget.tests.DefaultStubWidget; -import org.openqa.selenium.WebElement; - -import java.util.List; - -public class DefaultIosWidget extends DefaultStubWidget { - - public static String IOS_SUB_WIDGET_LOCATOR = "SOME_SUB_LOCATOR"; - public static String XCUIT_SUB_WIDGET_LOCATOR = "XCUIT_SOME_SUB_LOCATOR"; - - @iOSFindBy(uiAutomator = "SOME_SUB_LOCATOR") - @iOSXCUITFindBy(iOSNsPredicate = "XCUIT_SOME_SUB_LOCATOR") - private DefaultIosWidget singleWidget; - - @iOSFindBy(uiAutomator = "SOME_SUB_LOCATOR") - @iOSXCUITFindBy(iOSNsPredicate = "XCUIT_SOME_SUB_LOCATOR") - private List multipleWidgets; - - protected DefaultIosWidget(WebElement element) { - super(element); - } - - @Override - public DefaultIosWidget getSubWidget() { - return singleWidget; - } - - @Override - public List getSubWidgets() { - return multipleWidgets; - } -} diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/IosApp.java b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/IosApp.java index 8fbc1643a..beaa141c0 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/IosApp.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/IosApp.java @@ -1,8 +1,8 @@ package io.appium.java_client.pagefactory_tests.widget.tests.ios; -import io.appium.java_client.pagefactory.iOSFindBy; import io.appium.java_client.pagefactory.iOSXCUITFindBy; import io.appium.java_client.pagefactory_tests.widget.tests.ExtendedApp; +import io.appium.java_client.pagefactory_tests.widget.tests.combined.DefaultIosXCUITWidget; import java.util.List; @@ -14,82 +14,72 @@ public class IosApp implements ExtendedApp { public static String IOS_EXTERNALLY_DEFINED_WIDGET_LOCATOR = "IOS_EXTERNALLY_DEFINED_WIDGET_LOCATOR"; public static String XCUIT_EXTERNALLY_DEFINED_WIDGET_LOCATOR = "SOME_XCUIT_EXTERNALLY_DEFINED_LOCATOR"; - @iOSFindBy(uiAutomator = "SOME_IOS_DEFAULT_LOCATOR") @iOSXCUITFindBy(iOSNsPredicate = "SOME_XCUIT_DEFAULT_LOCATOR") - private DefaultIosWidget singleIosWidget; + private DefaultIosXCUITWidget singleIosWidget; - @iOSFindBy(uiAutomator = "SOME_IOS_DEFAULT_LOCATOR") @iOSXCUITFindBy(iOSNsPredicate = "SOME_XCUIT_DEFAULT_LOCATOR") - private List multipleIosWidgets; + private List multipleIosWidgets; /** - * This class is annotated by {@link io.appium.java_client.pagefactory.iOSFindBy} and - * {@link io.appium.java_client.pagefactory.iOSXCUITFindBy}. + * This class is annotated by {@link io.appium.java_client.pagefactory.iOSXCUITFindBy}. * This field was added to check that locator is created correctly according to current platform * and current automation. */ private AnnotatedIosWidget singleAnnotatedIosWidget; /** - * This class is annotated by {@link io.appium.java_client.pagefactory.iOSFindBy} and - * {@link io.appium.java_client.pagefactory.iOSXCUITFindBy}. + * This class is annotated by {@link io.appium.java_client.pagefactory.iOSXCUITFindBy}. * This field was added to check that locator is created correctly according to current platform * and current automation. */ private List multipleIosIosWidgets; /** - * This class is not annotated by {@link io.appium.java_client.pagefactory.iOSFindBy} and - * {@link io.appium.java_client.pagefactory.iOSXCUITFindBy}. + * This class is not annotated by {@link io.appium.java_client.pagefactory.iOSXCUITFindBy}. * But the superclass is annotated by these annotations. This field was added to check that locator is * created correctly according to current platform and current automation. */ private ExtendedIosWidget singleExtendedIosWidget; /** - * This class is not annotated by {@link io.appium.java_client.pagefactory.iOSFindBy} and - * {@link io.appium.java_client.pagefactory.iOSXCUITFindBy}. + * This class is not annotated by {@link io.appium.java_client.pagefactory.iOSXCUITFindBy}. * But the superclass is annotated by these annotations. This field was added to check that locator is * created correctly according to current platform and current automation. */ private List multipleExtendedIosWidgets; /** - * The superclass is annotated by {@link io.appium.java_client.pagefactory.iOSFindBy} and - * {@link io.appium.java_client.pagefactory.iOSXCUITFindBy}. + * The superclass is annotated by {@link io.appium.java_client.pagefactory.iOSXCUITFindBy}. * However there is the field which is annotated by this annotations. * This field was added to check that locator is * created correctly according to current platform and current automation and * annotations that mark the field. */ - @iOSFindBy(uiAutomator = "IOS_EXTERNALLY_DEFINED_WIDGET_LOCATOR") @iOSXCUITFindBy(iOSNsPredicate = "SOME_XCUIT_EXTERNALLY_DEFINED_LOCATOR") private ExtendedIosWidget singleOverriddenIosWidget; /** - * The superclass is annotated by {@link io.appium.java_client.pagefactory.iOSFindBy} and - * {@link io.appium.java_client.pagefactory.iOSXCUITFindBy}. + * The superclass is annotated by {@link io.appium.java_client.pagefactory.iOSXCUITFindBy}. * However there is the field which is annotated by this annotations. * This field was added to check that locator is * created correctly according to current platform and current automation and * annotations that mark the field. */ - @iOSFindBy(uiAutomator = "IOS_EXTERNALLY_DEFINED_WIDGET_LOCATOR") @iOSXCUITFindBy(iOSNsPredicate = "SOME_XCUIT_EXTERNALLY_DEFINED_LOCATOR") private List multipleOverriddenIosWidgets; @Override - public DefaultIosWidget getWidget() { + public DefaultIosXCUITWidget getWidget() { return singleIosWidget; } @Override - public List getWidgets() { + public List getWidgets() { return multipleIosWidgets; } @Override - public DefaultIosWidget getAnnotatedWidget() { + public DefaultIosXCUITWidget getAnnotatedWidget() { return singleAnnotatedIosWidget; } @@ -99,7 +89,7 @@ public List getAnnotatedWidgets() { } @Override - public DefaultIosWidget getExtendedWidget() { + public DefaultIosXCUITWidget getExtendedWidget() { return singleExtendedIosWidget; } @@ -109,7 +99,7 @@ public List getExtendedWidgets() { } @Override - public DefaultIosWidget getExtendedWidgetWithOverriddenLocators() { + public DefaultIosXCUITWidget getExtendedWidgetWithOverriddenLocators() { return singleOverriddenIosWidget; } diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/IosWidgetTest.java b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/IosWidgetTest.java deleted file mode 100644 index ad84fef59..000000000 --- a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/IosWidgetTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package io.appium.java_client.pagefactory_tests.widget.tests.ios; - -import static io.appium.java_client.MobileBy.IosUIAutomation; -import static io.appium.java_client.pagefactory_tests.widget.tests.ios.AnnotatedIosWidget.IOS_ROOT_WIDGET_LOCATOR; -import static io.appium.java_client.pagefactory_tests.widget.tests.ios.DefaultIosWidget.IOS_SUB_WIDGET_LOCATOR; -import static io.appium.java_client.pagefactory_tests.widget.tests.ios.IosApp.IOS_DEFAULT_WIDGET_LOCATOR; -import static io.appium.java_client.pagefactory_tests.widget.tests.ios.IosApp.IOS_EXTERNALLY_DEFINED_WIDGET_LOCATOR; - -import io.appium.java_client.pagefactory_tests.widget.tests.AbstractStubWebDriver; -import io.appium.java_client.pagefactory_tests.widget.tests.ExtendedApp; -import io.appium.java_client.pagefactory_tests.widget.tests.ExtendedWidgetTest; - -public class IosWidgetTest extends ExtendedWidgetTest { - - public IosWidgetTest() { - super(new IosApp(), new AbstractStubWebDriver.StubIOSDriver()); - } - - @Override - public void checkThatWidgetsAreCreatedCorrectly() { - checkThatLocatorsAreCreatedCorrectly(app.getWidget(), app.getWidgets(), - IosUIAutomation(IOS_DEFAULT_WIDGET_LOCATOR), IosUIAutomation(IOS_SUB_WIDGET_LOCATOR)); - } - - @Override - public void checkCaseWhenWidgetClassHasDeclaredLocatorAnnotation() { - checkThatLocatorsAreCreatedCorrectly(((ExtendedApp) app).getAnnotatedWidget(), - ((ExtendedApp) app).getAnnotatedWidgets(), - IosUIAutomation(IOS_ROOT_WIDGET_LOCATOR), IosUIAutomation(IOS_SUB_WIDGET_LOCATOR)); - } - - @Override - public void checkCaseWhenWidgetClassHasNoDeclaredAnnotationButItHasSuperclass() { - checkThatLocatorsAreCreatedCorrectly(((ExtendedApp) app).getExtendedWidget(), - ((ExtendedApp) app).getExtendedWidgets(), - IosUIAutomation(IOS_ROOT_WIDGET_LOCATOR), IosUIAutomation(IOS_SUB_WIDGET_LOCATOR)); - } - - @Override - public void checkCaseWhenBothWidgetFieldAndClassHaveDelaredAnnotations() { - checkThatLocatorsAreCreatedCorrectly(((ExtendedApp) app).getExtendedWidgetWithOverriddenLocators(), - ((ExtendedApp) app).getExtendedWidgetsWithOverriddenLocators(), - IosUIAutomation(IOS_EXTERNALLY_DEFINED_WIDGET_LOCATOR), IosUIAutomation(IOS_SUB_WIDGET_LOCATOR)); - } -} diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/XCUITWidgetTest.java b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/XCUITWidgetTest.java index c55365610..6c1e4a1de 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/XCUITWidgetTest.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/ios/XCUITWidgetTest.java @@ -1,8 +1,8 @@ package io.appium.java_client.pagefactory_tests.widget.tests.ios; import static io.appium.java_client.MobileBy.iOSNsPredicateString; +import static io.appium.java_client.pagefactory_tests.widget.tests.combined.DefaultIosXCUITWidget.XCUIT_SUB_WIDGET_LOCATOR; import static io.appium.java_client.pagefactory_tests.widget.tests.ios.AnnotatedIosWidget.XCUIT_ROOT_WIDGET_LOCATOR; -import static io.appium.java_client.pagefactory_tests.widget.tests.ios.DefaultIosWidget.XCUIT_SUB_WIDGET_LOCATOR; import static io.appium.java_client.pagefactory_tests.widget.tests.ios.IosApp.IOS_XCUIT_WIDGET_LOCATOR; import static io.appium.java_client.pagefactory_tests.widget.tests.ios.IosApp.XCUIT_EXTERNALLY_DEFINED_WIDGET_LOCATOR;