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

Load website, execute javascript (click button) and fetch following requests #48

Closed
RosiersRobin opened this issue Apr 1, 2019 · 2 comments

Comments

@RosiersRobin
Copy link

Hi,

I'm trying to push a button, then a video loads and then I want to be able to "log" what the next requests are... Is this possible and how?

Current code I have:

$puppeteer = new Puppeteer(['read_timeout' => 130, 'log_browser_console' => true]);
$browser = $puppeteer->launch();

$page = $browser->newPage();

// Load the website
$page->goto('http://example.com', ['waitUntill' => 'networkidle2']);

// execute the javascript to click an element
$page->click('#PlayerZone > div.placeholder__wrapper > div.player__placeholder.lozad > i > svg');

// Get the response headers


// Close the browser
$browser->close();

I hope this is possible and someone is able to help me here!

Kindest regards

Robin

@nesk nesk transferred this issue from rialto-php/rialto Apr 3, 2019
@nesk
Copy link
Member

nesk commented Apr 3, 2019

This could be possible with the request event, however since PuPHPeteer currently doesn't support returning data from an event, you cannot do this for the moment.

Another solution could be writing the logs to a file, but PuPHPeteer will not allow you to require a module (like fs) until this issue is fixed.

The only thing that could work today is listening to the request event and inside your callback you log the request with console.log. By enabling the log_node_console option you will receive the logged data in your logger.

@nesk nesk closed this as completed Apr 3, 2019
@srhtylmz19
Copy link

any update?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants