Hello,
I am using appium studio 12.4.5043 and Emulator(Nexus_5X_API_28_x86:5554) to open One app. But I am not able to open the app when I use an emulator but when I use the same code for real device it opens the app(Note: I have defined the device name properly in capabilities for each of the devices).
Class**********
public class Mobile_Test {
private String reportDirectory = “reports”;
private String reportFormat = “xml”;
private String testName = “Test”;
protected AndroidDriver driver = null;
DesiredCapabilities dc = new DesiredCapabilities();
@BeforeMethod
public void setUp() throws MalformedURLException {
dc.setCapability("reportDirectory", reportDirectory);
dc.setCapability("reportFormat", reportFormat);
// dc.setCapability(MobileCapabilityType.APP,app);
dc.setCapability("testName", testName);
dc.setCapability(MobileCapabilityType.UDID, "emulator-5554");
dc.setCapability("appPackage", "com.test.first");
dc.setCapability("com.test.first.MainActivity");
driver = new AndroidDriver<>(new URL("http://localhost:4723/wd/hub"), dc);
driver.setLogLevel(Level.INFO);
}
@Test
public void tested() {
new WebDriverWait(driver, 120).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//[@text=‘Welcome’ and @class=‘android.web.View’]")));
driver.findElement(By.xpath("//[@text=‘Welcome’ and @class=‘android.web.View’]")).click();
}
@AfterMethod
public void tearDown() {
driver.quit();
}
}
Help will be appreciated.