2021-01-30

Pyppeteer Not Going to Link

Using Python 3.8 I am trying to scrape a page with Pyppeteer. This code works on a different computer but not the current desktop I am running it on.

My code is:

async def main():
    # launches a chromium browser, can use chrome instead of chromium as well.
    browser = await pyppeteer.launch(headless=False)
    # creates a blank page
    page = await browser.newPage()

    # follows to the requested page and runs the dynamic code on the site.
    options = {'timeout': 15000}
    await page.goto('link', options)
    # provides the html content of the page
    cont = await page.content()
    await page.close()
    await browser.close()
    return cont

# stores the html code
page=(asyncio.get_event_loop().run_until_complete(main()))

When I run this it opens a Chromium browser but does not try to load the link. It sits on a tab that says "about:blank". If i manually put in a link it goes to the page, but still does not pull the html code.

I also tried running this with Chrome in case the issue was Chromium but the same thing happened. This leads me to believe that it is an issue with my code, but yet it runs fine on a different desktop so I cannot solve what the issue is.

Solved

nest_asyncio was updated from 1.4.2 to 1.4.3



from Recent Questions - Stack Overflow https://ift.tt/2YtqHSs
https://ift.tt/eA8V8J

No comments:

Post a Comment