How to get cookie information as JSON
Cookie cookie1 = driver.manage().getCookieNamed(“1P_JAR”); Map jsonObject = cookie1.toJson(); System.out.println(jsonObject.toString());
Cookie cookie1 = driver.manage().getCookieNamed(“1P_JAR”); Map jsonObject = cookie1.toJson(); System.out.println(jsonObject.toString());
public void pressAndroidMenu(AppiumDriver driver) { AndroidDriver androidDriver = (AndroidDriver) driver; androidDriver.pressKey(new KeyEvent(AndroidKey.MENU)); }
Code: caps.setCapability(“androidNaturalOrientation”, true); “Some devices are meant to be used primarily in a widescreen orientation. For this set of devices, it might make more sense to think of the default …
Code: caps.setCapability(“allowInsecurity”, “shell”); “Allows security relaxation only for specific functionalities. For example: You can allow relaxed security just for the android shell” Value: Shell / fastboot
How long (in seconds) Appium will wait for a new command from the client before assuming the client quit and ending the session. Setting to 0 will disable the new …
public void swipeUPOnElement(WebElement element) { Point point = element.getLocation(); Dimension eleSize = element.getSize(); int centerX = point.getX() + (eleSize.getWidth() / 2); int centerY = point.getY() + (eleSize.getHeight() / 2); int …
capabilities.setCapabilities(“clearDeviceLogsOnStart”=true) Truncate the device logs at the beginning of a session, so calls to getLogs will return log lines starting with the beginning of the session. This is very helpful …
capabilities.setCapabilites(“eventTiming”=true) Enable or disable Appium’s ability to report timing data for various internal events (e.g., the start and end of each command). To enable, set to true. The timing data …
capabilities.setCapabilities(“screenShotOnError”, true); Take screenshots when elements are not found. Screenshots are stored in the directory specified by the “diagnosticsDirectoryLocation” capability. Value = true/False
capabilities.setCapabilities(“useJSONSource”,true); Get JSON source from WDA and parse into XML on the Appium server. This can be much faster, especially on large apps.