private WebDriver driver;
@BeforeMethod
public void setUp() throws Exception {
// set up appium
BasicConfigurator.configure();
File appDir = new File("This PC\\GT-I9100\\Phone\\360");
File app = new File(appDir, "app-release.apk"); //my case “demo1.apk”
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device","Android");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability(CapabilityType.VERSION, "4.2");
capabilities.setCapability(CapabilityType.PLATFORM, "WINDOW");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("app-package", "app-release.apk"); //my case com.gorillalogic.monkeytalk.demo1
capabilities.setCapability("app-activity", "Login"); //my case RootActivity
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
@AfterMethod
public void tearDown() throws Exception {
driver.quit();
}
@Test
public void loginTest() throws Throwable
{
System.out.println("Hello");
System.out.println(driver);
setUp();
}
@Test
public void formTest() throws InterruptedException
{
System.out.println("Hello");
System.out.println(driver);
/*Getting driver value as null in selenium web driver for appium mobile automation testing
Getting driver value as null. Used device name then also i am getting null value I have connected my real device.*/