[Task-2247] Named Browser Sessions For Dual-Driver Browser Instances#671
[Task-2247] Named Browser Sessions For Dual-Driver Browser Instances#671nasif-z wants to merge 10 commits intoreq-81-playwright-selenium-dual-driverfrom
Conversation
Similar to Selenium open browser action
|
@codex review |
There was a problem hiding this comment.
💡 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".
| } | ||
| else: | ||
| selenium_driver = selenium_details[driver_id]["driver"] | ||
| selenium_driver = get_browser_session(session_name)["selenium_driver"] |
There was a problem hiding this comment.
Resolve existing Selenium driver by driver_id, not default session
When Go_To_Link reuses an already-open Selenium driver, this lookup uses session_name, which defaults to "default" when no session/driverid is provided. If the active driver was created under a non-default ID, get_browser_session("default") returns {} and indexing ['selenium_driver'] raises, so previously valid flows that relied on implicit current-driver reuse now fail.
Useful? React with 👍 / 👎.
| # Get the correct remote debugging port for current driver | ||
| debug_port = 9222 # fallback | ||
| if current_driver_id and current_driver_id in selenium_details: | ||
| debug_port = selenium_details[current_driver_id].get("remote-debugging-port", 9222) |
There was a problem hiding this comment.
Guard against None remote-debugging port for CDP connect
This assignment treats a present-but-None remote-debugging-port as valid, so debug_port can become None and the subsequent CDP URL becomes http://localhost:None. That happens on the normal browser-open path where the stored port is not populated from the generated session port, causing playwright() bridge actions to fail to connect.
Useful? React with 👍 / 👎.
| elif left_l in ("driver id", "page id", "driver tag", "session"): | ||
| page_id = right_v |
There was a problem hiding this comment.
Keep parsing Playwright driver id from input parameter
The driver id/page id/driver tag value is now only read from optional parameter, so existing steps that pass it as input parameter are ignored and fall back to page_id="default". That silently collapses distinct Playwright instances into the default slot and breaks backward-compatible multi-page routing.
Useful? React with 👍 / 👎.
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
browser_sessionsshared variable to hold necessary browser driver information whenever opening new browser windows. By default, generates abrowser_sessionnameddefault.sessionparameter to only execute the actions on specific instances without affecting others.Backwards Compatibility
sessionparameter is omitted, the framework defaults to the legacy single-instance behavior.driveridsupport 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
sessionparameter to spawn separate windows.2. Apply action on specific session
3. Specific Session Cleanup
4. Without "session" parameter
Omitting the
sessionparameter in step/action data will preserve the behavior as it was before the addition of this feature.