@pierrad/web-carbon-analyzer
Version:
A tool to measure the carbon footprint of websites using CO2.js
33 lines (32 loc) • 1.03 kB
TypeScript
/**
* Browser Controller module
* Manages Playwright browser lifecycle and page navigation
*/
import * as playwright from 'playwright';
import { BrowserConfig, UserBehaviorConfig } from '../types';
declare class BrowserController {
private config;
private browser;
private context;
private page;
constructor(customConfig?: Partial<BrowserConfig>);
/**
* Launch the browser and create a new context
*/
launch(): Promise<playwright.Page>;
/**
* Navigate to a URL and wait for the page to load
* @param {string} url - The URL to navigate to
*/
navigateTo(url: string): Promise<playwright.Response | null>;
/**
* Simulate user scrolling behavior to trigger lazy loading
* @param {UserBehaviorConfig} userBehaviorConfig - Configuration for scrolling behavior
*/
simulateUserBehavior(userBehaviorConfig?: UserBehaviorConfig): Promise<void>;
/**
* Close the browser
*/
close(): Promise<void>;
}
export default BrowserController;