Question: Can I redefine the `Page.loadEventFired` event after it's been fired?
See original GitHub issueI want to submit a login form, then redefine Page.loadEventFired
again and do something else when the new page loads. Something like this:
Page.loadEventFired(() => {
Promise.resolve()
.then(function() {
return Runtime.evaluate(/* expression here will submit login form */)
})
.then(function (response) {
// probably not necessary once things are working
console.log('response:', response);
})
.then(/* redefine Page.loadEventFired here */)
.then(function() {
return Page.navigate({
url: 'second link after login',
});
})
// I'm not sure where we should finish logic so we can handle a load event again but
// something happens in between here and I take a screenshot after:
... Page.loadEventFired...
.then(Page.captureScreenshot)
.then(screenshot)
.then(function() {
client.close();
});
});
Looked around for an example and couldn’t find one.
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Target domain events not firing? - Stack Overflow
A fun thing about the Target Domain is that it does not have an enable method. However, it does have setDiscoverTargets method, ...
Read more >Page.loadEventFired can't receive sometimes - Google Groups
Hi,. I met a problem that loadEventFired event can not received when I create multiple chrome tabs by chrome-remote-interface, almost 100 tab ...
Read more >Introduction to Highcharts events
It is fired after the load phase and after a few other events. Basically, whenever anything is changed in the chart – this...
Read more >How to find out which JavaScript events fired? - Tutorialspoint
Using Developer Tools · Go to the sources tab. · Click on the Event Listener Breakpoints, on the right side. · Then perform...
Read more >Session traces: Explore a webpage's life cycle
After you select the session URL or session trace ID, you can use the detailed ... The time from when the request began...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here we go, since v0.20.0 you can also write:
Any feedback is welcome.
I know this is closed and all but I found it plenty useful. After trying some of the approaches mentioned here, I went with using a function hoisted as a state variable. In doing so I can await multiple page loads in a single function by resolving a Promise by the page load.