chrome-php / chrome

Instrument headless chrome/chromium instances from PHP
MIT License
2.2k stars 269 forks source link

[Bug]: PageLayoutMetrics::getResultData(): Return value must be of type array, null returned #611

Open kingjia90 opened 3 months ago

kingjia90 commented 3 months ago

Probably something broke with https://github.com/chrome-php/chrome/pull/325

image

Not sure how to reproduce it, just

            $page = $browser->createPage();
            $page->navigate($url)->waitForNavigation();

            $page->screenshot([
                'captureBeyondViewport' => true,
                'clip' => $page->getFullPageClip(),
            ])->saveToFile($outputFile);
enricodias commented 3 months ago

The key cssContentSize is missing in that response, but if we can't reproduce it the only thing we could do is just throw an exception.

kingjia90 commented 3 months ago

somehow it happened when i locked the docker image of browserless/chrome to 1.16-chrome-stable but doesn't happen in the latest

What about falling back to windowSize when not found, eg. ['width'=>$options['windowSize'][0], 'height'=>$options['windowSize'][1]] ?