- From Base URL String
- From The Current Page's URL
- From Anchor Element
Copy
Ask AI
export declare function resolveUrl(input: {
url: string;
baseUrl: string;
}): Promise<string>;
Examples
Copy
Ask AI
import { resolveUrl } from '@intuned/browser';
export default async function handler(params, page, context){
await page.goto("https://example.com");
// Using explicit base URL
const absoluteUrl = await resolveUrl({
url: "/api/users",
baseUrl: "https://example.com"
});
// Returns: "https://example.com/api/users"
}
Arguments
Returns: Promise<string>
Promise that resolves to the absolute, properly encoded URL stringCopy
Ask AI
export declare function resolveUrl(input: {
url: string;
page: Page;
}): Promise<string>;
Examples
Copy
Ask AI
import { resolveUrl } from '@intuned/browser';
export default async function handler(params, page, context){
await page.goto("https://example.com");
// Using current page as base URL
const absoluteUrl = await resolveUrl({
url: "/api/users",
page: page
});
// Returns: "https://example.com/api/users"
}
Arguments
Returns: Promise<string>
Promise that resolves to the absolute, properly encoded URL stringCopy
Ask AI
export declare function resolveUrl(input: { url: Locator }): Promise<string>;
Examples
Copy
Ask AI
import { resolveUrl } from '@intuned/browser';
export default async function handler(params, page, context){
await page.goto("https://sandbox.intuned.dev/");
const absoluteUrl = await resolveUrl({
url: page.locator("xpath=//a[normalize-space()='Steps Form']"),
});
// Returns: "https://sandbox.intuned.dev/steps-form"
}
Arguments
Configuration object with different properties based on the overload
Show input
Show input
Playwright Locator pointing to an anchor element. The href attribute will be extracted and resolved