Home Appium Environment Setup Android Emulators iOS Simulators Appium Architecture Android chrome app automation Safari browser automation Appium Capabilities Inspecting android apps Native Android app automation Inspecting iOS app Native iOS app Automation Real Android Phone automation Real iPhone automation Element Identification Pressing button FaceId and TouchId Fingerprint automation Drag and Drop Tap and press Swipe gestures Hybrid app automation Execute script Synchronization in Appium Screenshots Page Object Models Cucumber and Appium Appium integration with azure Appium and Selenium Grid Running tests in browserstack Parallel testing Recording tests Mobile automation framework Errors and Exceptions in Appium Mobile automation test strategy Mobile automation challenges Appium QnA
Mobile automation using appium and browserstack
Some important points
- Register with Browserstack
- You will get Account Key to run automated tests on real devices
- Send commands to cloud server (Hub running in Selenium grid)
- You can access the video recordings of tests as well
- You will have to upload the apps to Browserstack server
- If you are accessing resources through local network, you will need to create a tunnel to Browserstack servers as well by running local binary.
package org.softpost.android.simulator;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.net.URL;
import java.util.concurrent.TimeUnit;
/**
* Created by Sagar on 10-07-2016.
*/
public class BrowserStackTest {
AndroidDriver driver;
@Test
public void test1() throws Exception{
String userName = "USERNAME";
String accessKey = "ACCESS_KEY";
try{
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("device", "Samsung Galaxy S10 Plus");
caps.setCapability("os_version", "10.0");
caps.setCapability("project", "BS Project");
caps.setCapability("build", "BS Build");
caps.setCapability("name", "BS Test");
caps.setCapability("app", "bs://app-url");
AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>
(new URL("https://"+userName+":"+accessKey+"@hub-cloud.browserstack.com/wd/hub"),
caps);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.findElement(
By.xpath
("//android.widget.Button[@resource-id='com.android.calculator2:id/digit_2']")).click();
driver.findElement(By.xpath("//*[@text='+']")).click();
}catch (Exception ex) {
ex.printStackTrace();
}finally {
driver.quit();
}
}
}
Web development and Automation testing
solutions delivered!!