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 🙏

© 2026 – Pkg Stats / Ryan Hefner

webdriver-android-helper

v0.0.6

Published

a webdriver android helper

Downloads

22

Readme

webdriver-android-helper

:black_square_button: a webdriver android helper with zero dependences

NPM

install

npm i webdriver-android-helper -S

usage

const wd = require('webdriverio')
const driver = wd.remote({})
const WdAndroidHelper = require('webdriver-android-helper')
const helper = new WdAndroidHelper(driver)

| name | desc | | - | - | |isElFinded | Determine whether an element is found | |isElsFinded | Determine whether a set of elements is found | |androidId | Generate androidId selectors for webdriver | |findElById | Find element by Android Id | |findElByXpath | Find element by Xpath | |findElsById | Find elements by Android Id | |findElsByXpath | Find elements by Xpath | |findElByIdAndClick | Find element by Android Id And Click it | |findElByXpathAndClick | Find element by Xpath And Click it | |waitElFinded | Waiting for the element to be found | |waitElsFinded | Waiting for the elements to be found | |waitActivityResumed | Waiting for the Activity Resume | |waitActivitiesResumed | Waiting for the Some Activities Resume | |waitActivityDestroy | Waiting for the Activity Destroy | |slideOnElement | Slide on element by direction | |slideOnScreen | Slide on screen by direction | |setElTextAndPressSB | set text and trigger change event on EditText | |backToActivity | Back to the designated Activity | |findElByIdAndSetText | Find element by Android Id And set text | |findElByXpathAndSetText | Find element by xpath And set text | |moment | wait for between 1s - 3s | |findElByMatcherInViews | find element in listviews by matcher function | |isThisActivity | Determine if the current activity is the specified activity | |pushImages | Push images to /sdcard/DCIM/Camera/ | |log | Append log to file |

sample

const wdio = require('webdriverio')
const WdAndroidHelper = require('webdriver-android-helper')
// sample to Init ss client
async function startSs() {
    let driver
    try {
        driver = await wdio.remote({
            port: 4723,
            capabilities: {
                "platformName": "Android",
                "platformVersion": "5",
                "deviceName": 'emulator-5554',
                "appPackage": "com.github.shadowsocks",
                "appActivity": ".MainActivity",
                "automationName": "UiAutomator2",
                "noReset": true,
                "udid": 'emulator-5554',
                "autoGrantPermissions": true,
                "systemPort": 8203
            },
            logLevel: !debug ? 'silent' : 'error'
        })
        const helper = new WdAndroidHelper(driver)
        await driver.unlock()
        // wait MainActivity
        await helper.waitActivityResumed('.MainActivity')
        await helper.moment()
        // start edit 
        await helper.findElByIdAndClick('com.github.shadowsocks:id/edit')
        await helper.moment()
        // set ip
        await helper.findElByXpathAndClick('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.View/android.widget.LinearLayout[3]/android.widget.RelativeLayout')
        await helper.moment()
        await helper.findElByIdAndSetText('android:id/edit', 'ssr ip')
        await helper.moment()
        await helper.findElByIdAndClick('android:id/button1')
        await helper.moment()
        // set port
        await helper.findElByXpathAndClick('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.View/android.widget.LinearLayout[4]/android.widget.RelativeLayout')
        await helper.moment()
        await helper.findElByIdAndSetText('android:id/edit', 'ssr port')
        await helper.moment()
        await helper.findElByIdAndClick('android:id/button1')
        await helper.moment()
        // set password
        await helper.findElByXpathAndClick('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.View/android.widget.LinearLayout[5]/android.widget.RelativeLayout/android.widget.TextView[2]')
        await helper.moment()
        await helper.findElByIdAndSetText('android:id/edit', 'ssr password')
        await helper.moment()
        await helper.findElByIdAndClick('android:id/button1')
        await helper.moment()
        // set encrypt
        await helper.findElByXpathAndClick('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.View/android.widget.FrameLayout[1]/android.widget.LinearLayout/android.widget.RelativeLayout')
        await helper.moment()
        await helper.findElByMatcherInViews('/hierarchy/android.widget.FrameLayout/android.view.View', 'android:id/text1', async (item) => {
            const text = await item.getText()
            return text === 'ssr encrypt type'.toUpperCase()
        }, async (item) => {
            await item.click()
        })
        await helper.findElByIdAndClick('com.github.shadowsocks:id/action_apply')
        await helper.waitActivityDestroy('.ProfileConfigActivity')
        await helper.moment()
        // final start
        await helper.findElByIdAndClick('com.github.shadowsocks:id/fab')
        await helper.moment(3000, 3500)
        const is = await helper.isThisActivity('.ConfirmDialog')
        if (is) {
            await helper.moment()
            await helper.findElByIdAndClick('android:id/button1')
        }
    } catch (err) {
        console.log(err)
    }
    await driver.pause(5000)
    await driver.deleteSession()
}