feat(ManagedBrowser): add viewport size configuration for browser launch #1495
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This change fixes an issue where the viewport settings (
viewport_widthandviewport_heightfromBrowserConfig) were not being passed to managed browsers. Previously, managed browsers launched without the--window-sizeflag, causing them to ignore the specified viewport and default to their own window size. Now, the flag is added inManagedBrowser._get_browser_args()for Chromium browsers, ensuring consistent viewport enforcement in managed mode.Fixes the user's reported issue with
use_managed_browsernot respecting viewport settings.#1490
List of files changed and why
_get_browser_args()method in theManagedBrowserclass to append the--window-size={width},{height}flag whenviewport_widthandviewport_heightare set inbrowser_config. This ensures managed browsers (launched via CLI) receive the viewport dimensions, matching the behavior for non-managed browsers inBrowserManager._build_browser_args().How Has This Been Tested?
test_pad.pyscript withuse_managed_browser=Trueand a specified viewport (e.g.,{"width": 900, "height": 720})._get_browser_args()to print the full args list and confirm the--window-sizeflag is included.use_managed_browser=Falseto ensure no regression in non-managed mode.Checklist:
ManagedBrowser).