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
OperationTimedOut in waitForStartup #1
Comments
Hi @andrew-s, Thanks for your insterest. First know that the project is in very early stage (actually I didnt even expect that someone would use it for now!) Concerning your issue, what version of chromium are you using? |
@gsouf I had a feeling that might be the case. I was using PhantomJS but I'm seeing lots of odd issues with angular apps - I thought that using headless chrome might be a better choice. My version is;
If there's any way I can help/contribute where/when I can then let me know. Thanks! |
@andrew-s that's the reason I switched to headless chrome as well. PhantomJs developement has been aborted and it has too many bugs. Concerning your version you have to upgrade chrome. I think that as of version 60 you should be fine. Headless chrome started to ship with version 59/60 and I noticed bugs with version 59 of chrome as well. The best is still to go with the latest version (62 as of I'm writting) Let me know if it works. Of course you can contribute. There are many ways to do that. If you feel that some features are missing, or that the API could be improved in some ways you can open an issue and discuss it and if you now how to do it you can send pull requests that implement what was discussed. |
@gsouf Ah sorry, I was doing That would suggest the time out lies elsewhere. Do you have a feature/todo list? Could be a good place to start. Thanks! |
Thanks for the details. I will add a debug feature to have an output of what is actually happening. As regards the todo list. I don't have such a thing for the moment, but I can do it if it can help people to contribute! Stay tunned |
Just a side question, is the installed version running with the commande "chromium-browser" as well? You can check version from command line with the command: |
I can give you the output from the socket, but I'm not sure it'll be too useful from what/where I'm outputting. It is the same version from the CLI that the browser lists. |
So, I debugged this a little more, looks like an issue in It does get a socket but, doesn't seem to then leave the foreach - shouldn't it yield the matched socket? |
@andrew-s Let me know what version of php you are using? I'll try to dive in the issue as of tomorrow |
Running PHP 7.0, I noticed you used Symfony process - would it perhaps simplify things to utilise their commands for real-time output reading? and then jump out once the websocket has been returned? Unless there's an easy fix in that generator, unfortunately my experience of them is non-existent, let me know if I can help in any way. Thanks! |
Please, can you pull down last changes from master and run the browser factory using this option: $browserFactory->createBrowser([
'debugLogger' => 'php://stdout'
]); This will output some info in the console, can you copy and paste this output alongside you next response please? |
@gsouf Appreciate the work on this, here's the output;
|
The good news is that it actually appears to be working correctly. Looking at the log I would guess that the error happens while closing chrome. The second good news is that I could reproduce the error and figured out that chrome wont close when running in headless mode (I disabled headless mode in my previous tests). |
Ah yeah, disabled headless mode and it worked. At least we both got the same result there. |
I pushed a fix. Hopefully the shutdown of chrome should be better as of chrome 63 (didn't test yet) because they added a method to close the browser gracefully that I couldn't find in chrome 62 |
I'm closing the issue, feel free to open it again in case it reproduces or to open a new one for any other features |
Add option timeout for Page::getFullPageClip
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 ```
I've been trying to utilise this, I've defined "chromium-browser" as the headless browser in the factory, like so;
However, I'm getting OperationTimedOut in waitForStartup, it seems like the regex does match and does get back a DevTools ws URL. A process does get started (and not removed interestingly) - I'm unsure how to debug this further. Any advice would be greatly appreciated.
Thanks!
The text was updated successfully, but these errors were encountered: