Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Call to a member function newPage() on null #24

Closed
bobrain008 opened this issue Oct 1, 2018 · 4 comments
Closed

Call to a member function newPage() on null #24

bobrain008 opened this issue Oct 1, 2018 · 4 comments
Labels
bug Something isn't working

Comments

@bobrain008
Copy link

bobrain008 commented Oct 1, 2018

Hello,
the PHP usual code...here on CentOS 7

require 'vendor/autoload.php';
use Nesk\Puphpeteer\Puppeteer;
use Nesk\Rialto\Exceptions\Node;
$puppeteer = new Puppeteer;
$browser = $puppeteer->launch([
    'args' => ['--no-sandbox', '--disable-setuid-sandbox', '--proxy-server=xx.xx.xxx.xx:3128'],
]);
$page = $browser->newPage();
...

My setup:
OS CentOS Linux 7.5.1804
Node v9.11.2
PHP 7.1.22
NPM 6.2.0
nesk Puppeteer 1.8.0
nesk Rialto 1.2.1

Here newPage() doesn't work anymore and the script stops:

[01-Oct-2018 12:36:05 Europe/Berlin] PHP Fatal error:  Uncaught Error: Call to a member function newPage() on null in /home/myuser/public_html/foder/project/myscript.php:203
Stack trace:
#0 {main}
  thrown in /home/myuser/public_html/foder/project/myscript.php on line 203 

Do you know the reason, please? Thank you very much

@bobrain008
Copy link
Author

Hello, there's no way at the moment to run the latest versions on CentOS 7. I don't know if about the no-sandbox but that's it. Please, did you test it on CentOS or do you know why newPage() on null ? Thanks...

@bobrain008
Copy link
Author

For your info, If i write a .js file as myscript.js

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox', '--proxy-server=xx.xx.xxx.xx:3128'] });
  const page = await browser.newPage();
  await page.goto('https://myweb.com', {waitUntil: 'networkidle0'});
  await page.setViewport({width: 1920, height: 1080});
  await page.screenshot({path: 'example.png'});

  await browser.close();
})();

and then node myscript.js
it works as usual, so unfortunately that means the issue is on puphpeteer. Thank you

@nesk
Copy link
Member

nesk commented Oct 23, 2018

Sorry for the delay, I didn't have much time to work on this and I'm currently unable to test the project with CentOS 7. Could you provide me some logs? Here are some instructions.

@nesk nesk added the bug Something isn't working label Mar 5, 2019
@nesk
Copy link
Member

nesk commented Apr 3, 2019

I've tested on CentOS7 and didn't encounter any issue. I'm closing since I didn't get any feedback.

@nesk nesk closed this as completed Apr 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants