Uses the current page’s URL as the base URL. Use when resolving URLs relative to the current page.
Examples
from typing import TypedDictfrom playwright.async_api import Pagefrom intuned_browser import resolve_urlclass Params(TypedDict): passasync def automation(page: Page, params: Params, **_kwargs): await page.goto("https://sandbox.intuned.dev/") # Resolve from the current page's URL absolute_url = await resolve_url( url="/lists/table", page=page ) # Returns: "https://sandbox.intuned.dev/lists/table" print(absolute_url) return absolute_url
Arguments
str
required
The relative or absolute URL to resolve.
Page
required
Playwright Page object to extract base URL from. The current page URL will be used as the base URL.
Converts any URL source to an absolute, properly encoded URL.
async def resolve_url( *, url: Locator,) -> str
Extracts the href attribute from a Playwright Locator pointing to an anchor element. Use when extracting and resolving URLs from anchor (<a>) elements.