the_prole
the_prole

Reputation: 8945

How to re-use Appium driver

Wondering if I can set newCommandTimeout to a higher number, and have test just re-use current drivers. Is this possible?

The driver variable will got out of scope when the test ends, but the I should be able to re-initialize a new driver variable with the current session.

Upvotes: 1

Views: 983

Answers (1)

dmle
dmle

Reputation: 3658

You can set newCommandTimeout to any value, but I doubt there is a need to increase it above 60-90.

I'm creating AppiumDriver instance once per suite run, so all tests use the same driver; I added driver session status check before each tests, and in case smth went wrong - create driver session.

But it does not require any manipulation with newCommandTimeout capability. Just design your tests the way they can have access to global driver instance, or create multiple for simulation run. I'm not sure you can re-initiate driver object and link it to existing session, but thats for sure is not a reliable approach with Appium - session might die for multiple unexpected reasons, so would have to create new session.

Upvotes: 1

Related Questions