Skip to content

Exception: OperationTimedOut on Chrome 131.0.6778.109 #669

@benjamintemitope

Description

@benjamintemitope

Saving an HTML file to PDF on Chrome 131.0.6778.109 (latest) results in an OperationTimeOut exception.

I tried increasing the timeout, but it did not work. So, I checked the last chrome-php release test and discovered that Chrome 122 was used in the testing environment.

Then, I downloaded a portable Chrome 122.0.6261.112 and set the binary path in my code. After that, the conversion worked.

During personal debugging, I noticed that $response returns null in AbstractBinaryInput.php for Chrome 131.0.6778.109.

public function saveToFile(string $path, int $timeout = 5000): void
    {
        $response = $this->responseReader->waitForResponse($timeout);
        
        ....
    }
  • PHP Version: 8.1.5
  • Chrome Version: Chrome 131.0.6778.109
  • OS: Windows 10 (64 bits)

Sample Code

$browserFactory = new BrowserFactory();

// starts headless Chrome
$browser = $browserFactory->createBrowser();

try {
    // creates a new page and navigate to an url
    $page = $browser->createPage();
    $page->navigate('http://example.com')->waitForNavigation();

    // pdf
    $page->pdf([
    	'printBackground' => true,
    	'preferCSSPageSize' => true,
    	'scale' => 0.87,
    ])->saveToFile('example.pdf');
} finally {
    // bye
    $browser->close();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions