CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-puppeteer-core

A high-level API to control headless Chrome and Firefox browsers over the DevTools Protocol and WebDriver BiDi

94

1.02x
Overview
Eval results
Files

task.mdevals/scenario-4/

Browser Window Controller

A utility that controls browser window positioning and sizing.

Capabilities

Window bounds management

  • It retrieves the current window bounds (position and size) @test
  • It sets the window position to specified coordinates @test
  • It sets the window size to specified dimensions @test

Implementation

@generates

API

/**
 * Creates a new browser window controller instance.
 *
 * @returns {Promise<WindowController>} A window controller instance
 */
async function createWindowController() {
  // IMPLEMENTATION HERE
}

/**
 * WindowController class that provides methods to control browser window bounds.
 */
class WindowController {
  /**
   * Gets the current window bounds (position and size).
   *
   * @returns {Promise<{left: number, top: number, width: number, height: number}>} The current window bounds
   */
  async getWindowBounds() {
    // IMPLEMENTATION HERE
  }

  /**
   * Sets the window position to the specified coordinates.
   *
   * @param {number} x - The x-coordinate in pixels
   * @param {number} y - The y-coordinate in pixels
   * @returns {Promise<void>}
   */
  async setWindowPosition(x, y) {
    // IMPLEMENTATION HERE
  }

  /**
   * Sets the window size to the specified dimensions.
   *
   * @param {number} width - The window width in pixels
   * @param {number} height - The window height in pixels
   * @returns {Promise<void>}
   */
  async setWindowSize(width, height) {
    // IMPLEMENTATION HERE
  }

  /**
   * Closes the browser and cleans up resources.
   *
   * @returns {Promise<void>}
   */
  async close() {
    // IMPLEMENTATION HERE
  }
}

module.exports = {
  createWindowController,
  WindowController
};

Dependencies { .dependencies }

puppeteer-core { .dependency }

Provides browser automation capabilities including window bounds management.

Install with Tessl CLI

npx tessl i tessl/npm-puppeteer-core

tile.json