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 🙏

© 2024 – Pkg Stats / Ryan Hefner

axl-browser-tools

v1.1.2

Published

* Injectable browser tools for automated testing * Works across iframes (respecting CORS) * Universally smart-finds HTML elements with single method (by querySelector, by text, by property) * Universally clicks / touches / taps found elements, or given c

Downloads

20

Readme

axl-browser-tools

  • Injectable browser tools for automated testing
  • Works across iframes (respecting CORS)
  • Universally smart-finds HTML elements with single method (by querySelector, by text, by property)
  • Universally clicks / touches / taps found elements, or given coordinates, or found element coordinates offset by percentage of its dimensions, across the window frames...
  • Collects message-events, dispatches and records macros to auto-respond to PostMessages
  • Auto-detects sub-windows / frames through DOM Mutation Observer, injects itself further
  • API for plugins
  • PIXI Crawler plugin (smart finds, clicks and returns properties of PIXI display objects by selectors)

Use it

Main library bit is to live in browser context. This one leaves in bin directory, and is result of building this project.

To be clear - this lib does not provide way to transit it to browser, as this may be implemented in verity of (more and less sophisticated) ways.

Once in browser / window context exposes API to communicate / perform / gather number of aspects.

Transit to context

At least 3 options:

  1. copy-paste contents of bin/axl-browser-tools.js or bin/axl-browser-tools-plugged.js into page's console
  2. inject it through any browser-driver (e.g. ChromeDriver) executeScript (test/toolbox/macro.js does it)
  3. (recommended) make your page loading it as a script (explicitly or through proxy injection)

Use in context

Injected script creates global object with api, which you can access from any window that axl was able to further inject itself. Things to block injection would be for instance CORS frame.

Most of API calls are performed cross-frames. That means if your page (A) has opened an iframe (B), executing window.axl.find("hello") would try to find "hello" element in both A and B windows.

window.axl = {
    click: {function(selectorConfig){}},
    find: {function(selectorConfig){}},
    msg: {
        getFirst: {function(stringToRegex){}},
        getAll: {function(stringToRegex){}},
        getOrWait: {function(stringToRegex, timeout){}},
        post: {function(messageData){}},
        postAndWait:  {function(messageData, timeout){}},
        autoRespond: {function(messagesAutoResponderData){}},
    },
  defer: {
    add:{function(checker){}},
    purgeCheckers:{function(){}},
    purgeDeferred:{function(){}},
    getDeferred:{function(){}},
  },
    info: {function},
    until: {function(conditionFn, untilConfig){}},
    _advanced: {WindowLibInstance}
}

Use it remotely

Import methods from 'axl-browser-tools' to your testing app and benefit from documented API.

Set your remote executor to communicate with window.axl API.

Example setup

import {cfg, getEvents} from "axl-browser-tools";
// setup driver (eg. chromedriver) on your own
cfg.executor = driver.executeScript.bind(driver);

const messageEvents = await getEvents(`.`);