I have a scenario that needed me to close Mobile App and re-launch it in the middle of test. Is it possible to do it in Silk Test Workbench with .NET script?
Application Delivery Management
Application Modernization & Connectivity
CyberRes
IT Operations Management
Hi garecanbp
You should be able to simply call the CloseApp() method to close the app:
_devce.MobileDevice("//MobileDevice").CloseApp()
To relaunch the app, you will need to script a MobileBaseState:
dim baseState as New MobileBaseState("deviceName=Pixel 2;platformName=Android;appPackage=my.app;appActivity=.MainActivity")
baseState.Execute()
-Robert
Unfortunately we cannot retrieve the App Config details from a Workbench script at runtime.
You should however be able to get the various device details after you intially connect to the device and construct a connection string. For example:
Dim deviceId As String = _desktop.MobileDevice("Device").DeviceId
Dim osType As MobileOperatingSystem = _desktop.MobileDevice("Device").OperatingSystem
Dim osVersion As String = _desktop.MobileDevice("Device").OsVersion
-Robert
You can dynamically invoke the Appium driver methods to get this information:
Console.WriteLine(_desktop.MobileDevice("//MobileDevice").Invoke("getCurrentPackage"))
Console.WriteLine(_desktop.MobileDevice("//MobileDevice").Invoke("currentActivity"))
I hope that helps.
-Robert