Is there any way to retrieve existing session with the session ID and initialize an Android driver
See original GitHub issueTo avoid reinitialize driver each time when a new scenario starts (gradle/cucumber)
If there is an API to retrieve an Appium session by providing Appium session ID we can reinitialize a new driver with an actively running session on server, I have to initialize driver for each scenario with Espresso server which takes about 45 seconds causing huge delay in overall test execution. i am able to preserve the current session ID in a file and restive it any time need but not able to set it to a an Appium/Android Driver
Environment
- Appium version (or git revision) that exhibits the issue: 1.16.0
- Last Appium version that did not exhibit the issue (if applicable): N/A
- Desktop OS/version used to run Appium: macOS - 10.15.3 (19D76) and Windows 10
- Node.js version (unless using Appium.app|exe): v12.13.0
- Npm or Yarn package manager: Npm
- Mobile platform/version under test: Android 9 and above
- Real device or emulator/simulator: Real device
- Appium CLI or Appium.app|exe: Appium CLI
Details
I have 50+ Scenario to be run and i initialize driver in @before and use throughout on test scenario where each Driver initialize consumes > 45s with Espresso server resulting in a delay of 37+ mints of delay outside test execution(info: I also have test environment that dosnot involve Espresso server that takes around 10 sec to init), If we have an API to retrieve an active session using session ID for example
AndroidDriver<WebElement> driver = Android.get(new URL(“http://127.0.0.1:4723/wd/hub”), “70832d72-43e6-42e0-a0e0-a49366b244e6”);
GET: http://127.0.0.1:4723/wd/hub/session/70832d72-43e6-42e0-a0e0-a49366b244e6
Link to Appium logs
N/A
Code To Reproduce Issue [ Good To Have ]
DesiredCapabilities caps = new DesiredCapabilities(); URL url = new URL(CoreInitializer.mobileServerUrl) ; caps.setCapability("deviceName", CoreInitializer.mobileDeviceName); caps.setCapability("platformName", "Android"); caps.setCapability("app", "https://........app-adapter.apk"); caps.setCapability("automationName", "Espresso"); caps.setCapability("forceEspressoRebuild", true); caps.setCapability("autoGrantPermissions", true); caps.setCapability("newCommandTimeout",100000); System.out.println("Waiting for driver to Initializing with Espresso server"); androidDriver = Android.initialize(url,caps);
Note: I use Java
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top GitHub Comments
#1 We tried removing 'forceEspressoRebuild`, Now its faster compared to earlier.
The Espresso server itself implements
/sessions
endpoint, which prints the list of active sessions. Although, you could probably consider building some customized solution on top of it to achieve the optimal performance for your scenario.