How to use prepareArguments method of io.appium.java_client.MobileCommand class

Best io.appium code snippet using io.appium.java_client.MobileCommand.prepareArguments

AppiumDriver.java

Source:AppiumDriver.java Github

copy

Full Screen

...30import static io.appium.java_client.MobileCommand.PULL_FOLDER;31import static io.appium.java_client.MobileCommand.REMOVE_APP;32import static io.appium.java_client.MobileCommand.RUN_APP_IN_BACKGROUND;33import static io.appium.java_client.MobileCommand.SET_SETTINGS;34import static io.appium.java_client.MobileCommand.prepareArguments;35import com.google.common.collect.ImmutableList;36import com.google.common.collect.ImmutableMap;37import com.google.gson.JsonObject;38import com.google.gson.JsonParser;39import io.appium.java_client.remote.AppiumCommandExecutor;40import io.appium.java_client.remote.MobileCapabilityType;41import io.appium.java_client.service.local.AppiumDriverLocalService;42import io.appium.java_client.service.local.AppiumServiceBuilder;43import org.openqa.selenium.By;44import org.openqa.selenium.Capabilities;45import org.openqa.selenium.Dimension;46import org.openqa.selenium.Point;47import org.openqa.selenium.ScreenOrientation;48import org.openqa.selenium.WebDriver;49import org.openqa.selenium.WebDriverException;50import org.openqa.selenium.WebElement;51import org.openqa.selenium.html5.Location;52import org.openqa.selenium.remote.DesiredCapabilities;53import org.openqa.selenium.remote.DriverCommand;54import org.openqa.selenium.remote.ErrorHandler;55import org.openqa.selenium.remote.ExecuteMethod;56import org.openqa.selenium.remote.HttpCommandExecutor;57import org.openqa.selenium.remote.RemoteWebDriver;58import org.openqa.selenium.remote.Response;59import org.openqa.selenium.remote.html5.RemoteLocationContext;60import org.openqa.selenium.remote.http.HttpClient;61import org.openqa.selenium.remote.internal.JsonToWebElementConverter;62import java.lang.reflect.Constructor;63import java.lang.reflect.InvocationTargetException;64import java.net.URL;65import java.util.LinkedHashSet;66import java.util.List;67import java.util.Map;68import java.util.Set;69import javax.xml.bind.DatatypeConverter;70/**71* @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.72 * Instances of the defined type will be returned via findElement* and findElements*73 * Warning (!!!). Allowed types:74 * {@link org.openqa.selenium.WebElement}75 * {@link io.appium.java_client.TouchableElement}76 * {@link org.openqa.selenium.remote.RemoteWebElement}77 * {@link io.appium.java_client.MobileElement} and its subclasses that designed78 * specifically79 * for each target mobile OS (still Android and iOS)80*/81@SuppressWarnings("unchecked")82public abstract class AppiumDriver<T extends WebElement>83 extends DefaultGenericMobileDriver<T> {84 private static final ErrorHandler errorHandler = new ErrorHandler(new ErrorCodesMobile(), true);85 // frequently used command parameters86 private URL remoteAddress;87 private RemoteLocationContext locationContext;88 private ExecuteMethod executeMethod;89 /**90 * @param executor is an instance of {@link org.openqa.selenium.remote.HttpCommandExecutor}91 * or class that extends it. Default commands or another vendor-specific92 * commands may be specified there.93 * @param capabilities take a look94 * at {@link org.openqa.selenium.Capabilities}95 * @param converterClazz is an instance of a class that extends96 * {@link org.openqa.selenium.remote.internal.JsonToWebElementConverter}. It converts97 * JSON response to an instance of98 * {@link org.openqa.selenium.WebElement}99 */100 protected AppiumDriver(HttpCommandExecutor executor, Capabilities capabilities,101 Class<? extends JsonToWebElementConverter> converterClazz) {102 super(executor, capabilities);103 this.executeMethod = new AppiumExecutionMethod(this);104 locationContext = new RemoteLocationContext(executeMethod);105 super.setErrorHandler(errorHandler);106 this.remoteAddress = executor.getAddressOfRemoteServer();107 try {108 Constructor<? extends JsonToWebElementConverter> constructor =109 converterClazz.getConstructor(RemoteWebDriver.class);110 this.setElementConverter(constructor.newInstance(this));111 } catch (NoSuchMethodException | IllegalAccessException | InstantiationException112 | InvocationTargetException e) {113 throw new RuntimeException(e);114 }115 }116 public AppiumDriver(URL remoteAddress, Capabilities desiredCapabilities,117 Class<? extends JsonToWebElementConverter> converterClazz) {118 this(new AppiumCommandExecutor(MobileCommand.commandRepository, remoteAddress),119 desiredCapabilities, converterClazz);120 }121 public AppiumDriver(URL remoteAddress, HttpClient.Factory httpClientFactory,122 Capabilities desiredCapabilities,123 Class<? extends JsonToWebElementConverter> converterClazz) {124 this(new AppiumCommandExecutor(MobileCommand.commandRepository, remoteAddress,125 httpClientFactory), desiredCapabilities, converterClazz);126 }127 public AppiumDriver(AppiumDriverLocalService service, Capabilities desiredCapabilities,128 Class<? extends JsonToWebElementConverter> converterClazz) {129 this(new AppiumCommandExecutor(MobileCommand.commandRepository, service),130 desiredCapabilities, converterClazz);131 }132 public AppiumDriver(AppiumDriverLocalService service, HttpClient.Factory httpClientFactory,133 Capabilities desiredCapabilities,134 Class<? extends JsonToWebElementConverter> converterClazz) {135 this(new AppiumCommandExecutor(MobileCommand.commandRepository, service, httpClientFactory),136 desiredCapabilities, converterClazz);137 }138 public AppiumDriver(AppiumServiceBuilder builder, Capabilities desiredCapabilities,139 Class<? extends JsonToWebElementConverter> converterClazz) {140 this(builder.build(), desiredCapabilities, converterClazz);141 }142 public AppiumDriver(AppiumServiceBuilder builder, HttpClient.Factory httpClientFactory,143 Capabilities desiredCapabilities,144 Class<? extends JsonToWebElementConverter> converterClazz) {145 this(builder.build(), httpClientFactory, desiredCapabilities, converterClazz);146 }147 public AppiumDriver(HttpClient.Factory httpClientFactory, Capabilities desiredCapabilities,148 Class<? extends JsonToWebElementConverter> converterClazz) {149 this(AppiumDriverLocalService.buildDefaultService(), httpClientFactory,150 desiredCapabilities, converterClazz);151 }152 public AppiumDriver(Capabilities desiredCapabilities,153 Class<? extends JsonToWebElementConverter> converterClazz) {154 this(AppiumDriverLocalService.buildDefaultService(), desiredCapabilities, converterClazz);155 }156 /**157 * @param originalCapabilities the given {@link Capabilities}.158 * @param newPlatform a {@link MobileCapabilityType#PLATFORM_NAME} value which has159 * to be set up160 * @return {@link Capabilities} with changed mobile platform value161 */162 protected static Capabilities substituteMobilePlatform(Capabilities originalCapabilities,163 String newPlatform) {164 DesiredCapabilities dc = new DesiredCapabilities(originalCapabilities);165 dc.setCapability(MobileCapabilityType.PLATFORM_NAME, newPlatform);166 return dc;167 }168 @Override public List<T> findElements(By by) {169 return super.findElements(by);170 }171 @Override public List<T> findElements(String by, String using) {172 return super.findElements(by, using);173 }174 @Override public List<T> findElementsById(String id) {175 return super.findElementsById(id);176 }177 public List<T> findElementsByLinkText(String using) {178 return super.findElementsByLinkText(using);179 }180 public List<T> findElementsByPartialLinkText(String using) {181 return super.findElementsByPartialLinkText(using);182 }183 public List<T> findElementsByTagName(String using) {184 return super.findElementsByTagName(using);185 }186 public List<T> findElementsByName(String using) {187 return super.findElementsByName(using);188 }189 public List<T> findElementsByClassName(String using) {190 return super.findElementsByClassName(using);191 }192 public List<T> findElementsByCssSelector(String using) {193 return super.findElementsByCssSelector(using);194 }195 public List<T> findElementsByXPath(String using) {196 return super.findElementsByXPath(using);197 }198 @Override public List<T> findElementsByAccessibilityId(String using) {199 return super.findElementsByAccessibilityId(using);200 }201 @Override protected Response execute(String command) {202 return super.execute(command, ImmutableMap.<String, Object>of());203 }204 @Override public ExecuteMethod getExecuteMethod() {205 return executeMethod;206 }207 /**208 * @see InteractsWithApps#resetApp().209 */210 @Override public void resetApp() {211 execute(MobileCommand.RESET);212 }213 /**214 * @see InteractsWithApps#isAppInstalled(String).215 */216 @Override public boolean isAppInstalled(String bundleId) {217 Response response = execute(IS_APP_INSTALLED, ImmutableMap.of("bundleId", bundleId));218 return Boolean.parseBoolean(response.getValue().toString());219 }220 /**221 * @see InteractsWithApps#installApp(String).222 */223 @Override public void installApp(String appPath) {224 execute(INSTALL_APP, ImmutableMap.of("appPath", appPath));225 }226 /**227 * @see InteractsWithApps#removeApp(String).228 */229 @Override public void removeApp(String bundleId) {230 execute(REMOVE_APP, ImmutableMap.of("bundleId", bundleId));231 }232 /**233 * @see InteractsWithApps#launchApp().234 */235 @Override public void launchApp() {236 execute(LAUNCH_APP);237 }238 /**239 * @see InteractsWithApps#closeApp().240 */241 @Override public void closeApp() {242 execute(CLOSE_APP);243 }244 /**245 * @see InteractsWithApps#runAppInBackground(int).246 */247 @Override public void runAppInBackground(int seconds) {248 execute(RUN_APP_IN_BACKGROUND, ImmutableMap.of("seconds", seconds));249 }250 /**251 * @see DeviceActionShortcuts#getDeviceTime().252 */253 @Override public String getDeviceTime() {254 Response response = execute(GET_DEVICE_TIME);255 return response.getValue().toString();256 }257 /**258 * @see DeviceActionShortcuts#hideKeyboard().259 */260 @Override public void hideKeyboard() {261 execute(HIDE_KEYBOARD);262 }263 /**264 * @see InteractsWithFiles#pullFile(String).265 */266 @Override public byte[] pullFile(String remotePath) {267 Response response = execute(PULL_FILE, ImmutableMap.of("path", remotePath));268 String base64String = response.getValue().toString();269 return DatatypeConverter.parseBase64Binary(base64String);270 }271 /**272 * @see InteractsWithFiles#pullFolder(String).273 */274 @Override275 public byte[] pullFolder(String remotePath) {276 Response response = execute(PULL_FOLDER, ImmutableMap.of("path", remotePath));277 String base64String = response.getValue().toString();278 return DatatypeConverter.parseBase64Binary(base64String);279 }280 /**281 * @see PerformsTouchActions#performTouchAction(TouchAction).282 */283 @SuppressWarnings("rawtypes")284 @Override public TouchAction performTouchAction(285 TouchAction touchAction) {286 ImmutableMap<String, ImmutableList> parameters = touchAction.getParameters();287 execute(PERFORM_TOUCH_ACTION, parameters);288 return touchAction;289 }290 /**291 * @see PerformsTouchActions#performMultiTouchAction(MultiTouchAction).292 */293 @Override294 @SuppressWarnings({"rawtypes"})295 public void performMultiTouchAction(296 MultiTouchAction multiAction) {297 ImmutableMap<String, ImmutableList> parameters = multiAction.getParameters();298 execute(PERFORM_MULTI_TOUCH, parameters);299 }300 /**301 * @see TouchShortcuts#tap(int, WebElement, int).302 */303 @Override public void tap(int fingers, WebElement element, int duration) {304 MultiTouchAction multiTouch = new MultiTouchAction(this);305 for (int i = 0; i < fingers; i++) {306 multiTouch.add(createTap(element, duration));307 }308 multiTouch.perform();309 }310 /**311 * @see TouchShortcuts#tap(int, int, int, int).312 */313 @Override public void tap(int fingers, int x, int y, int duration) {314 MultiTouchAction multiTouch = new MultiTouchAction(this);315 for (int i = 0; i < fingers; i++) {316 multiTouch.add(createTap(x, y, duration));317 }318 multiTouch.perform();319 }320 protected void doSwipe(int startx, int starty, int endx, int endy, int duration) {321 TouchAction touchAction = new TouchAction(this);322 // appium converts press-wait-moveto-release to a swipe action323 touchAction.press(startx, starty).waitAction(duration).moveTo(endx, endy).release();324 touchAction.perform();325 }326 /**327 * @see TouchShortcuts#swipe(int, int, int, int, int).328 */329 @Override public abstract void swipe(int startx, int starty, int endx, int endy, int duration);330 /**331 * Convenience method for pinching an element on the screen.332 * "pinching" refers to the action of two appendages pressing the333 * screen and sliding towards each other.334 * NOTE:335 * This convenience method places the initial touches around the element, if this would336 * happen to place one of them off the screen, appium with return an outOfBounds error.337 * In this case, revert to using the MultiTouchAction api instead of this method.338 *339 * @param el The element to pinch.340 */341 public void pinch(WebElement el) {342 MultiTouchAction multiTouch = new MultiTouchAction(this);343 Dimension dimensions = el.getSize();344 Point upperLeft = el.getLocation();345 Point center = new Point(upperLeft.getX() + dimensions.getWidth() / 2,346 upperLeft.getY() + dimensions.getHeight() / 2);347 int yOffset = center.getY() - upperLeft.getY();348 TouchAction action0 =349 new TouchAction(this).press(el, center.getX(), center.getY() - yOffset).moveTo(el)350 .release();351 TouchAction action1 =352 new TouchAction(this).press(el, center.getX(), center.getY() + yOffset).moveTo(el)353 .release();354 multiTouch.add(action0).add(action1);355 multiTouch.perform();356 }357 /**358 * Convenience method for pinching an element on the screen.359 * "pinching" refers to the action of two appendages pressing the screen and360 * sliding towards each other.361 * NOTE:362 * This convenience method places the initial touches around the element at a distance,363 * if this would happen to place one of them off the screen, appium will return an364 * outOfBounds error. In this case, revert to using the MultiTouchAction api instead of this365 * method.366 *367 * @param x x coordinate to terminate the pinch on.368 * @param y y coordinate to terminate the pinch on.369 */370 public void pinch(int x, int y) {371 MultiTouchAction multiTouch = new MultiTouchAction(this);372 int scrHeight = manage().window().getSize().getHeight();373 int yOffset = 100;374 if (y - 100 < 0) {375 yOffset = y;376 } else if (y + 100 > scrHeight) {377 yOffset = scrHeight - y;378 }379 TouchAction action0 = new TouchAction(this).press(x, y - yOffset).moveTo(x, y).release();380 TouchAction action1 = new TouchAction(this).press(x, y + yOffset).moveTo(x, y).release();381 multiTouch.add(action0).add(action1);382 multiTouch.perform();383 }384 /**385 * Convenience method for "zooming in" on an element on the screen.386 * "zooming in" refers to the action of two appendages pressing the screen and sliding387 * away from each other.388 * NOTE:389 * This convenience method slides touches away from the element, if this would happen390 * to place one of them off the screen, appium will return an outOfBounds error.391 * In this case, revert to using the MultiTouchAction api instead of this method.392 *393 * @param el The element to pinch.394 */395 public void zoom(WebElement el) {396 MultiTouchAction multiTouch = new MultiTouchAction(this);397 Dimension dimensions = el.getSize();398 Point upperLeft = el.getLocation();399 Point center = new Point(upperLeft.getX() + dimensions.getWidth() / 2,400 upperLeft.getY() + dimensions.getHeight() / 2);401 int yOffset = center.getY() - upperLeft.getY();402 TouchAction action0 = new TouchAction(this).press(center.getX(), center.getY())403 .moveTo(el, center.getX(), center.getY() - yOffset).release();404 TouchAction action1 = new TouchAction(this).press(center.getX(), center.getY())405 .moveTo(el, center.getX(), center.getY() + yOffset).release();406 multiTouch.add(action0).add(action1);407 multiTouch.perform();408 }409 /**410 * Convenience method for "zooming in" on an element on the screen.411 * "zooming in" refers to the action of two appendages pressing the screen412 * and sliding away from each other.413 * NOTE:414 * This convenience method slides touches away from the element, if this would happen to415 * place one of them off the screen, appium will return an outOfBounds error. In this case,416 * revert to using the MultiTouchAction api instead of this method.417 *418 * @param x x coordinate to start zoom on.419 * @param y y coordinate to start zoom on.420 */421 public void zoom(int x, int y) {422 MultiTouchAction multiTouch = new MultiTouchAction(this);423 int scrHeight = manage().window().getSize().getHeight();424 int yOffset = 100;425 if (y - 100 < 0) {426 yOffset = y;427 } else if (y + 100 > scrHeight) {428 yOffset = scrHeight - y;429 }430 TouchAction action0 = new TouchAction(this).press(x, y).moveTo(0, -yOffset).release();431 TouchAction action1 = new TouchAction(this).press(x, y).moveTo(0, yOffset).release();432 multiTouch.add(action0).add(action1);433 multiTouch.perform();434 }435 /**436 * Get settings stored for this test session It's probably better to use a437 * convenience function, rather than use this function directly. Try finding438 * the method for the specific setting you want to read.439 *440 * @return JsonObject, a straight-up hash of settings.441 */442 public JsonObject getSettings() {443 Response response = execute(GET_SETTINGS);444 JsonParser parser = new JsonParser();445 return (JsonObject) parser.parse(response.getValue().toString());446 }447 /**448 * Set settings for this test session It's probably better to use a449 * convenience function, rather than use this function directly. Try finding450 * the method for the specific setting you want to change.451 *452 * @param settings Map of setting keys and values.453 */454 private void setSettings(ImmutableMap<?, ?> settings) {455 execute(SET_SETTINGS, prepareArguments("settings", settings));456 }457 /**458 * Set a setting for this test session It's probably better to use a459 * convenience function, rather than use this function directly. Try finding460 * the method for the specific setting you want to change.461 *462 * @param setting AppiumSetting you wish to set.463 * @param value value of the setting.464 */465 protected void setSetting(AppiumSetting setting, Object value) {466 setSettings(prepareArguments(setting.toString(), value));467 }468 @Override public WebDriver context(String name) {469 checkNotNull(name, "Must supply a context name");470 execute(DriverCommand.SWITCH_TO_CONTEXT, ImmutableMap.of("name", name));471 return this;472 }473 @Override public Set<String> getContextHandles() {474 Response response = execute(DriverCommand.GET_CONTEXT_HANDLES);475 Object value = response.getValue();476 try {477 List<String> returnedValues = (List<String>) value;478 return new LinkedHashSet<>(returnedValues);479 } catch (ClassCastException ex) {480 throw new WebDriverException(481 "Returned value cannot be converted to List<String>: " + value, ex);482 }483 }484 @Override public String getContext() {485 String contextName =486 String.valueOf(execute(DriverCommand.GET_CURRENT_CONTEXT_HANDLE).getValue());487 if (contextName.equals("null")) {488 return null;489 }490 return contextName;491 }492 @Override public void rotate(ScreenOrientation orientation) {493 execute(DriverCommand.SET_SCREEN_ORIENTATION,494 ImmutableMap.of("orientation", orientation.value().toUpperCase()));495 }496 @Override public ScreenOrientation getOrientation() {497 Response response = execute(DriverCommand.GET_SCREEN_ORIENTATION);498 String orientation = response.getValue().toString().toLowerCase();499 if (orientation.equals(ScreenOrientation.LANDSCAPE.value())) {500 return ScreenOrientation.LANDSCAPE;501 } else if (orientation.equals(ScreenOrientation.PORTRAIT.value())) {502 return ScreenOrientation.PORTRAIT;503 } else {504 throw new WebDriverException("Unexpected orientation returned: " + orientation);505 }506 }507 @Override public Location location() {508 return locationContext.location();509 }510 @Override public void setLocation(Location location) {511 locationContext.setLocation(location);512 }513 /**514 * @return a map with localized strings defined in the app.515 * @see HasAppStrings#getAppStringMap().516 */517 @Override public Map<String, String> getAppStringMap() {518 Response response = execute(GET_STRINGS);519 return (Map<String, String>) response.getValue();520 }521 /**522 * @param language strings language code.523 * @return a map with localized strings defined in the app.524 * @see HasAppStrings#getAppStringMap(String).525 */526 @Override public Map<String, String> getAppStringMap(String language) {527 Response response = execute(GET_STRINGS, prepareArguments("language", language));528 return (Map<String, String>) response.getValue();529 }530 /**531 * @param language strings language code.532 * @param stringFile strings filename.533 * @return a map with localized strings defined in the app.534 * @see HasAppStrings#getAppStringMap(String, String).535 */536 @Override public Map<String, String> getAppStringMap(String language, String stringFile) {537 String[] parameters = new String[] {"language", "stringFile"};538 Object[] values = new Object[] {language, stringFile};539 Response response = execute(GET_STRINGS, prepareArguments(parameters, values));540 return (Map<String, String>) response.getValue();541 }542 private TouchAction createTap(WebElement element, int duration) {543 TouchAction tap = new TouchAction(this);544 return tap.press(element).waitAction(duration).release();545 }546 private TouchAction createTap(int x, int y, int duration) {547 TouchAction tap = new TouchAction(this);548 return tap.press(x, y).waitAction(duration).release();549 }550 public URL getRemoteAddress() {551 return remoteAddress;552 }553 /**...

Full Screen

Full Screen

IOSDriver.java

Source:IOSDriver.java Github

copy

Full Screen

...14 * limitations under the License.15 */16package io.appium.java_client.ios;17import static io.appium.java_client.MobileCommand.RUN_APP_IN_BACKGROUND;18import static io.appium.java_client.MobileCommand.prepareArguments;19import io.appium.java_client.AppiumDriver;20import io.appium.java_client.FindsByIosClassChain;21import io.appium.java_client.FindsByIosNSPredicate;22import io.appium.java_client.FindsByIosUIAutomation;23import io.appium.java_client.HidesKeyboardWithKeyName;24import io.appium.java_client.TouchAction;25import io.appium.java_client.remote.AppiumCommandExecutor;26import io.appium.java_client.remote.MobilePlatform;27import io.appium.java_client.service.local.AppiumDriverLocalService;28import io.appium.java_client.service.local.AppiumServiceBuilder;29import org.openqa.selenium.Alert;30import org.openqa.selenium.Capabilities;31import org.openqa.selenium.WebElement;32import org.openqa.selenium.remote.DriverCommand;33import org.openqa.selenium.remote.Response;34import org.openqa.selenium.remote.http.HttpClient;35import org.openqa.selenium.security.Credentials;36import java.net.URL;37/**38 * @param <T> the required type of class which implement39 * {@link org.openqa.selenium.WebElement}.40 * Instances of the defined type will be returned via findElement* and findElements*.41 * Warning (!!!). Allowed types:42 * {@link org.openqa.selenium.WebElement}43 * {@link org.openqa.selenium.remote.RemoteWebElement}44 * {@link io.appium.java_client.MobileElement}45 * {@link io.appium.java_client.ios.IOSElement}46 */47public class IOSDriver<T extends WebElement>48 extends AppiumDriver<T>49 implements HidesKeyboardWithKeyName, ShakesDevice,50 FindsByIosUIAutomation<T>, LocksIOSDevice, PerformsTouchID, FindsByIosNSPredicate<T>,51 FindsByIosClassChain<T> {52 private static final String IOS_PLATFORM = MobilePlatform.IOS;53 /**54 * @param executor is an instance of {@link org.openqa.selenium.remote.HttpCommandExecutor}55 * or class that extends it. Default commands or another vendor-specific56 * commands may be specified there.57 * @param capabilities take a look58 * at {@link org.openqa.selenium.Capabilities}59 */60 public IOSDriver(AppiumCommandExecutor executor, Capabilities capabilities) {61 super(executor, substituteMobilePlatform(capabilities, IOS_PLATFORM));62 }63 /**64 * @param remoteAddress is the address65 * of remotely/locally started Appium server66 * @param desiredCapabilities take a look67 * at {@link org.openqa.selenium.Capabilities}68 */69 public IOSDriver(URL remoteAddress, Capabilities desiredCapabilities) {70 super(remoteAddress, substituteMobilePlatform(desiredCapabilities, IOS_PLATFORM));71 }72 /**73 * @param remoteAddress is the address74 * of remotely/locally started Appium server75 * @param httpClientFactory take a look76 * at {@link org.openqa.selenium.remote.http.HttpClient.Factory}77 * @param desiredCapabilities take a look78 * at {@link org.openqa.selenium.Capabilities}79 */80 public IOSDriver(URL remoteAddress, HttpClient.Factory httpClientFactory,81 Capabilities desiredCapabilities) {82 super(remoteAddress, httpClientFactory,83 substituteMobilePlatform(desiredCapabilities, IOS_PLATFORM));84 }85 /**86 * @param service take a look87 * at {@link io.appium.java_client.service.local.AppiumDriverLocalService}88 * @param desiredCapabilities take a look89 * at {@link org.openqa.selenium.Capabilities}90 */91 public IOSDriver(AppiumDriverLocalService service, Capabilities desiredCapabilities) {92 super(service, substituteMobilePlatform(desiredCapabilities, IOS_PLATFORM));93 }94 /**95 * @param service take a look96 * at {@link io.appium.java_client.service.local.AppiumDriverLocalService}97 * @param httpClientFactory take a look98 * at {@link org.openqa.selenium.remote.http.HttpClient.Factory}99 * @param desiredCapabilities take a look100 * at {@link org.openqa.selenium.Capabilities}101 */102 public IOSDriver(AppiumDriverLocalService service, HttpClient.Factory httpClientFactory,103 Capabilities desiredCapabilities) {104 super(service, httpClientFactory,105 substituteMobilePlatform(desiredCapabilities, IOS_PLATFORM));106 }107 /**108 * @param builder take a look109 * at {@link io.appium.java_client.service.local.AppiumServiceBuilder}110 * @param desiredCapabilities take a look111 * at {@link org.openqa.selenium.Capabilities}112 */113 public IOSDriver(AppiumServiceBuilder builder, Capabilities desiredCapabilities) {114 super(builder, substituteMobilePlatform(desiredCapabilities, IOS_PLATFORM));115 }116 /**117 * @param builder take a look118 * at {@link io.appium.java_client.service.local.AppiumServiceBuilder}119 * @param httpClientFactory take a look120 * at {@link org.openqa.selenium.remote.http.HttpClient.Factory}121 * @param desiredCapabilities take a look122 * at {@link org.openqa.selenium.Capabilities}123 */124 public IOSDriver(AppiumServiceBuilder builder, HttpClient.Factory httpClientFactory,125 Capabilities desiredCapabilities) {126 super(builder, httpClientFactory,127 substituteMobilePlatform(desiredCapabilities, IOS_PLATFORM));128 }129 /**130 * @param httpClientFactory take a look131 * at {@link org.openqa.selenium.remote.http.HttpClient.Factory}132 * @param desiredCapabilities take a look133 * at {@link org.openqa.selenium.Capabilities}134 */135 public IOSDriver(HttpClient.Factory httpClientFactory, Capabilities desiredCapabilities) {136 super(httpClientFactory, substituteMobilePlatform(desiredCapabilities, IOS_PLATFORM));137 }138 /**139 * @param desiredCapabilities take a look140 * at {@link org.openqa.selenium.Capabilities}141 */142 public IOSDriver(Capabilities desiredCapabilities) {143 super(substituteMobilePlatform(desiredCapabilities, IOS_PLATFORM));144 }145 /**146 * This method is deprecated. It is going to be removed147 */148 @Override public void swipe(int startx, int starty, int endx, int endy, int duration) {149 int xOffset = endx - startx;150 int yOffset = endy - starty;151 new TouchAction(this).press(startx, starty).waitAction(duration).moveTo(xOffset, yOffset).release().perform();152 }153 /**154 * Runs the current app as a background app for the number of seconds155 * or minimizes the app156 *157 * @param seconds if seconds &gt;= 0: Number of seconds to run App in background.158 * This method call will block main thread and restore the application under159 * test after the timeout expires.160 * if seconds &lt; 0: any negative number of seconds will put the application161 * under test into background and return immediately, so iOS dashboard162 * will remain on-screen (this, actually, simulates click on Home button)163 */164 @Override public void runAppInBackground(int seconds) {165 // timeout parameter is expected to be in milliseconds166 // float values are allowed167 execute(RUN_APP_IN_BACKGROUND,168 prepareArguments("seconds", prepareArguments("timeout", seconds * 1000)));169 }170 @Override public TargetLocator switchTo() {171 return new InnerTargetLocator();172 }173 private class InnerTargetLocator extends RemoteTargetLocator {174 @Override public Alert alert() {175 return new IOSAlert(super.alert());176 }177 }178 class IOSAlert implements Alert {179 private final Alert alert;180 IOSAlert(Alert alert) {181 this.alert = alert;182 }183 @Override public void dismiss() {184 execute(DriverCommand.DISMISS_ALERT);185 }186 @Override public void accept() {187 execute(DriverCommand.ACCEPT_ALERT);188 }189 @Override public String getText() {190 Response response = execute(DriverCommand.GET_ALERT_TEXT);191 return response.getValue().toString();192 }193 @Override public void sendKeys(String keysToSend) {194 execute(DriverCommand.SET_ALERT_VALUE, prepareArguments("value", keysToSend));195 }196 @Override public void setCredentials(Credentials credentials) {197 alert.setCredentials(credentials);198 }199 @Override public void authenticateUsing(Credentials credentials) {200 alert.authenticateUsing(credentials);201 }202 }203}...

Full Screen

Full Screen

InteractsWithApps.java

Source:InteractsWithApps.java Github

copy

Full Screen

...23import static io.appium.java_client.MobileCommand.REMOVE_APP;24import static io.appium.java_client.MobileCommand.RESET;25import static io.appium.java_client.MobileCommand.RUN_APP_IN_BACKGROUND;26import static io.appium.java_client.MobileCommand.TERMINATE_APP;27import static io.appium.java_client.MobileCommand.prepareArguments;28import com.google.common.collect.ImmutableMap;29import io.appium.java_client.appmanagement.ApplicationState;30import io.appium.java_client.appmanagement.BaseActivateApplicationOptions;31import io.appium.java_client.appmanagement.BaseInstallApplicationOptions;32import io.appium.java_client.appmanagement.BaseRemoveApplicationOptions;33import io.appium.java_client.appmanagement.BaseTerminateApplicationOptions;34import java.time.Duration;35import java.util.AbstractMap;36import javax.annotation.Nullable;37public interface InteractsWithApps extends ExecutesMethod {38 /**39 * Launches the app, which was provided in the capabilities at session creation,40 * and (re)starts the session.41 */42 default void launchApp() {43 execute(LAUNCH_APP);44 }45 /**46 * Install an app on the mobile device.47 *48 * @param appPath path to app to install.49 */50 default void installApp(String appPath) {51 installApp(appPath, null);52 }53 /**54 * Install an app on the mobile device.55 *56 * @param appPath path to app to install or a remote URL.57 * @param options Set of the corresponding instllation options for58 * the particular platform.59 */60 default void installApp(String appPath, @Nullable BaseInstallApplicationOptions options) {61 String[] parameters = options == null ? new String[]{"appPath"} :62 new String[]{"appPath", "options"};63 Object[] values = options == null ? new Object[]{appPath} :64 new Object[]{appPath, options.build()};65 CommandExecutionHelper.execute(this,66 new AbstractMap.SimpleEntry<>(INSTALL_APP, prepareArguments(parameters, values)));67 }68 /**69 * Checks if an app is installed on the device.70 *71 * @param bundleId bundleId of the app.72 * @return True if app is installed, false otherwise.73 */74 default boolean isAppInstalled(String bundleId) {75 return CommandExecutionHelper.execute(this,76 new AbstractMap.SimpleEntry<>(IS_APP_INSTALLED, prepareArguments("bundleId", bundleId)));77 }78 /**79 * Resets the currently running app together with the session.80 */81 default void resetApp() {82 execute(RESET);83 }84 /**85 * Runs the current app as a background app for the time86 * requested. This is a synchronous method, it blocks while the87 * application is in background.88 *89 * @param duration The time to run App in background. Minimum time resolution is one millisecond.90 * Passing zero or a negative value will switch to Home screen and return immediately.91 */92 default void runAppInBackground(Duration duration) {93 execute(RUN_APP_IN_BACKGROUND, ImmutableMap.of("seconds", duration.toMillis() / 1000.0));94 }95 /**96 * Remove the specified app from the device (uninstall).97 *98 * @param bundleId the bundle identifier (or app id) of the app to remove.99 * @return true if the uninstall was successful.100 */101 default boolean removeApp(String bundleId) {102 return removeApp(bundleId, null);103 }104 /**105 * Remove the specified app from the device (uninstall).106 *107 * @param bundleId the bundle identifier (or app id) of the app to remove.108 * @param options the set of uninstall options supported by the109 * particular platform.110 * @return true if the uninstall was successful.111 */112 default boolean removeApp(String bundleId, @Nullable BaseRemoveApplicationOptions options) {113 String[] parameters = options == null ? new String[]{"bundleId"} :114 new String[]{"bundleId", "options"};115 Object[] values = options == null ? new Object[]{bundleId} :116 new Object[]{bundleId, options.build()};117 return CommandExecutionHelper.execute(this,118 new AbstractMap.SimpleEntry<>(REMOVE_APP, prepareArguments(parameters, values)));119 }120 /**121 * Close the app which was provided in the capabilities at session creation122 * and quits the session.123 */124 default void closeApp() {125 execute(CLOSE_APP);126 }127 /**128 * Activates the given app if it installed, but not running or if it is running in the129 * background.130 *131 * @param bundleId the bundle identifier (or app id) of the app to activate.132 */133 default void activateApp(String bundleId) {134 activateApp(bundleId, null);135 }136 /**137 * Activates the given app if it installed, but not running or if it is running in the138 * background.139 *140 * @param bundleId the bundle identifier (or app id) of the app to activate.141 * @param options the set of activation options supported by the142 * particular platform.143 */144 default void activateApp(String bundleId, @Nullable BaseActivateApplicationOptions options) {145 String[] parameters = options == null ? new String[]{"bundleId"} :146 new String[]{"bundleId", "options"};147 Object[] values = options == null ? new Object[]{bundleId} :148 new Object[]{bundleId, options.build()};149 CommandExecutionHelper.execute(this,150 new AbstractMap.SimpleEntry<>(ACTIVATE_APP, prepareArguments(parameters, values)));151 }152 /**153 * Queries the state of an application.154 *155 * @param bundleId the bundle identifier (or app id) of the app to query the state of.156 * @return one of possible {@link ApplicationState} values,157 */158 default ApplicationState queryAppState(String bundleId) {159 return ApplicationState.ofCode(CommandExecutionHelper.execute(this,160 new AbstractMap.SimpleEntry<>(QUERY_APP_STATE, ImmutableMap.of("bundleId", bundleId))));161 }162 /**163 * Terminate the particular application if it is running.164 *165 * @param bundleId the bundle identifier (or app id) of the app to be terminated.166 * @return true if the app was running before and has been successfully stopped.167 */168 default boolean terminateApp(String bundleId) {169 return terminateApp(bundleId, null);170 }171 /**172 * Terminate the particular application if it is running.173 *174 * @param bundleId the bundle identifier (or app id) of the app to be terminated.175 * @param options the set of termination options supported by the176 * particular platform.177 * @return true if the app was running before and has been successfully stopped.178 */179 default boolean terminateApp(String bundleId, @Nullable BaseTerminateApplicationOptions options) {180 String[] parameters = options == null ? new String[]{"bundleId"} :181 new String[]{"bundleId", "options"};182 Object[] values = options == null ? new Object[]{bundleId} :183 new Object[]{bundleId, options.build()};184 return CommandExecutionHelper.execute(this,185 new AbstractMap.SimpleEntry<>(TERMINATE_APP, prepareArguments(parameters, values)));186 }187}...

Full Screen

Full Screen

HasClipboard.java

Source:HasClipboard.java Github

copy

Full Screen

...16package io.appium.java_client.clipboard;17import static com.google.common.base.Preconditions.checkNotNull;18import static io.appium.java_client.MobileCommand.GET_CLIPBOARD;19import static io.appium.java_client.MobileCommand.SET_CLIPBOARD;20import static io.appium.java_client.MobileCommand.prepareArguments;21import io.appium.java_client.CommandExecutionHelper;22import io.appium.java_client.ExecutesMethod;23import java.nio.charset.StandardCharsets;24import java.util.AbstractMap;25import java.util.Base64;26public interface HasClipboard extends ExecutesMethod {27 /**28 * Set the content of device's clipboard.29 *30 * @param contentType one of supported content types.31 * @param base64Content base64-encoded content to be set.32 */33 default void setClipboard(ClipboardContentType contentType, byte[] base64Content) {34 String[] parameters = new String[]{"content", "contentType"};35 Object[] values = new Object[]{new String(checkNotNull(base64Content), StandardCharsets.UTF_8),36 contentType.name().toLowerCase()};37 CommandExecutionHelper.execute(this, new AbstractMap.SimpleEntry<>(SET_CLIPBOARD,38 prepareArguments(parameters, values)));39 }40 /**41 * Get the content of the clipboard.42 *43 * @param contentType one of supported content types.44 * @return the actual content of the clipboard as base64-encoded string or an empty string if the clipboard is empty45 */46 default String getClipboard(ClipboardContentType contentType) {47 return CommandExecutionHelper.execute(this, new AbstractMap.SimpleEntry<>(GET_CLIPBOARD,48 prepareArguments("contentType", contentType.name().toLowerCase())));49 }50 /**51 * Set the clipboard text.52 *53 * @param text The actual text to be set.54 */55 default void setClipboardText(String text) {56 setClipboard(ClipboardContentType.PLAINTEXT, Base6457 .getMimeEncoder()58 .encode(text.getBytes(StandardCharsets.UTF_8)));59 }60 /**61 * Get the clipboard text.62 *...

Full Screen

Full Screen

IOSMobileCommandHelper.java

Source:IOSMobileCommandHelper.java Github

copy

Full Screen

...24 */25 @Deprecated26 public static Map.Entry<String, Map<String, ?>> hideKeyboardCommand(String keyName) {27 return new AbstractMap.SimpleEntry<>(28 HIDE_KEYBOARD, prepareArguments("keyName", keyName));29 }30 /**31 * This method was moved to {@link MobileCommand#hideKeyboardCommand(String, String)}.32 */33 @Deprecated34 public static Map.Entry<String, Map<String, ?>> hideKeyboardCommand(String strategy,35 String keyName) {36 String[] parameters = new String[] {"strategy", "key"};37 Object[] values = new Object[] {strategy, keyName};38 return new AbstractMap.SimpleEntry<>(39 HIDE_KEYBOARD, prepareArguments(parameters, values));40 }41 /**42 * This method was moved to {@link MobileCommand#lockDeviceCommand(int)}.43 */44 @Deprecated45 public static Map.Entry<String, Map<String, ?>> lockDeviceCommand(int seconds) {46 return new AbstractMap.SimpleEntry<>(47 LOCK, prepareArguments("seconds", seconds));48 }49 /**50 * This method forms a {@link java.util.Map} of parameters for the51 * device shaking.52 *53 * @return a key-value pair. The key is the command name. The value is a54 * {@link java.util.Map} command arguments.55 */56 public static Map.Entry<String, Map<String, ?>> shakeCommand() {57 return new AbstractMap.SimpleEntry<>(58 SHAKE, ImmutableMap.<String, Object>of());59 }60 61 /**62 * This method forms a {@link java.util.Map} of parameters for the touchId simulator.63 * 64 * @param match If true, simulates a successful fingerprint scan. If false, simulates a failed fingerprint scan.65 * 66 */67 public static Map.Entry<String, Map<String, ?>> touchIdCommand(boolean match) {68 return new AbstractMap.SimpleEntry<>(69 TOUCH_ID, prepareArguments("match", match));70 }71}...

Full Screen

Full Screen

HasAndroidClipboard.java

Source:HasAndroidClipboard.java Github

copy

Full Screen

...15 */16package io.appium.java_client.android;17import static com.google.common.base.Preconditions.checkNotNull;18import static io.appium.java_client.MobileCommand.SET_CLIPBOARD;19import static io.appium.java_client.MobileCommand.prepareArguments;20import io.appium.java_client.CommandExecutionHelper;21import io.appium.java_client.clipboard.ClipboardContentType;22import io.appium.java_client.clipboard.HasClipboard;23import java.nio.charset.StandardCharsets;24import java.util.AbstractMap;25import java.util.Base64;26public interface HasAndroidClipboard extends HasClipboard {27 /**28 * Set the content of device's clipboard.29 *30 * @param label clipboard data label.31 * @param contentType one of supported content types.32 * @param base64Content base64-encoded content to be set.33 */34 default void setClipboard(String label, ClipboardContentType contentType, byte[] base64Content) {35 String[] parameters = new String[]{"content", "contentType", "label"};36 Object[] values = new Object[]{new String(checkNotNull(base64Content), StandardCharsets.UTF_8),37 contentType.name().toLowerCase(), checkNotNull(label)};38 CommandExecutionHelper.execute(this, new AbstractMap.SimpleEntry<>(SET_CLIPBOARD,39 prepareArguments(parameters, values)));40 }41 /**42 * Set the clipboard text.43 *44 * @param label clipboard data label.45 * @param text The actual text to be set.46 */47 default void setClipboardText(String label, String text) {48 setClipboard(label, ClipboardContentType.PLAINTEXT, Base6449 .getEncoder()50 .encode(text.getBytes(StandardCharsets.UTF_8)));51 }52}...

Full Screen

Full Screen

HasAppStrings.java

Source:HasAppStrings.java Github

copy

Full Screen

...14 * limitations under the License.15 */16package io.appium.java_client;17import static io.appium.java_client.MobileCommand.GET_STRINGS;18import static io.appium.java_client.MobileCommand.prepareArguments;19import java.util.AbstractMap;20import java.util.Map;21public interface HasAppStrings extends ExecutesMethod {22 /**23 * Get all defined Strings from an app for the default language.24 *25 * @return a map with localized strings defined in the app26 */27 default Map<String, String> getAppStringMap() {28 return CommandExecutionHelper.execute(this, GET_STRINGS);29 }30 /**31 * Get all defined Strings from an app for the specified language.32 *33 * @param language strings language code34 * @return a map with localized strings defined in the app35 */36 default Map<String, String> getAppStringMap(String language) {37 return CommandExecutionHelper.execute(this, new AbstractMap.SimpleEntry<>(GET_STRINGS,38 prepareArguments("language", language)));39 }40 /**41 * Get all defined Strings from an app for the specified language and42 * strings filename.43 *44 * @param language strings language code45 * @param stringFile strings filename46 * @return a map with localized strings defined in the app47 */48 default Map<String, String> getAppStringMap(String language, String stringFile) {49 String[] parameters = new String[] {"language", "stringFile"};50 Object[] values = new Object[] {language, stringFile};51 return CommandExecutionHelper.execute(this,52 new AbstractMap.SimpleEntry<>(GET_STRINGS, prepareArguments(parameters, values)));53 }54}...

Full Screen

Full Screen

prepareArguments

Using AI Code Generation

copy

Full Screen

1package appium;2import java.net.MalformedURLException;3import java.net.URL;4import java.util.Map;5import org.openqa.selenium.remote.DesiredCapabilities;6import io.appium.java_client.AppiumDriver;7import io.appium.java_client.MobileCommand;8import io.appium.java_client.MobileElement;9import io.appium.java_client.android.AndroidDriver;10public class AppiumTest {11 public static void main(String[] args) throws MalformedURLException, InterruptedException {12 DesiredCapabilities capabilities = new DesiredCapabilities();13 capabilities.setCapability("deviceName", "Android Emulator");14 capabilities.setCapability("platformName", "Android");15 capabilities.setCapability("platformVersion", "7.0");16 capabilities.setCapability("appPackage", "com.android.calculator2");17 capabilities.setCapability("appActivity", "com.android.calculator2.Calculator");

Full Screen

Full Screen

prepareArguments

Using AI Code Generation

copy

Full Screen

1public static void main(String[] args) throws MalformedURLException {2 DesiredCapabilities cap = new DesiredCapabilities();3 cap.setCapability("deviceName", "Android");4 cap.setCapability("platformName", "Android");5 cap.setCapability("platformVersion", "7.0");6 cap.setCapability("appPackage", "com.android.calculator2");7 cap.setCapability("appActivity", "com.android.calculator2.Calculator");8 cap.setCapability("noReset", "true");9 cap.setCapability("automationName", "uiautomator2");10 cap.setCapability("app", "C:\\Users\\Rajesh\\Downloads\\Calculator_v7.6_apkpure.com.apk");

Full Screen

Full Screen

prepareArguments

Using AI Code Generation

copy

Full Screen

1public static void main(String[] args) {2 MobileCommand mc = new MobileCommand();3 String[] arguments = mc.prepareArguments("mobile:shell", ImmutableMap.of("command", "ls"));4 for (String arg : arguments) {5 System.out.println(arg);6 }7}8from appium.webdriver.mobilecommand import MobileCommand9from selenium.webdriver.common.by import By10mc = MobileCommand()11arguments = mc.prepare_arguments("mobile:shell", {"command": "ls"})12print(arguments)13const { MobileCommand } = require('appium-base-driver');14const mc = new MobileCommand();15const arguments = mc.prepareArguments("mobile:shell", {"command": "ls"});16console.log(arguments);17arguments = mc.prepare_arguments('mobile:shell', { command: 'ls' })18import (19func main() {20 mc := mjsonwp.NewMobileCommand()21 arguments := mc.PrepareArguments("mobile:shell", map[string]interface{}{"command": "ls"})22 fmt.Println(arguments)23}24require_once __DIR__ . '/vendor/autoload.php';25use Facebook\WebDriver\WebDriverBy;26use Facebook\WebDriver\Remote\DesiredCapabilities;27use Facebook\WebDriver\Remote\RemoteWebDriver;28use Facebook\WebDriver\Remote\RemoteWebElement;29use Facebook\WebDriver\WebDriverDimension;30use Facebook\WebDriver\WebDriverPoint;31use Facebook\WebDriver\WebDriverWindow;32use Facebook\WebDriver\WebDriverExpectedCondition;

Full Screen

Full Screen

prepareArguments

Using AI Code Generation

copy

Full Screen

1MobileCommand command = new MobileCommand("findElement");2command.prepareArguments("id", "com.test:id/elementId");3AndroidCommand command = new AndroidCommand("findElement");4command.prepareArguments("id", "com.test:id/elementId");5IOSCommand command = new IOSCommand("findElement");6command.prepareArguments("id", "com.test:id/elementId");7WindowsCommand command = new WindowsCommand("findElement");8command.prepareArguments("id", "com.test:id/elementId");9MobileCommand command = new MobileCommand("findElement");10command.prepareArguments("id", "com.test:id/elementId");11AndroidCommand command = new AndroidCommand("findElement");12command.prepareArguments("id", "com.test:id/elementId");13IOSCommand command = new IOSCommand("findElement");14command.prepareArguments("id", "com.test:id/elementId");15WindowsCommand command = new WindowsCommand("findElement");16command.prepareArguments("id", "com.test:id/elementId");17MobileCommand command = new MobileCommand("findElement");18command.prepareArguments("id", "com.test:id/elementId");19AndroidCommand command = new AndroidCommand("findElement");20command.prepareArguments("id", "com.test:id/elementId");21IOSCommand command = new IOSCommand("findElement");22command.prepareArguments("id", "com.test:id/elementId");

Full Screen

Full Screen

prepareArguments

Using AI Code Generation

copy

Full Screen

1package appium.java;2import io.appium.java_client.MobileCommand;3import io.appium.java_client.MobileElement;4import io.appium.java_client.android.AndroidDriver;5import io.appium.java_client.remote.AndroidMobileCapabilityType;6import io.appium.java_client.remote.MobileCapabilityType;7import org.openqa.selenium.remote.DesiredCapabilities;8import java.net.MalformedURLException;9import java.net.URL;10import java.util.HashMap;11public class Test {12 public static void main(String[] args) throws MalformedURLException {13 DesiredCapabilities capabilities = new DesiredCapabilities();14 capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android");15 capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");16 capabilities.setCapability(MobileCapabilityType.UDID, "emulator-5554");17 capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.calculator2");18 capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.android.calculator2.Calculator");

Full Screen

Full Screen

prepareArguments

Using AI Code Generation

copy

Full Screen

1Map<String, String> params = new HashMap<String, String>();2params.put("name", "myName");3params.put("id", "myId");4params.put("text", "myText");5params.put("className", "myClassName");6params.put("tagName", "myTagName");7params.put("xpath", "myXPath");8params.put("linkText", "myLinkText");9params.put("partialLinkText", "myPartialLinkText");10params.put("cssSelector", "myCssSelector");11params.put("index", "1");12params.put("image", "myImage");13params.put("custom", "myCustom");14params.put("multiple", "true");15String locator = (String) MobileCommand.prepareArguments("findElement", params);16Map<String, String> params = new HashMap<String, String>();17params.put("name", "myName");18params.put("id", "myId");19params.put("text", "myText");20params.put("className", "myClassName");21params.put("tagName", "myTagName");22params.put("xpath", "myXPath");23params.put("linkText", "myLinkText");24params.put("partialLinkText", "myPartialLinkText");25params.put("cssSelector", "myCssSelector");26params.put("index", "1");27params.put("image", "myImage");28params.put("custom", "myCustom");29params.put("multiple", "true");30String locator = (String) MobileCommand.prepareArguments("findElements", params);31Map<String, String> params = new HashMap<String, String>();32params.put("name", "myName");33params.put("id", "myId");34params.put("text", "myText");35params.put("className", "myClassName");36params.put("tagName", "myTagName");37params.put("xpath", "myXPath");38params.put("linkText", "myLinkText");39params.put("partialLinkText", "myPartialLinkText");40params.put("cssSelector", "myCssSelector");41params.put("index", "1");42params.put("image", "myImage");43params.put("custom", "my

Full Screen

Full Screen

prepareArguments

Using AI Code Generation

copy

Full Screen

1public class Appium extends AppiumDriver {2 public Appium(URL remoteAddress, Capabilities desiredCapabilities) {3 super(remoteAddress, desiredCapabilities);4 }5 public Appium(URL remoteAddress, Capabilities desiredCapabilities, Capabilities requiredCapabilities) {6 super(remoteAddress, desiredCapabilities, requiredCapabilities);7 }8 public Appium(URL remoteAddress, Capabilities desiredCapabilities, Capabilities requiredCapabilities, CommandExecutor commandExecutor) {9 super(remoteAddress, desiredCapabilities, requiredCapabilities, commandExecutor);10 }11 public Appium(URL remoteAddress, Capabilities desiredCapabilities, CommandExecutor commandExecutor) {12 super(remoteAddress, desiredCapabilities, commandExecutor);13 }14 public Appium(Capabilities desiredCapabilities) {15 super(desiredCapabilities);16 }17 public Appium(Capabilities desiredCapabilities, Capabilities requiredCapabilities) {18 super(desiredCapabilities, requiredCapabilities);19 }20 public Appium(Capabilities desiredCapabilities, Capabilities requiredCapabilities, CommandExecutor commandExecutor) {21 super(desiredCapabilities, requiredCapabilities, commandExecutor);22 }23 public Appium(Capabilities desiredCapabilities, CommandExecutor commandExecutor) {24 super(desiredCapabilities, commandExecutor);25 }26 public Appium(CommandExecutor commandExecutor, Capabilities desiredCapabilities) {27 super(commandExecutor, desiredCapabilities);28 }29 public Appium(CommandExecutor commandExecutor, Capabilities desiredCapabilities, Capabilities requiredCapabilities) {30 super(commandExecutor, desiredCapabilities, requiredCapabilities);31 }32 public Appium(CommandExecutor commandExecutor) {33 super(commandExecutor);34 }35 public Appium(Capabilities desiredCapabilities, String sessionId) {36 super(desiredCapabilities, sessionId);37 }38 public Appium(MobileCommand command, String sessionId) {39 super(command, sessionId);40 }41 public Appium(MobileCommand command) {42 super(command);43 }44 public Appium(MobileCommand command, Map<String, ?> parameters) {45 super(command, parameters);46 }47 public Appium(MobileCommand command, Map<String, ?> parameters, String sessionId) {48 super(command, parameters, sessionId);49 }50 public Appium(MobileCommand command, Map<String, ?> parameters, String sessionId, Response response) {51 super(command, parameters, sessionId, response

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful