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

fp-ts-webdriver

v4.0.0

Published

[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

Downloads

7

Readme

fp-ts-webdriver

semantic-release

W3C Webdriver API, optimized for usage with fp-ts.

The goal is to be compatible with the W3C Recommendation

A webdriver sends requests and returns responses. We send a request to a driver (chromdriver, geckodriver), it opens up an instance of the browser and runs our requests in real time.

Installation

Please keep in mind that this is package is experiemental and not enough tests have been written.

# yarn
## peer dependencies
yarn add fp-ts fp-ts-std io-ts monocle-ts newtype-ts
yarn add fp-ts-webdriver@next

# npm
# peer dependencies
npm install fp-ts fp-ts-std io-ts monocle-ts newtype-ts
npm install fp-ts-webdriver@next

Usage

Exports

There is currently one named export webdriver that exports a namespace of all API's related to the basic webdriver protocol.

When more are added, they'll be available under chrome, firefox and edge respectively. These will be separated so we can have better intellicense and troubleshooting.

Example

For this examples to function, you have to turn on your webdriver. With chromedriver the command is chromedriver --port=4444


import { webdriver as WD, readerReaderTaskEither as RRTE } from "fp-ts-webdriver"
import { pipe } from "fp-ts/lib/function"
import { readerTaskEither as RTE, taskEither as TE } from "fp-ts"

const searchBar = WD.findElement("css selector", "input[name=\"q\"]")
const searchButton = WD.findElement("css selector", "input[value=\"Google Search\"]")

const program = pipe(
  WD.navigateTo("https://google.com.au"),
  RRTE.chain(() => searchBar),
  RRTE.chainFirst((element) => WD.sendKeys("dogs")(element)),
  RRTE.chain(() => searchButton)
  RRTE.chain(element => WD.elementClick(element))
)

export const capabilities: WD.Capabilities = {}

const dependencies:WD.Dependencies =  {
  url: "localhost:4444",
}

// creates a session and closes it after runnning `program`
const main = pipe(
  program, WD.runSession(capabilities)
)

// TE.TaskEither<WD.Errors, void>
main(dependencies)()

Compatibility

We have tests in chromedriver and will expand to other drivers like geckodriver when the time comes.

Need Something Now?

We're adding features as WE need them in our other projects.

If you would like something in particular, just ask! We're not taking donations at this stage.

Table

| Category | :o: | Command | | :------------------ | ------------------ | :---------------------- | | Session | :heavy_check_mark: | newSession | | | :heavy_check_mark: | deleteSession | | | :heavy_check_mark: | status | | | :heavy_check_mark: | getTimeouts | | | :heavy_check_mark: | setTimeouts | | Navigation | :heavy_check_mark: | navigateTo | | | :heavy_check_mark: | getCurrentUrl | | | :heavy_check_mark: | back | | | :heavy_check_mark: | forward | | | :heavy_check_mark: | refresh | | | :heavy_check_mark: | getTitle | | Command Contexts | :o: | getWindowHandle | | | :o: | closeWindow | | | :o: | switchToWindow | | | :o: | getWindowHandles | | | :o: | switchtoFrame | | | :o: | switchToParentFrame | | | :o: | getWindowRect | | | :o: | setWindowRect | | | :o: | maximizeWindow | | | :o: | minimizeWindow | | Element Retrieval | :heavy_check_mark: | findElement | | | :o: | findElements | | | :o: | findElementFromElement | | | :o: | findElementsFromElement | | Element State | :o: | isElementSelected | | | :heavy_check_mark: | getElementAttribute | | | :o: | getElementProperty | | | :o: | getElementCSSValue | | | :o: | getElementText | | | :o: | getElementTagName | | | :o: | getElementRect | | | :o: | isElementEnabled | | Element Interaction | :o: | elementClick | | | :o: | elementClear | | | :heavy_check_mark: | elementSendKeys | | Document Handling | :o: | getPageSource | | | :o: | executeScript | | | :o: | executeAsyncScript | | Cookies | :o: | getAllCookies | | | :o: | getNamedCookie | | | :o: | addCookie | | | :o: | deleteCookie | | | :o: | deleteAllCookies | | Actions | :heavy_check_mark: | performActions | | | :heavy_check_mark: | releaseActions | | User Prompts | :o: | dismissAlert | | | :o: | acceptAlert | | | :o: | getAlertText | | | :o: | sendAlertText | | Screen Capture | :o: | takeScreenshot | | | :o: | takeElementScreenshot |

Contributing

  • Fork and clone this repository gh repo fork waynevanson/fp-ts-webdriver --clone --remote
  • Install dependencies with yarn install
  • Ensure tests run in your environment with yarn test
    • if chromedriver does not exist, run yarn add -D chromedriver to run it's install script, where it will install chromedriver on your machine.
  • Commiting
    • Add a feature
    • Add tests
    • Change the compatibility section of readme.md under the feature name from :o: to :heavy_check_mark:
    • Commit message should be of <fix|feat|docs|build|tests>: <message>, which is used to generate a changelog.
  • Pushing
    • After all commits have been applied, rebase from the master repo with git pull --rebase.
    • Push with git push