browser-use: browser_window_size not working
Bug Description
After trying out 0.1.41rc3, I’m noticing that the browser_window_size no longer changes the browser’s window size. I verified the numbers are still being passed in correctly.
Reproduction Steps
see code sample below
Code Sample
window_size = BrowserContextWindowSize(width=800, height=400)
config = BrowserContextConfig(browser_window_size=window_size)
browser_context = BrowserContext(
browser=browser,
config=config
)
agent = Agent(
task=prompt,
llm=actual_llm,
browser_context=browser_context,
)
Version
0.41.1rc3
LLM Model
Gemini 1.5 Pro
Operating System
Mac
Relevant Log Output
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 19 (11 by maintainers)
@pirate would appreciate a review on the PR above, thank you!
Although it’s very tiring, please test it more thoroughly when submitting, as there are still several obvious bugs.
@sandeepsalwan1 will update in sometime
I’m tempted to get rid of
BrowserContextWindowSizeentirely and just flatten it intoBrowserContextConfig(window_width=1280, window_height=1024).Would people be ok with that? It’s a slightly breaking change to the API but imo it’s very annoying to have a nested object for only 2 keys.
Fix PR merged, want to try again @kpmc-anu?
Hi @kpmc-anu,
Thanks for your feedback! Let me know if any other issues and I will work to resolve it within the day. I’ve submitted a PR to fix this above.
The problem occurs because the browser’s window size and viewport settings aren’t synchronized properly. When you set browser_window_size but leave the default viewport settings, the mismatch causes elements to appear at the bottom of the page.
Temporary fix for your issue until resolved:
The PR respects the user-provided no_viewport setting when browser_window_size is specified.
@pirate just tried it with 0.1.41 but still not seeing the screen size changes
Note: this worked in 0.1.40