Socket
Socket
Sign inDemoInstall

@percy/selenium-webdriver

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@percy/selenium-webdriver

Selenium client library for visual testing with Percy


Version published
Weekly downloads
124K
increased by8.8%
Maintainers
1
Weekly downloads
 
Created

What is @percy/selenium-webdriver?

@percy/selenium-webdriver is an npm package that integrates Percy visual testing with Selenium WebDriver. It allows you to capture screenshots of your web application during Selenium tests and compare them against baseline images to detect visual changes.

What are @percy/selenium-webdriver's main functionalities?

Initialize Percy

This feature allows you to initialize Percy within a Selenium WebDriver test. The code sample demonstrates how to set up a Selenium WebDriver instance, navigate to a webpage, and capture a Percy snapshot.

const { Builder } = require('selenium-webdriver');
const { percySnapshot } = require('@percy/selenium-webdriver');

(async function example() {
  let driver = await new Builder().forBrowser('firefox').build();
  try {
    await driver.get('http://example.com');
    await percySnapshot(driver, 'Example Snapshot');
  } finally {
    await driver.quit();
  }
})();

Capture Multiple Snapshots

This feature allows you to capture multiple snapshots within a single test session. The code sample demonstrates navigating to different pages and capturing snapshots for each page.

const { Builder } = require('selenium-webdriver');
const { percySnapshot } = require('@percy/selenium-webdriver');

(async function example() {
  let driver = await new Builder().forBrowser('firefox').build();
  try {
    await driver.get('http://example.com/page1');
    await percySnapshot(driver, 'Page 1 Snapshot');

    await driver.get('http://example.com/page2');
    await percySnapshot(driver, 'Page 2 Snapshot');
  } finally {
    await driver.quit();
  }
})();

Custom Snapshot Options

This feature allows you to customize snapshot options such as widths and minimum height. The code sample demonstrates capturing a snapshot with specific widths and minimum height settings.

const { Builder } = require('selenium-webdriver');
const { percySnapshot } = require('@percy/selenium-webdriver');

(async function example() {
  let driver = await new Builder().forBrowser('firefox').build();
  try {
    await driver.get('http://example.com');
    await percySnapshot(driver, 'Custom Snapshot', { widths: [375, 768, 1280], minHeight: 1024 });
  } finally {
    await driver.quit();
  }
})();

Other packages similar to @percy/selenium-webdriver

Keywords

FAQs

Package last updated on 01 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc