claude-playwright
Version:
Seamless integration between Claude Code and Playwright MCP for efficient browser automation and testing
99 lines • 2.66 kB
TypeScript
import { Page, Locator } from '@playwright/test';
/**
* Base Page Object Model class
* All page objects should extend this class for consistent functionality
*/
export declare class BasePage {
readonly page: Page;
readonly baseUrl: string;
constructor(page: Page);
/**
* Navigate to a specific path
*/
navigateTo(path?: string): Promise<void>;
/**
* Navigate to the page
*/
goto(): Promise<void>;
/**
* Wait for page to be loaded
*/
waitForLoad(): Promise<void>;
/**
* Take screenshot with custom name
*/
takeScreenshot(name: string): Promise<void>;
/**
* Wait for element and click
*/
clickAndWait(selector: string): Promise<void>;
/**
* Fill multiple form fields
*/
fillForm(fields: Record<string, string>): Promise<void>;
/**
* Wait for element to be visible
*/
waitForElement(selector: string, timeout?: number): Promise<Locator>;
/**
* Check if element exists and is visible
*/
isElementVisible(selector: string): Promise<boolean>;
/**
* Get text content from element
*/
getElementText(selector: string): Promise<string>;
/**
* Expect page to have specific title
*/
expectPageTitle(title: string | RegExp): Promise<void>;
/**
* Expect page to have specific URL
*/
expectURL(url: string | RegExp): Promise<void>;
/**
* Expect element to be visible
*/
expectElementVisible(selector: string): Promise<void>;
/**
* Expect element to contain text
*/
expectElementText(selector: string, text: string | RegExp): Promise<void>;
/**
* Wait for network to be idle
*/
waitForNetworkIdle(): Promise<void>;
/**
* Reload current page
*/
reload(): Promise<void>;
/**
* Get current page URL
*/
getCurrentUrl(): string;
/**
* Check if page is loaded (abstract method for subclasses to override)
*/
isLoaded(): Promise<boolean>;
/**
* Safe click with retry logic
*/
safeClick(locator: string | Locator, retries?: number): Promise<void>;
/**
* Safe fill with clearing
*/
safeFill(locator: string | Locator, value: string): Promise<void>;
/**
* Get page title
*/
getTitle(): Promise<string>;
/**
* Wait for element to be hidden
*/
waitForHidden(locator: string | Locator, timeout?: number): Promise<void>;
/**
* Wait for element to be visible
*/
waitForVisible(locator: string | Locator, timeout?: number): Promise<void>;
}
//# sourceMappingURL=BasePage.d.ts.map