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

appium-repl

v1.0.1

Published

Simple REPL (Read-eval-print Loop) for controlling mobile apps through Appium

Downloads

11

Readme

Appium-REPL

Simple REPL (Read-eval-print Loop) for controlling mobile apps through Appium

Why?

wd, or Web Driver/Selenium 2 Client, already contains a REPL detailed here however it requires some tedious boilerplate in order to get into useful REPL operations. This package aims to allow you to bypass that initial effort and get right into a meaningful REPL context.

Getting Started

npm install appium-repl -g to install this module globally

Before Use

Create a .appium-repl.json where ever you intend to execute appium-repl from. This could be inside a project and then kept under your own version control for other developers to use.

Example .appium-repl.json

{
  "TestApp1" :
    {
      "deviceName": "iPhone Simulator",
      "app": "./path/from/execution/to/your/deployable.app",
      "platformVersion": "10.1",
      "newCommandTimeout": 100000,
      "autoLaunch" : "true",
      "platformName":"iOS",
      "device": "iPhone 6s"
    }
}

See more examples in the sample-appium-repl.json file.

Putting it all together

  1. npm install -g appium-repl
  2. create your configuration .appium-repl.json
  3. run the appium server
  • find appium here
  • ensure that you have the appropriate XCode/Android SDKs installed
  • run it, consult appium's documentation if any issues occur
  1. run appium-repl
  2. choose your configuration option (.appium-repl.json can have any number of defined configurations)
  3. access driver directly from the REPL. refer to wd docs for relevant methods
  4. profit?

Example REPL activity (with a Cordova App)

Comments and newlines added for readability

// See all contexts in the app under test
>>driver.contexts()
 > CALL contexts()
 > RESPONSE contexts() ["NATIVE_APP","WEBVIEW_56394.1"]
[ 'NATIVE_APP', 'WEBVIEW_56394.1' ]

// Set the context
>>driver.context('WEBVIEW_56394.1');
 > CALL context("WEBVIEW_56394.1")
 > RESPONSE context("WEBVIEW_56394.1")
undefined

// Find an element
>>driver.elementById('dashboard-login-button')
 > CALL elementById("dashboard-login-button")
 > RESPONSE elementById("dashboard-login-button") {"ELEMENT":"5000"}
Element {
  value: '5000',
  browser:
   EventEmitter {
     domain: null,
     _events: { status: [Function], command: [Function] },
     _eventsCount: 2,
     _maxListeners: undefined,
     configUrl:
      Url {
        protocol: 'http:',
        slashes: true,
        auth: null,
        host: 'localhost:4723',
        port: '4723',
        hostname: 'localhost',
        hash: null,
        search: '',
        query: {},
        pathname: '/wd/hub',
        path: '/wd/hub',
        href: 'http://localhost:4723/wd/hub' },
     sauceTestPageRoot: 'https://saucelabs.com/jobs',
     sauceRestRoot: 'https://saucelabs.com/rest/v1',
     noAuthConfigUrl:
      Url {
        protocol: 'http:',
        slashes: true,
        host: 'localhost:4723',
        port: '4723',
        hostname: 'localhost',
        hash: null,
        search: null,
        query: null,
        pathname: '/wd/hub',
        path: '/wd/hub',
        href: 'http://localhost:4723/wd/hub' },
     defaultCapabilities:
      { browserName: 'firefox',
        version: '',
        javascriptEnabled: true,
        platform: 'ANY' },
     _httpConfig:
      { timeout: undefined,
        retries: 3,
        retryDelay: 15,
        baseUrl: undefined,
        proxy: undefined },
     sessionID: '5ea660da-0541-407c-91cc-f1fa32cf9421' } }
>>

If you press tab it will show you all possible options that are available. If a driver command returns a array then current would become an array.

Async/Await: Run this package with the newest version of node.js and add the --experimental-repl-await flag to use await in the repl: node --experimental-repl-await .