async def resolve_url(
*,
url: str,
base_url: str,
) -> str
Converts any URL source to an absolute, properly encoded URL by combining a relative URL with a base URL string.Examples
from intuned_browser import resolve_url
async def automation(page, params, **_kwargs):
# Using explicit base URL
absolute_url = await resolve_url(
url="/api/users",
base_url="https://example.com"
)
# Returns: "https://example.com/api/users"
Arguments
The relative or absolute URL to resolve.
Base URL string to resolve relative URLs against.
Returns: str
The absolute, properly encoded URL stringasync def resolve_url(
*,
url: str,
page: Page,
) -> str
Converts any URL source to an absolute, properly encoded URL by using the current page’s URL as the base URL.Examples
from intuned_browser import resolve_url
async def automation(page, params, **_kwargs):
await page.goto("https://example.com")
absolute_url = await resolve_url(
url="/api/users",
page=page
)
# Returns: "https://example.com/api/users"
Arguments
The relative or absolute URL to resolve.
Playwright Page object to extract base URL from. The current page URL will be used as the base URL.
Returns: str
The absolute, properly encoded URL stringasync def resolve_url(
*,
url: Locator,
) -> str
Converts any URL source to an absolute, properly encoded URL by extracting the href attribute from a Playwright Locator pointing to an anchor element.Examples
from intuned_browser import resolve_url
async def automation(page, params, **_kwargs):
await page.goto("https://sandbox.intuned.dev/")
absolute_url = await resolve_url(
url=page.locator("xpath=//a[normalize-space()='Steps Form']"),
)
# Returns: "https://sandbox.intuned.dev/steps-form"
Arguments
Playwright Locator pointing to an anchor element. The href attribute will be extracted and resolved.
Returns: str
The absolute, properly encoded URL string