Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Use driver.current_url with Selenium or page.url with Playwright. Both are Python properties that return the current URL as a string—read them without parentheses. After an action that navigates, synchronize with the navigation before relying on the value.
Choose the property for your Python browser framework
| Framework | Property | What it reads | How to use it |
|---|---|---|---|
| Selenium | driver.current_url |
The URL in the WebDriver’s current browsing context. | Read it directly; the property access itself is ordinary Python access. |
| Playwright | page.url |
The URL for the particular Page object, corresponding to a tab or popup. |
Read it directly, including in asynchronous code; await the browser operations, not the property. |
Use the accessor for the framework already in your project. They address the same basic need, but their objects differ: Selenium’s driver represents its current browsing context, while Playwright’s page variable identifies a particular page. The Selenium Python example and API reference describe driver.current_url as the current page URL; the Playwright Python Pages guide demonstrates page.url and describes a page as a tab or popup.
Read the current URL with Selenium
After navigating, access current_url on the WebDriver instance. The following example navigates to a page, prints the resulting URL, and closes the driver:
from selenium import webdriver
driver = webdriver.Chrome()
try:
driver.get("https://example.com")
current_url = driver.current_url
print(current_url)
finally:
driver.quit()
driver.current_url is a string property, not a method. Store it in a variable if later code needs the value, or pass it directly to a function that accepts a string. A common mistake is writing driver.current_url(); that attempts to call the returned string rather than read the property.
#1 Best Overall
The code uses the Selenium Python WebDriver pattern shown in Selenium’s official documentation. The browser driver must be available to the environment running the script; this example assumes Chrome can be launched in that environment. It does not wait for a particular URL beyond the navigation call. If your next operation depends on a navigation caused by a click or another action, use the appropriate synchronization for that navigation before reading the URL.
Read the current URL with Playwright
Synchronous Python
In Playwright’s synchronous API, read page.url after navigating:
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
try:
page = browser.new_page()
page.goto("https://example.com")
current_url = page.url
print(current_url)
finally:
browser.close()
Asynchronous Python
The asynchronous API uses the same property. Await the asynchronous navigation and other asynchronous browser operations, then read page.url directly—there is no await and no parentheses on the property:
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #2
import asyncio
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch()
try:
page = await browser.new_page()
await page.goto("https://example.com")
current_url = page.url
print(current_url)
finally:
await browser.close()
asyncio.run(main())
These examples use Playwright’s documented Python sync and async patterns. The value belongs to the specific Page instance you read; keeping track of which page variable your code is using is essential when a context has more than one page.
Read the right URL after navigation
A URL can update when navigation is committed, before the page has finished loading. Playwright’s navigation guidance distinguishes that URL update from completion of the full load. If a subsequent assertion or operation requires a specific destination, synchronize against the expected URL rather than assuming the page is fully loaded just because page.url has changed.
For Playwright, the documented URL-waiting method is page.wait_for_url(...). For example, wait for the address expected from the action before reading the property:
Rank #3
# After setting up page and before triggering the navigation:
page.wait_for_url("**/account")
page.get_by_role("link", name="Account").click()
current_url = page.url
Place the wait around the action that triggers navigation using the synchronization pattern appropriate to your flow; the snippet illustrates the URL pattern, not a universal locator or destination. Use the actual expected URL pattern for the page under test. For Selenium, the essential point is the same: do not consume the value until the navigation your next step depends on has occurred. The exact wait condition depends on your test and is not implied by reading driver.current_url.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Reading the property answers “what URL is current now?” It does not by itself establish that every resource has loaded, that a particular page state is ready, or that the URL will remain unchanged. Choose a wait based on what the next action needs: the destination URL, or a later page condition.
Handle multiple tabs and popups in Playwright
Because Playwright’s page.url is tied to one Page, the variable matters. If a link opens a popup or your code creates another page, reading the original page’s property continues to report that original page’s URL. Read the URL from the Page object representing the tab or popup you mean to inspect.
Rank #4
Before debugging a surprising value, check which page object the variable refers to and whether your flow has switched to a new page. The property is not a browser-wide “active tab” lookup; it is a read from the particular Playwright page object. In Selenium, by contrast, the documented accessor is on the WebDriver’s current browsing context.
Common mistakes and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
TypeError after trying to call the URL |
The property was written with parentheses, as in page.url() or driver.current_url(). |
Remove the parentheses: use page.url or driver.current_url. |
| The value is the old address after a click | The code read the property before the navigation was committed or synchronized. | Wait for the expected navigation or URL before consuming the value. |
| The value is for a different tab than expected in Playwright | The variable refers to another Page object. |
Identify and read the page object for the intended tab or popup. |
| The URL changed, but the page is not ready for the next step | URL commitment and full page loading are distinct milestones. | Wait for the URL and, when needed, the page condition that the next operation depends on. |
Or skip the browser setup
If you already have a browser session and need its current URL, use the Selenium or Playwright property above: a screenshot API does not read the URL from that existing session. If your actual goal is to capture a webpage by URL rather than inspect an open browser, ScreenshotNeo offers a one-request screenshot API:
ScreenshotNeo API documentation
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and whether the request was billed. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots.
Sign up for 1,000 free screenshots a month—no card required.
Best Value
FAQ
Do I need a commercial product to read a URL from Python?
No. In Selenium or Playwright, the URL is available as a property on the browser automation object you already use.
Does reading the URL prove a page passed a bot check?
No. These properties report the current address; they do not establish why a page loaded, whether it passed a check, or whether its content is ready.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

