pythongoogle-chromeweb-scrapingcloudflarenodriver

Nodriver closes browser just after the start


I've got nodriver==0.46.1 And Google Chrome 136.0.7103.113 OC Fedora 42

Tried to connect to cloudflare and test verify_cf() func, but browser and program closing shortly after starting. And it's the same on every other website, not just cloudflare.

import nodriver as uc
from time import sleep

async def main():

    browser = await uc.start(headless=False)
    page = await browser.get('https://dash.cloudflare.com/login')
    await page.verify_cf()

if __name__ == '__main__':
    uc.loop().run_until_complete(main())
    sleep(2)

With asyncio.run() it works the same. It didn't even have time to load the page. In logging it just tells that nodriver successfully removed temp profile /tmp/uc_cotkkeuy and that's it. In debug logging i can't tell what it do wrong. Is there a bug? Considering that Chrome newest version come out on 21th May. Maybe it's broke something?


Solution

  • Iam able to reproduce the issue, can you pls try this configuartions?? Added some debgugging checkmarks.

    import nodriver as uc
    import asyncio
    from time import sleep
    
    async def main():
       try:
           browser = await uc.start(
               headless=False,
               sandbox=False,
               user_data_dir=None,
               args=[
                   '--no-sandbox',
                   '--disable-dev-shm-usage',
                   '--disable-gpu',
                   '--disable-features=VizDisplayCompositor',
                   '--disable-extensions',
                   '--disable-plugins',
                   '--disable-images'
               ]
           )
           
           print("Browser started successfully")
           
           page = await browser.get('https://dash.cloudflare.com/login')
           print("Page loaded")
           
           await asyncio.sleep(3)
           
           await page.verify_cf()
           print("Cloudflare verification completed")
           
           await asyncio.sleep(10)
           
       except Exception as e:
           print(f"Error occurred: {e}")
           import traceback
           traceback.print_exc()
       finally:
           try:
               await browser.quit()
           except:
               pass
    
    if __name__ == '__main__':
       asyncio.run(main())