Why Use Independent Browser Sessions?

Some monitoring and load test scenarios may require separate sessions recorded within one browser. Examples include scenarios that emulate chat conversations between two users, video or audio calls between two users, or workflows involving different user roles—such as a user submitting an application while an administrator reviews and approves it in real time.

The Dotcom-Monitor EveryStep Recorder supports recording in multiple browser tabs. By default, all tabs in a recording share one browser session. They share cookies, cache, and storage. To record two users at the same time, for example a customer and an administrator, record each user in a separate session. Sessions do not share data.

Learn how to record using multiple tabs in this EveryStep Recorder tutorial video.

The EveryStep Recorder supports up to five sessions:

  • Session.Default
  • Session.N1
  • Session.N2
  • Session.N3
  • Session.N4

You can create independent browser sessions in the recorder or in the script code.

Record Isolated Sessions in the EveryStep Recorder

  1. Start a recording. Record the steps for the first user in the first tab.
  2. In the top toolbar, select Recorded Tabs. The number on the button shows how many tabs are open.
  3. Select New Session.
  4. Enter the URL in the address bar. Record the steps for the second user.
  5. To add more sessions, repeat steps 2 to 4. A script supports up to five sessions.
  6. Select Stop and save the script.

The New Tab card adds a tab to the current session. It does not create an isolated session. Always use New Session for isolation.

Switch Between Tabs and Sessions

To switch between tabs and sessions:

  1. In the top toolbar, select Recorded Tabs.
  2. Select the tab card to record in. The recorder will open the selected tab.
  3. Record the steps.

The recorder adds the steps to the script for the selected tab.

Review the Generated Script

The recorder writes the session code for you. To review it while recording, click Recorded Script. For example, after you select New Session, the script contains the following line:

// Created by New Session: opens a tab in an isolated browser session
tab1 = Tabs.NewTab(Session.N1);

Once the recording is complete, you can edit the script in the Scrip Code editor. See the Create Independent Sessions in the Script Code section below.

Create Independent Sessions in the Script Code

To start with editing your script, open it in the EveryScript Recorder. To learn how to switch to the Script Code editor, visit Editing a Script in EveryStep Scripting Tool.

Scripts that have been edited with custom C# code require an approval by our technical support team before being saved. Every time you add a custom C# code or edit a script that contains custom C# code the script will be sent for approval automatically. Note that it may take some time for our team to review and approve the script for use.

Create Browser Tabs in the Default Session

Use the default session when multiple tabs should behave as the same logged-in user. To create a browser tab in the default browser session:

DMBrowser tab0 = null;
tab0 = Tabs.NewTab();

This is equivalent to:

DMBrowser tab0 = null;
tab0 = Tabs.NewTab(Session.Default);

Both methods use the same default browser session.

Create Independent Browser Sessions

To create a fully isolated browser session:

DMBrowser tab1 = null;
tab1 = Tabs.NewTab(Session.N1);

Example: Multi-User Monitoring Workflow

The example below demonstrates a common real-time communication monitoring scenario:

DMBrowser tab0 = null;
DMBrowser tab1 = null;
tab0 = Tabs.NewTab(); // User A
tab1 = Tabs.NewTab(Session.N1); // User B

In this configuration:

  • tab0 can run a session under User A
  • tab1 can run a session under User B

Because the sessions are isolated, both users remain authenticated simultaneously within the same monitoring execution.

Set Cookies for a Specific Session

This can be used to initialize session-specific application state before navigation.

To set a cookie in the default session:

SetCookieForUrl("url", "key", "value");

To set a cookie for a specific session:

//Session.N1
SetCookieForUrl("url", "key", "value", 1);

Session indexes correspond to browser sessions:

  • 0 = Session.Default 
  • 1 = Session.N1
  • 2 = Session.N2
  • 3 = Session.N3
  • 4 = Session.N4

Open URLs in Different Sessions

After creating tabs, navigate independently within each session:

//User A
Step ("Example Domain - https://example.com/");
tab0.GoTo ("https://example.com/");
//User B
Step ("Example Domain - https://example.com/"");
tab1.GoTo ("https://example.com/");

Each browser session maintains its own authentication and application state.

Working with Popup Windows

This is useful when popup windows inherit authentication or session context from the parent browser.

// Access a popup window
tab1 = Tabs.PopUps.Pop["https://the-internet.herokuapp.com/windows/new"];
// Retrieve the popup browser session
var popupSession = tab1.BrowserSession;