Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: OperationTimedOut on Chrome 131.0.6778.109 #669

Open
benjamintemitope opened this issue Dec 11, 2024 · 0 comments
Open

Exception: OperationTimedOut on Chrome 131.0.6778.109 #669

benjamintemitope opened this issue Dec 11, 2024 · 0 comments

Comments

@benjamintemitope
Copy link

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();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant