Error running script, how can I keep this script running

Viewed 54

can anybody help me

how to solve this error and keep the code running without

RuntimeError: Event loop is closed

enter image description here

async def main():
    async with async_playwright() as p:
        browser = await p.chromium.launch(headless=False)
        context = await browser.new_context()
        page = await context.new_page()
        locator = page.locator("text=Entrar")
        email = page.locator("")
        await page.goto('https://xxxx.com/xx/xxx/xxx')
        #await locator.click()
        #await email.fill(input("Seu email:"))
        while True:
            @client.on(events.NewMessage(idCrash))
            async def nova_mensagem(event):
                print(await event)
                print(await page.title())
            print('enrou no loop')
            await client.start()    
        
        await browser.close()
        await client.run_until_disconnected()
    
asyncio.run(main())
0 Answers
Related