webdriver-android-helper
🔲 a webdriver android helper with zero dependences
install
npm i webdriver-android-helper -S
usage
const wd = const driver = wdconst WdAndroidHelper = const helper = 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 = const WdAndroidHelper = // sample to Init ss client { let driver try driver = await wdio const helper = driver await driver // wait MainActivity await helper await helper // start edit await helper await helper // set ip await helper await helper await helper await helper await helper await helper // set port await helper await helper await helper await helper await helper await helper // set password await helper await helper await helper await helper await helper await helper // set encrypt await helper await helper await helper await helper await helper await helper // final start await helper await helper const is = await helper if is await helper await helper catch err console await driver await driver}