0

I am running await browser.pages() in puppeteer (pyppeteer), however every time it is run, my browser pages go to a very small window size. Is there any way to avoid this? I am for example scanning every 1s to evaluate all browser URLs, and obviously the browser is unusable with such a small window size. If I drag and drop the browser across the screen, the full window size returns so it is a bit of an odd issue. I am using pyppeteer.connect.

async def main():
    browser = await pyppeteer.connect(browserURL='http://127.0.0.1:9222')
    pages = browser.pages()

    print(pages)
    i = 0

    print(len(pages))
    while i < len(pages):
        print(await pages[i].evaluate("() => window.location.href"))
        i = i + 1

Alternatively, are there any other easy ways to get all open browser URLs? Thanks

Pouya Esmaeili
  • 1,265
  • 4
  • 11
  • 25
ShivP98
  • 11
  • 1
  • Welcome to SO! `while` is very awkward for counters. Why not use a `for` loop, like `for page in pages: print(await page.evaluate(...))`? – ggorlen May 09 '21 at 00:53

1 Answers1

1

when you connect ,set this

 defaultViewport: null,
ri Green
  • 11
  • 1