Skip to content

[Task-2247] Named Browser Sessions For Dual-Driver Browser Instances#671

Open
nasif-z wants to merge 13 commits intoreq-81-playwright-selenium-dual-driverfrom
task-2247-browser-sessions
Open

[Task-2247] Named Browser Sessions For Dual-Driver Browser Instances#671
nasif-z wants to merge 13 commits intoreq-81-playwright-selenium-dual-driverfrom
task-2247-browser-sessions

Conversation

@nasif-z
Copy link
Copy Markdown
Collaborator

@nasif-z nasif-z commented Mar 5, 2026

This PR introduces session-based browser isolation to allow testers to easily spawn fresh browser windows and intuitively interact with them individually. It follows the same session model used in database actions.


Changes

  • Session Isolation: Added browser_sessions shared variable to hold necessary browser driver information whenever opening new browser windows. By default, generates a browser_session named default.
  • Existing Variables: The sessions simply contains the pointers to the driver variables that were already in use.
  • Dynamic Ports: Automatically assigns unique remote debugging ports (9222–9322) for dual-driver CDP connections.
  • Dual Driver Support: Implemented in both Selenium and Playwright. Commonly used actions were modified to check if session is available and switches the active driver accordingly.
  • Targeted Actions & Teardown: Web functions now accept a session parameter to only execute the actions on specific instances without affecting others.

Backwards Compatibility

  • No Breaking Changes: If the session parameter is omitted, the framework defaults to the legacy single-instance behavior.
  • Legacy Parameters: driverid support is maintained for Selenium.

Usage

Add row in action in this format: session | optional parameter | session name (string)

1. Selenium Multi-Session

Pass a unique string to the session parameter to spawn separate windows.

# Session A
Go_To_Link([
    ("session", "optional parameter", "user_1"),
    ("go to link", "selenium action", "https://google.com")
])

# Session B
Go_To_Link([
    ("session", "optional parameter", "user_2"),
    ("go to link", "selenium action", "https://bing.com")
])

2. Apply action on specific session

# Will apply the click action on the browser with session name admin_auth
# even when there are multiple sessions active
Click_Element([
    ("session", "optional parameter", "admin_auth"),
    ("id", "element parameter", "login-btn"),
    ("click", "playwright action", "click")
])

3. Specific Session Cleanup

Tear_Down_Selenium([
    ("session", "optional parameter", "user_1"),
    ("tear down", "selenium action", "tear down")
])

4. Without "session" parameter

Omitting the session parameter in step/action data will preserve the behavior as it was before the addition of this feature.

@nasif-z nasif-z requested a review from sazid March 5, 2026 16:54
@nasif-z nasif-z self-assigned this Mar 5, 2026
@nasif-z nasif-z changed the title [Task-2247] Named Browser Sessions: Isolated Dual-Driver Browser Instances [Task-2247] Named Browser Sessions For Dual-Driver Browser Instances Mar 5, 2026
@sazid
Copy link
Copy Markdown
Member

sazid commented Mar 6, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e8e79d1b04

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sazid
Copy link
Copy Markdown
Member

sazid commented Mar 7, 2026

@nasif-z check the comments

@sazid sazid marked this pull request as draft March 7, 2026 19:00
@nasif-z nasif-z marked this pull request as ready for review March 25, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants