Socket
Socket
Sign inDemoInstall

appium-dom-utils

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appium-dom-utils

Appium utils implemented with DOM


Version published
Weekly downloads
248
decreased by-48.33%
Maintainers
1
Weekly downloads
 
Created
Source

Installation

NPM Version NPM DownloadsLicense

npm i -S appium-dom-utils

appium-dom-utils

A collection of util functions for writing Appium tests using DOM API.

const {
  parseDomFromString,
  getXPathSelector,
} = require('appium-dom-utils');
const wdio = require("webdriverio");

const client = await webdriverio.remote(opts);
const xmlSourceString = await client.getPageSource();
const dom = parseDomFromString(xmlSourceString);
const domElement = dom.querySelector("[text*='9']");
const xpath = getXPathSelector(domElement);
const appiumElement = await client.$(xpath);
await appiumElement.click();
await client.deleteSession();

API

parseDomFromString(xml: String)

Returns a DOM object. Throws when the xml string is not formatted well. Currently tested with the return value of driver.getPageSource() for both Android (UiAutomator2) and iOS (UIAutomation) tests.

import { parseDomFromString } from 'appium-dom-utils';
parseDomFromString(xmlString);

getXPathSelector(el: Element)

Returns the xpath (string) for the element supplied. [Android UiAutomator2 tests].

import { getXPathSelector } from 'appium-dom-utils';
getXPathSelector(element);

getClassChainSelector(el: Element)

Returns the class chain (string) for the element supplied. [iOS UIAutomation tests].

import { getClassChainSelector } from 'appium-dom-utils';
getClassChainSelector(element);

Keywords

FAQs

Package last updated on 25 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc