question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PagesAsync does not return current list of pages after opened a new tab

See original GitHub issue

PagesAsync always return only two tabs from following code, if a user clicked a link and opens a new tab, the new tab does not appear from PagesAsync. issue occur when there is an infinite loop

in actual project, I am experiencing this issue after I executed some JS code to click a link and wait for a new page to appear in a loop by polling with PagesAsync

is this a bug or am I doing something wrong?

Code to reproduce:

            var browser = await Puppeteer.LaunchAsync(new LaunchOptions
            {
                Headless = false,
                DefaultViewport = null
            });
            var page = await browser.NewPageAsync();
            await page.GoToAsync("https://github.com/");

            for (; ; )
            {
                var res = await browser.PagesAsync();
                int xxxx = 0;//make a breakpoint here and see res from debugger
            }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
RileyCodescommented, Nov 21, 2020

a strange workaround would be add another await operation before PagesAsync

works just fine:

                var ver = await browser.GetVersionAsync();
                var pages = await browser.PagesAsync();
0reactions
kblokcommented, Jul 3, 2021

Closed due to inactivity. Feel free to reopen it if needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Puppeteer detect when the new tab is opened and get ...
This code will catch the new page in a new tab if it was opened by clicking a link in the original page....
Read more >
Emit new Page objects when new tabs created · Issue #386
I see it's returning a target object, but I actually can't figure out from the API or logging it what that actually is....
Read more >
Use PuppeteerSharp.Browser.PagesAsync in Puppeteer- ...
Use the PagesAsync method in PuppeteerSharp package in your next Puppeteer-sharp project with LambdaTest Automation Testing Advisor.
Read more >
How to get new tab/link opened on the right of the current ...
It is possible to select the tab opening position, the new tab behavior and the behavior after closing a tab in the Chrome...
Read more >
When I open a new tab, the address area populates with ...
When ever I open a new tab in Firefox, this address populates the address ... The page does NOT LOAD, it just populates...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found