xpath-query

Create Xpath query in javascript

Usage no npm install needed!

<script type="module">
  import xpathQuery from 'https://cdn.skypack.dev/xpath-query';
</script>

README

xpath-query

Create Xpath query in javascript

travis npm david-dm

Install

Run

$ npm test
$ npm run build
$ npm run lint

API

  • tag
  • findByText
  • findByTextContent
  • following
  • select
  • first
  • last
  • all
  • attribute
  • custom

Demo

import XpathUtils from '../src/index'
  
const Xpath = new XpathUtils()

const request = Xpath.request()
    .tag(['input', 'span'])
    .tag(['h1', 'h2', 'h3'])
    .done()

// result '//input/h1 | //input/h2 | //input/h3 | //span/h1 | //span/h2 | //span/h3'