Site Loader
Auckland, New Zealand
In the last post we discussed how to set the stage ready for appium, in this post we will start writing a simple code by
  • Writing the desired capability
  • Writing simple code to check if the application is opened.
Here is the complete code
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, "Android Emulator");
		cap.setCapability(MobileCapabilityType.APP_PACKAGE,
				"com.example.calculator");
		cap.setCapability("avd", "Test");

		driver = new AndroidDriver(new URL(
				"http://127.0.0.1:4723/wd/hub"), cap);

	}

	@Test
	public void SimpleTest() {
		Assert.assertNotNull(driver.getContext());
         }
}
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

Post Author: Karthik kk

One Reply to “Writing first Appium code with Java”

Leave a Reply to abhishek Cancel reply

Your email address will not be published. Required fields are marked *