chrome-devtools-mcp icon indicating copy to clipboard operation
chrome-devtools-mcp copied to clipboard

fix: support resize_page when browser window is maximized/fullscreenwindow state

Open 0xlakshan opened this issue 1 week ago • 1 comments

Related Issue - 465

Description

This change make sure that the browser window is restored to a normal state before resizing the page. When the window is in fullscreen mode we have to set the state twice to match how Chrome CDP behaves.

Tests cover window resizing for every available window states type WindowState = 'normal' | 'minimized' | 'maximized' | 'fullscreen';

0xlakshan avatar Jan 09 '26 18:01 0xlakshan

I guess might require setting a larger screen info for the test browser similar to https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/main/src/browser.ts#L178

OrKoN avatar Jan 12 '26 18:01 OrKoN

After testing few times i noticed that the maximized and fullscreen tests often fail, with dimensions overlapping those of the previous tests.

I think this happens because Chrome is still resizing from the previous test when the next test starts, and the resize listener resolves on the previous resize event rather than the current one.

To fix this, I found that the puppeteer's Page.waitForFunction() method can be used to wait until the size dimensions are actually being set

0xlakshan avatar Jan 13 '26 16:01 0xlakshan

Thanks!

OrKoN avatar Jan 13 '26 16:01 OrKoN