> ## Documentation Index
> Fetch the complete documentation index at: https://intunedhq.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# resolveUrl

> [!NOTE]
>
> This function has multiple overloads

> [tab] Base URL String
>
> Converts any URL source to an absolute, properly encoded URL.
>
> ```typescript theme={null}
> export declare function resolveUrl(input: {
>   url: string;
>   baseUrl: string;
> }): Promise<string>;
> ```
>
> Combines a relative URL with a base URL string. Use when you have an explicit base URL string to resolve relative paths against.
>
> ## Examples
>
> ```typescript Resolve from Base URL String theme={null}
> import { resolveUrl } from "@intuned/browser";
> import { BrowserContext, Page } from "playwright";
>
> interface Params {}
>
> export default async function handler(
>   params: Params,
>   page: Page,
>   context: BrowserContext
> ) {
>   // Resolve from base URL string
>   const absoluteUrl = await resolveUrl({
>     url: "/lists/table",
>     baseUrl: "https://sandbox.intuned.dev",
>   });
>   // Returns: "https://sandbox.intuned.dev/lists/table"
>   console.log(absoluteUrl);
>   return absoluteUrl;
> }
> ```
>
> ## Arguments
>
> **input** `Object` *required*
>
> Configuration object with different properties based on the overload
>
> **properties**
>
> **input.url** `string` *required*
>
> The relative or absolute URL to resolve
>
> **input.baseUrl** `string` *required*
>
> Base URL string to resolve relative URLs against

> [tab] Current Page's URL
>
> Converts any URL source to an absolute, properly encoded URL.
>
> ```typescript theme={null}
> export declare function resolveUrl(input: {
>   url: string;
>   page: Page;
> }): Promise<string>;
> ```
>
> Uses the current page's URL as the base URL. Use when resolving URLs relative to the current page.
>
> ## Examples
>
> ```typescript Resolve from the Current Page's URL theme={null}
> import { resolveUrl } from "@intuned/browser";
> import { BrowserContext, Page } from "playwright";
>
> interface Params {}
>
> export default async function handler(
>   params: Params,
>   page: Page,
>   context: BrowserContext
> ) {
>   await page.goto("https://sandbox.intuned.dev/");
>   // Resolve from the current page's URL
>   const absoluteUrl = await resolveUrl({
>     url: "/lists/table",
>     page: page,
>   });
>   // Returns: "https://sandbox.intuned.dev/lists/table"
>   console.log(absoluteUrl);
>   return absoluteUrl;
> }
> ```
>
> ## Arguments
>
> **input** `Object` *required*
>
> Configuration object with different properties based on the overload
>
> **properties**
>
> **input.url** `string` *required*
>
> The relative or absolute URL to resolve
>
> **input.page** `Page` *required*
>
> Playwright Page object to extract base URL from. The current page URL will be used as the base URL

> [tab] Anchor Elements
>
> Converts any URL source to an absolute, properly encoded URL.
>
> ```typescript theme={null}
> export declare function resolveUrl(input: { url: Locator }): Promise<string>;
> ```
>
> Extracts the href attribute from a Playwright Locator pointing to an anchor element. Use when extracting and resolving URLs from anchor (`<a>`) elements.
>
> ## Examples
>
> ```typescript Resolve from Anchor Element theme={null}
> import { resolveUrl } from "@intuned/browser";
> import { BrowserContext, Page } from "playwright";
>
> interface Params {}
>
> export default async function handler(
>   params: Params,
>   page: Page,
>   context: BrowserContext
> ) {
>   await page.goto("https://sandbox.intuned.dev/");
>   // Resolve from Anchor Element
>   const absoluteUrl = await resolveUrl({
>     url: page.locator("xpath=//a[normalize-space()='Steps Form']"),
>   });
>   // Returns: "https://sandbox.intuned.dev/steps-form"
>   console.log(absoluteUrl);
>   return absoluteUrl;
> }
> ```
>
> ## Arguments
>
> **input** `Object` *required*
>
> Configuration object with different properties based on the overload
>
> **properties**
>
> **input.url** `Locator` *required*
>
> Playwright Locator pointing to an anchor element. The href attribute will be extracted and resolved relative to the current page.

## Returns: `Promise<string>`

Promise that resolves to the absolute, properly encoded URL string


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.