question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there any way to retrieve existing session with the session ID and initialize an Android driver

See original GitHub issue

To 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:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
Vyshakh-01commented, Mar 4, 2020

#1 We tried removing 'forceEspressoRebuild`, Now its faster compared to earlier.

1reaction
mykola-mokhnachcommented, Mar 3, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

List available appium session id - Stack Overflow
Yes, you can check to see if there already sessions on the server by sending a request to /wd/hub/sessions . For example, if...
Read more >
Attaching Appium Clients to Existing Sessions
Every Appium automation session is given a unique ID when the session is first created. Webdriver HTTP commands after the initial POST to...
Read more >
Session Parameters | Android Open Source Project
The isReconfigurationRequired method can be called by the framework some time before a request with new parameters is submitted to the HAL, and ......
Read more >
Get Session ID for Appium Tests | BrowserStack Docs
Session ID is used to perform actions on a session like updating the status of the session, getting Appium logs of a session,...
Read more >
A new session could not be created for android appium
driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); System.out.println(“App launched”);. ERROR :.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found