In the last post we discussed how to automate android native mobileapplication using Appium, in this post we will start our discussion to automate android hybrid application using Appium.
In this post we will discuss automating an android hybrid application which we developed in Robotium series, which you can checkout here
For automating an hybrid application need to do the following
Desired capability
Identify the control (elements of UI)
Write the code to perform operation
Here is the complete code for the above discussion
public class FirstAppiumTest {
// Create instance for Appium Driver
AppiumDriver driver;
@BeforeClass
public void Setup() throws MalformedURLException {
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "donatello");
cap.setCapability(MobileCapabilityType.APP_PACKAGE, "com.example.executeautomationapp");
driver = new AndroidDriver(new URL(
"http://127.0.0.1:4723/wd/hub"), cap);
}
@Test
public void SimpleTest() {
driver.context("WEBVIEW_com.example.executeautomationapp");
// Navigate to google.cocm
driver.get("http://www.google.com");
// Search
driver.findElementByName("q").SendKeys("execute automation");
// Click button
driver.findElementByName("btnG").click();
}
}
Here is the complete video of the above discussion.
Thanks for reading the post and watching the video !!!
Please leave your comments and let me know if there is anything I should update in this post.
Thanks,
Karthik KK