Code Snippet: // App1 capabilities String AppPackageName = "io.cloudgrey.the_app"; String AppActivityName = "io.cloudgrey.the_app.MainActivity"; // App2 capabilities String PcloudyDemoAppPackageName = "com.pcloudy.appiumdemo"; String PcloudyDemoAppActivityName = "com.ba.mobile.LaunchActivity"; //Lunch App1 Activity activity = new Activity(AppPackageName, AppActivityName); activity.setStopApp(false); ((AndroidDriver < Read More
Categories : Appium
Posted by Shibu Panda
No Comments
Code Snippet: // inspect available log types Set logtypes = driver.manage().logs().getAvailableLogTypes(); System.out.println("suported log types: " + logtypes.toString()); // [logcat, bugreport, server, client] // print first and last 10 lines of logs LogEntries logs = driver.manage().logs().get("logcat"); Read More
Categories : Appium
Posted by Shibu Panda
No Comments
Code Snippet Object deviceId = driver.executeScript("pCloudy_executeAdbCommand", "adb devices"); Object mockLocation = driver.executeScript("pCloudy_executeAdbCommand", "adb -s "+deviceId+" shell appops set com.pcloudy.services android:mock_location allow"); double latitude = 28.585895; double longitude = 77.313255; Object setLocation = driver.executeScript("pCloudy_executeAdbCommand", "adb -s Read More
Categories : Appium
Posted by Sridatta Pani
No Comments
Java-Client version: Latest(7.0.0) Appium version: 1.9.1 Code Snippet: MobileElement imageElement=(MobileElement); driver.findElementById("com.davemorrissey.labs.subscaleview.sample:id/imageView"); AndroidTouchAction touch = new AndroidTouchAction(driver); touch.press(PointOption.point(150,200)).release().perform().waitAction(WaitOptions.waitOptions(Duration.ofMillis(50))).press(PointOption.point(100,300)).release().perform();   Read More
Categories : Appium
Posted by Sridatta Pani
No Comments
Code Snippet: Dimension size = driver.manage().window().getSize() //Find swipe start and end point from screen's with and height. //Find startx point which is at right side of screen. int startx = (int) (size.width * 0.90); //Find Read More
Categories : Appium
Posted by Sridatta Pani
No Comments
Code Snippet: //Get the size of screen. Dimension size = driver.manage().window().getSize(); //Find swipe start and end point from screen’s with and height. int starty = (int) (size.height * 0.80); //Find endy point which is at Read More
Categories : Appium
Posted by Sridatta Pani
No Comments
Code Snippet: MobileElement keyboard = (MobileElement) driver.findElement(MobileBy.className(“UIAKeyboard”)); keyboard.findElements(By.name(“Return”)).get(0).click(); Thread.sleep(5000); OR ((IOSDriver) driver).hideKeyboard(HideKeyboardStrategy.PRESS_KEY, “Return”); Read More
Categories : Appium
Posted by Sridatta Pani
No Comments
Code Snippet: package com.networkConnection; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import io.appium.java_client.AppiumDriver; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.Connection; import io.appium.java_client.android.HasNetworkConnection; public Read More
Categories : Appium
Posted by Sridatta Pani
1 Comment
Code Snippet: package com.networkConnection; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import io.appium.java_client.AppiumDriver; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.Connection; import io.appium.java_client.android.HasNetworkConnection; public Read More
Categories : Appium
Posted by Sridatta Pani
No Comments
Code Snippet: ((AndroidDriver) driver).pressKeyCode(AndroidKeyCode.HOME);   Read More
Categories : Appium
Posted by Sridatta Pani
No Comments