Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 1.09 KB

File metadata and controls

49 lines (35 loc) · 1.09 KB

debug.sniffer

Monitor all JavaScript properties used in a page. This plugin adds the sniffer property to the Page class, with two methods:

  • get(): get the list of properties;
  • reset(): reset the list.

This plugin is not recommended for use in production.

Options

This plugin has no option.

Example

Use the plugin.

import { chromium } from "playwright-ghost";
import plugins from "playwright-ghost/plugins";

const browser = await chromium.launch({
  plugins: [plugins.debug.sniffer()],
});
const context = await browser.newContext();
const page = await context.newPage();
await page.goto("https://www.wikipedia.org/");
console.log(page.sniffer.get());
// ...

Advanced

Import

If you want to import only this plugin, you can use the "playwright-ghost/plugins/debug/sniffer" path in the import.

import { chromium } from "playwright-ghost";
import debugSnifferPlugin from "playwright-ghost/plugins/debug/sniffer";

const browser = await chromium.launch({
  plugins: [debugSnifferPlugin()],
});
// ...