Skip to content

how do i get the current url of a page? #1540

@FreugdFred

Description

@FreugdFred

Your question

from playwright.sync_api import sync_playwright
import time


with sync_playwright() as plays:
    browser = plays.chromium.launch(headless=False, slow_mo=50)
    page = browser.new_page()
    page.goto('https://www.google.nl/maps')
    print(page.url())

gets me error:

TypeError: 'str' object is not callable

How do i get the current url of the page i am on?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions