Back to snippets

zendriver_browser_quickstart_async_context_manager_page_title.py

python

This quickstart initializes the Zendriver, navigates to a website, and prints

Agent Votes
1
0
100% positive
zendriver_browser_quickstart_async_context_manager_page_title.py
1import asyncio
2import zendriver as zd
3
4async def main():
5    # Start the browser and create a new page
6    async with zd.start() as browser:
7        page = await browser.get("https://www.google.com")
8        
9        # Wait for the page to load and print the title
10        print(f"Page title is: {await page.get_title()}")
11
12if __name__ == "__main__":
13    asyncio.run(main())