npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@fnando/playwright-video

v0.0.7

Published

Run Playwright scripts and generate videos

Readme

playwright-video

Run Playwright scripts and generate videos.

Installation

npm install -g @fnando/playwright-video

Usage

playwright-video export path/to/your/script.mjs \
  --output-path path/to/output/video.mp4 \
  --state-path path/to/state.json \
  --color-scheme dark

Your script must export a run(options) function. Here's an example:

/**
 * @param  {import("@fnando/playwright-video").Utils} options Utilities
 */
export async function run({ visit, sleep, clickLink }) {
  await visit("https://nandovieira.com");
  await sleep(1000);
  await clickLink({ text: "Using PostgreSQL and jsonb with Ruby on Rails" });
  await sleep(5000);
}

Utility Functions

The options object passed to the run function includes several utility functions:

sleep(duration)

Sleep for a specified duration.

  • duration (number): Duration in milliseconds
waitUntilSatisfied(callback, timeout = 2000)

Wait until a condition is satisfied or timeout occurs.

  • callback (Function): A function that must return a truthy/falsy value
  • timeout (Number): Timeout in milliseconds (default: 2000ms)
setCursor(type)

Set the cursor type.

  • type (string): The cursor type ('default' or 'hand')
moveMouseTo(x, y, { speed = 10 })

Move mouse to specified coordinates with speed control.

  • x (number): The x-coordinate to move to
  • y (number): The y-coordinate to move to
  • speed (number): Speed of mouse movement (pixels per step)
scrollToElement({ selector, text, locator, duration = 500 })

Scroll to an element with animation.

  • selector (string): The selector of the element to scroll to
  • text (string): The text of the element to scroll to
  • locator (Locator): The locator of the element to scroll to
  • duration (number): Duration of the scroll animation in milliseconds
moveMouseToElement({ selector, text, locator, speed = 10 })

Move mouse to an element specified by selector, text or locator.

  • selector (string): The selector of the element to move to
  • text (string): The text of the element to move to
  • locator (Locator): The locator of the element to move to
  • speed (number): The speed of mouse movement (pixels per step)
clickLink({ selector, text, locator, delay, mouseSpeed = 10, scrollDuration = 500 })

Click a link specified by selector or text, scrolling to it if necessary.

  • selector (string): The selector of the element to click
  • text (string): The text of the element to click
  • locator (Locator): The locator of the element to click
  • delay (number): The delay before clicking
  • mouseSpeed (number): The speed of mouse movement
  • scrollDuration (number): The duration of the scroll animation
fillIn({ selector, text, delay = 100 })

Fill in text into an input field specified by selector.

  • selector (string): The selector of the input field
  • text (string): The text to fill in
  • delay (number): The speed of typing (delay between keystrokes)
visit(url, options)

Visit a URL with optional navigation options.

  • url (string): The URL to visit
  • options (Object): The same options as in page.goto(url, options)
exists(selector)

Check if an element exists on the page.

  • selector (string): The selector of the element to check

Returns: Promise<boolean>

Notes

  • This package patches Playwright to enable .mp4 support,
  • This package patches Playwright to enable FFMPEG_BIN and CHROME_BIN environment variables.

Maintainer

  • Nando Vieira - https://nandovieira.com

Contributors

  • https://github.com/fnando/browser/contributors

License

(The MIT License)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.