All Projects → HuddleEng → puppeteer-extensions

HuddleEng / puppeteer-extensions

Licence: MIT license
Convenience functions for the Puppeteer

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to puppeteer-extensions

webring
“วงแหวนเว็บ” แห่งนี้สร้างขึ้นเพื่อส่งเสริมให้ศิลปิน นักออกแบบ และนักพัฒนาชาวไทย สร้างเว็บไซต์ของตัวเองและแบ่งปันการเข้าชมซึ่งกันและกัน
Stars: ✭ 125 (+380.77%)
Mutual labels:  puppeteer
FlexDict
Easily work with deeply nested dictionaries and write clean code using FlexDict; a small subclass of dict. FlexDict provides automatic and arbitrary levels of nesting along with additional utility functions.
Stars: ✭ 71 (+173.08%)
Mutual labels:  utilities
Cezanne
🎣 Serverless Image Generation Function
Stars: ✭ 29 (+11.54%)
Mutual labels:  puppeteer
browser-pool
A Node.js library to easily manage and rotate a pool of web browsers, using any of the popular browser automation libraries like Puppeteer, Playwright, or SecretAgent.
Stars: ✭ 71 (+173.08%)
Mutual labels:  puppeteer
alsa-utils
The Advanced Linux Sound Architecture (ALSA) - utilities
Stars: ✭ 122 (+369.23%)
Mutual labels:  utilities
FunUtils
Some codes i wrote to help me with me with my daily errands ;)
Stars: ✭ 43 (+65.38%)
Mutual labels:  utilities
nest-puppeteer
Puppeteer (Headless Chrome) provider for Nest.js
Stars: ✭ 68 (+161.54%)
Mutual labels:  puppeteer
timestampy
🕒 Bunch of utilities useful when working with UNIX timestamps
Stars: ✭ 21 (-19.23%)
Mutual labels:  utilities
gut
🍱 yet another collection of go utilities & tools
Stars: ✭ 24 (-7.69%)
Mutual labels:  utilities
common
Utilities and base libraries for use across polkadot-js for Polkadot and Substrate. Includes base libraries, crypto helpers and cross-environment helpers. Full documentation & examples available.
Stars: ✭ 221 (+750%)
Mutual labels:  utilities
puppeteer-instaquote
Use Puppeteer to create snazzy Instagram-like quote images and memes
Stars: ✭ 20 (-23.08%)
Mutual labels:  puppeteer
slackcat
Concatenate files(s), or stdin, directly to Slack. 🐈
Stars: ✭ 19 (-26.92%)
Mutual labels:  utilities
phantom-lord
Handy API for Headless Chromium
Stars: ✭ 24 (-7.69%)
Mutual labels:  puppeteer
spider
A web spider framework
Stars: ✭ 25 (-3.85%)
Mutual labels:  puppeteer
site-audit-seo
Web service and CLI tool for SEO site audit: crawl site, lighthouse all pages, view public reports in browser. Also output to console, json, csv, xlsx, Google Drive.
Stars: ✭ 91 (+250%)
Mutual labels:  puppeteer
CircularArrays.jl
Multi-dimensional arrays with fixed size and circular indexing.
Stars: ✭ 19 (-26.92%)
Mutual labels:  utilities
MHW-Shop-Editor
Monster Hunter World Provisions Stockpile Shop Editor
Stars: ✭ 52 (+100%)
Mutual labels:  utilities
Puppeteer-IE
Headless Internet Explorer NodeJS API inspired by Puppeteer
Stars: ✭ 72 (+176.92%)
Mutual labels:  puppeteer
diamonds
A pile of shiny typed JS helpers for everyday usage
Stars: ✭ 16 (-38.46%)
Mutual labels:  utilities
Recorder
A browser extension that generates Cypress, Playwright and Puppeteer test scripts from your interactions 🖱 ⌨
Stars: ✭ 277 (+965.38%)
Mutual labels:  puppeteer

puppeteer-extensions

Build Status

This library exposes a number of convenience functions to extend Puppeteer's API, in order to make writing tests easier. The idea is that many of these functions (or similar ones) will eventually make their way into Puppeteer's own API, but this allows us to experiment with new ways of improving UI testing.

Usage

  • page Puppeteer page instance
  • timeout [Optional] Timeout for waits in milliseconds (default: 5000 ms)
const extensions = require('puppeteer-extensions')(page);
(async() {
    const listItem = '.todo-list li';
    ...
    await extensions.waitForNthSelectorAttributeValue(listItem, 1, 'class', 'completed');
})();

API

The API is split into categories to better organise the extension functions. This currently includes:

resetRequests()

Resets the requests cache used by the waits API. This should be called when you are going to navigate to another page, in order to track the new requests correctly.

Waits

waitForResource(resource, timeout=defaultTimeout)

  • resource <string> The URL of the resource (or a substring of it)
  • timeout <number> Timeout for the check

Wait for a resource request to be responded to

waitForLoadedWebFontCountToBe(count, timeout=defaultTimeout)

  • count <number> The number of web fonts to expect
  • timeout <number> Timeout for the check

Wait for a specific number of web fonts to be loaded and ready on the page

waitForFunction(fn, options, ...args)

  • fn <function> The function to execute on the page
  • options <object> Optional waiting parameters
  • args <...args> Arguments to be passed into the function

Wait for function to execute on the page (see waitForFunction)

waitUntilExistsAndVisible(selector)

  • selector <string> The selector for the element on the page

Wait until an element exists on the page and is visible (i.e. not transparent) (see waitForSelector)

waitWhileExistsAndVisible(selector)

  • selector <string> The selector for the element on the page

Wait while an element still exists on the page and is visible (i.e. not transparent) (see waitForSelector)

waitUntilSelectorHasVisibleContent(selector)

  • selector <string> The selector for the element on the page

Wait until the selector has visible content (i.e. the element takes up some width and height on the page) (i.e. not transparent)

waitWhileSelectorHasVisibleContent(selector)

  • selector <string> The selector for the element on the page

Wait while the selector has visible content (i.e. the element takes up some width and height on the page) (i.e. not transparent)

waitForNthSelectorAttribute(selector, nth, attributeName)

  • selector <string> The selector for the element on the page
  • nth <number> The nth element found by the selector
  • attributeName <string> The attribute name to look for

Wait for the nth element found from the selector has a particular attribute

waitForSelectorAttribute(selector, attributeName)

  • selector <string> The selector for the element on the page
  • attributeName <string> The attribute name to look for

Wait for the element found from the selector has a particular attribute

waitForNthSelectorAttributeValue(selector, nth, attributeName, attributeValue)

  • selector <string> The selector for the element on the page
  • nth <number> The nth element found by the selector
  • attributeName <string> The attribute name to look for
  • attributeValue <string> The attribute value to match the attributeName

Wait for the nth element found from the selector has a particular attribute value pair

waitForSelectorAttributeValue(selector, attributeName, attributeValue)

  • selector <string> The selector for the element on the page
  • attributeName <string> The attribute name to look for
  • attributeValue <string> The attribute value to match the attributeName

Wait for the element found from the selector has a particular attribute value pair

waitForElementCount(selector, expectedCount)

  • selector <string> The selector for the element on the page
  • expectedCount <number> The number of elements to expect

Wait for the element count to be a particular value

waitForDocumentTitle(title)

  • title <string> The expected title of the document

Wait for the document title to be a particular string

waitForUrl(regex)

  • regex <RegExp> The regular expression to match the URL on

Wait for the current window location to match a particular regular expression

waitFor(milliseconds)

  • milliseconds <number> The number of milliseconds to wait for

Wait for a given number of milliseconds

Retrieval

getValue(selector)

  • selector <string> The selector for the element to get the value for
  • returns <string> The value property value for the element

Get the value property value for a particular element

getText(selector)

  • selector <string> The selector for the element to get the text for
  • returns <string> The text property value for the element

Get the text property value for a particular element

getPropertyValue(selector, property)

  • selector <string> The selector for the element to get the property value for
  • property <string> The property to look for
  • returns <string> The property value for the element

Get the value of a particular property for a particular element

isElementFocused(selector)

  • selector <string> The selector of the element to check for focus state
  • returns <boolean> Whether the element is focused or not

Check if element is focused

Miscellaneous

turnOffAnimations()

Turn off CSS animations on the page to help avoid flaky visual comparisons

fastForwardTime(milliseconds)

  • milliseconds <number> The number of milliseconds to fast forward

Fast forward the current time by a given number of milliseconds

evaluate(fn, ...args)

  • fn <function> The function to execute on the page
  • args <...args> Arguments to be passed into the function

Runs a function on the page

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].