I want to return the current url of a web browser in python. I have come from this link Get current URL from browser using python but has not solved my problem.
I have the following:
import asyncio
from pyppeteer import launch
async def main():
browser = await launch()
page = await browser.newPage()
# Get the URL and print it
link = await page.evaluate("() => window.location.href")
print(link)
# Cleanuip
await browser.close()
asyncio.get_event_loop().run_until_complete(main())
But this gives me output as:
about:blank
Any suggestions how to get the current browsers url form where it is opened?