3.0.1 • Published 3 years ago

selenium-metamask v3.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

selenium-metamask

MetaMask wrapper for selenium webdriver API

(Chrome/Firefox supported only)

Requirements

  • selenium ^4.1
  • webdriver ^4.1

Installation

npm install selenium-metamask

Implemented actions

  • Authorization
  • Importing account
  • Creation account
  • Switching account
  • Adding network
  • Switching network
  • Getting account address

Usage

import { Builder, until } from "selenium-webdriver"
import { Options } from "selenium-webdriver/chrome"
import { Loader, MetaMask } from "selenium-metamask"

async function init() {
    const builder = new Builder()
        .withCapabilities({
            'goog:chromeOptions': {
                excludeSwitches: ['enable-automation', 'useAutomationExtension'],
            },
        })
        .forBrowser('chrome')
        .usingServer('http://localhost:4444/')
    const loader = new Loader(builder)

    loader.loadChromeExtension(new Options())

    const driver = builder.build()
    const metaMask = new MetaMask(driver, until)
    const session = await metaMask.login('seed phrase')
    await session.addNetwork({
        name: 'NetworkName',
        chainIdentifier: '123',
        explorerUrl: 'https://explorer.example.com',
        rpcUrl: 'https://rpc.example.com',
        symbol: 'EXAMPLE',
    })
    await session.importAccount('private key')

    // Other tests
}
3.0.1

3 years ago

2.0.0

3 years ago

2.0.0-dev

3 years ago

1.0.0

3 years ago