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

Implemented toggling of image loading #3

Merged
merged 5 commits into from
Mar 29, 2018
Merged

Conversation

andrew-s
Copy link
Contributor

@andrew-s andrew-s commented Dec 6, 2017

No description provided.

@gsouf
Copy link
Member

gsouf commented Dec 7, 2017

Thanks for your contribution. Could you rename the option to "enableImages" and also I just added a section in the readme to list broswerFactory's options (https://github.com/gsouf/headless-chromium-php/blob/master/README.md#browser-factory) can you add this option here?

@gsouf
Copy link
Member

gsouf commented Dec 7, 2017

@andrew-s
Copy link
Contributor Author

andrew-s commented Dec 7, 2017

That should be everything updated

@blackandred
Copy link

Any progress on this PR?

@gsouf
Copy link
Member

gsouf commented Mar 29, 2018

Woops, my bad

@gsouf gsouf merged commit b548c39 into chrome-php:master Mar 29, 2018
@woodsbox woodsbox mentioned this pull request Jan 12, 2019
@mare-on mare-on mentioned this pull request Mar 4, 2023
divinity76 added a commit to divinity76/chrome that referenced this pull request May 3, 2023
for a split second, documentElement might be missing, causing getHtml() to crash.
I had a program that was doing page stuff and calling getHtml() like every 10 milliseconds (100 times per second), and got an unexpected crash. Was able to create a small reproducible sample:
```php
<?php

declare(strict_types=1);
require_once('vendor/autoload.php');
$chromeBinary = "/snap/bin/chromium";
$browser_factory = new \HeadlessChromium\BrowserFactory($chromeBinary);
$browser_factory->setOptions([
    "headless" => true,
    "noSandbox" => true,
    'windowSize'   => [1000, 1000]
]);
$browser = $browser_factory->createBrowser();
$page = $browser->createPage();
for ($i = 0; $i < 100; ++$i) {
    $page->navigate("http://example.com");
    $html = $page->getHtml();
    $page->navigate("http://example.org");
    $html = $page->getHtml();
}
```
consistently crash with:
```
PHP Fatal error:  Uncaught HeadlessChromium\Exception\JavascriptException: Error during javascript evaluation: TypeError: Cannot read properties of null (reading 'outerHTML')
    at <anonymous>:1:26 in /home/hans/projects/ibkr/vendor/chrome-php/chrome/src/PageUtils/PageEvaluation.php:89
Stack trace:
#0 /home/hans/projects/ibkr/vendor/chrome-php/chrome/src/PageUtils/PageEvaluation.php(108): HeadlessChromium\PageUtils\PageEvaluation->waitForResponse()
chrome-php#1 /home/hans/projects/ibkr/vendor/chrome-php/chrome/src/Page.php(894): HeadlessChromium\PageUtils\PageEvaluation->getReturnValue()
chrome-php#2 /home/hans/projects/ibkr/test_crash.php(16): HeadlessChromium\Page->getHtml()
chrome-php#3 {main}
  thrown in /home/hans/projects/ibkr/vendor/chrome-php/chrome/src/PageUtils/PageEvaluation.php on line 89
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants