I want to test my application with different set of test data for login functionality. Once i open my app and give username and password and close the app and open the app again to test with another set of credentials.
I want to restart my application (without deleting it) by calling driver.closeApp() followed by Driver.LaunchApp().(I want all these things to be happen in single Appium session)
I am not able to open the app in the same appium session.
If I want to achieve both i.e. Uninstalling/Installing while creating new Appium session at start of the test and in between test when I will close and relaunch app it should not delete/uninstall my application,which desiredcapabilities should I set?
if we call "driver.closeApp(); it will close the app instance.
if we now call driver.runAppInBackground(1) how it will run the app in background and relaunch it when we already closed the application ?
@Pankaj7 what line of code is problematic? i do not see in logâŚ
also i see that code not quite in correct order. change to:
// start driver and close app
AppiumDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),dr);
driver.closeApp();
// start app
try{driver.runAppInBackground(1);}catch (Exception e) {}
// find element and get it text
WebElement title=driver.findElement(By.xpath("//android.widget.TextView[@text='Account (offline)']"));
String str=title.getText();
@Aleksei I am new in appium coding, and i have a scenario where i want to close the app and start again ( basically want to restart here), and i am trying to use your given code, in my test case, but getting compile time error - âThe method runAppInBackground(Duration) in the type InteractsWithApps is not applicable for the arguments (int)â
And I donât know where i have to use this package code( do i need to use it ??)
[AndroidDriver] âcom.android.launcher3â is still running after 500ms timeout
An unknown server-side error occurred while processing the command. Original error: âcom.android.launcher3â is still running after 500ms timeout
Also used the below snippet and that also produced the error which is listed below