Skip to content

Reconnect WebDriver Session

Since version 6.2 Rapise is able to reconnect WebDriver sessions. It makes possible many usage scenarios that save a lot of time because you do not need to relaunch the browser and perform manual steps to reach desired application state.

This feature is especially handy when you use it with mobile browsers. For desktop browsers it is easier and more effective to use native Rapise connectors.

Maintenance Scenario

  1. You run a test and it fails at some point because some object is not found on screen.
  2. You use the Web Spy to reconnect to the application and analyze the cause of the failure.
  3. You use the Web Spy to re-learn the object.
  4. You run the test exactly from the step where it stopped working to make sure the test is fixed.

Reusing Session to Run Multiple Tests

Since application launch is time consuming operation in mobile testing you may run multiple tests on the same browser instance.

  1. You run a test and it leaves the browser running.
  2. You run next test and so on.

This approach has pros and cons. We do not recommend to use it for completely independent test cases. It makes sense, however, to use it to break down a long test into separate modules and run them sequentially.

How it Works

To leave application running and save session information use WebDriver.SaveSession call in TestFinish block of your test.

function TestFinish()

To reconnect to the running application use WebDriver.ReconnectSession call in TestPrepare block of your test.

function TestPrepare()

If you want Rapise to launch a new browser session if there is no saved one pass true to WebDriver.ReconnectSession call.

function TestPrepare()

Note: TestPrepare block is executed when you do recording or execution of a test. It is also executed if you do selective execution of RVL (Play Selection, Play From Here, etc.).

See Also

  • Selenium WebDriver, for an overview of Selenium based testing in Rapise.
  • Web Spy, for information on how to inspect state of an application loaded into a browser.