<p><strong>Can you please explain more about your use-case?</strong> </p>

<p>"Introduction to OXPath" document provided in your question is not available anymore. This could be because a more recent version have been released in 2018. </p>

<p>Please see here: <a href="https://arxiv.org/pdf/1806.10899.pdf" rel="nofollow noreferrer">https://arxiv.org/pdf/1806.10899.pdf</a></p>

<p>Referring to this document, in section 3.7, page 43 reads: </p>

<blockquote>
<pre><code>Different components of OXPath are united under the umbrella name OXPath Project.
The current version of OXPath (2.2.0) and OXPath CLI (1.0.1) are generated by OXPath
Project 1.0.3. It consists of the following main components:
OXPath Core (v.2.2.0) implementing the core functionality of the OXPath language.
WebAPI (v.1.4.0) implementing an interface to web browsers based on Selenium 2.53.1
(only Firefox 47.0.1 is currently supported).
Output Handlers are a set of modules for serialising the output tree of OXPath into
different formats. The following output handlers are available: XMLOutputHandler
for XML (see Section 1.3.1 on page 13), JsonOutputHandler for JSON (see Section 1.3.2 on page 13), RecStreamCSVOutputHandler for rscsv
</code></pre>
  
  <p>(see Section 1.3.3
      on page 14), HierarchyCSVOutputHandler for hcsv,
      RecStreamJDBCOutputHandler for rsjdbc (see Section 1.3.4 on page 16), and
      HierarchyJDBCOutputHandler for hjdbc.
      OXPath CLI (v.1.0.1) is a command line interface for OXPath.
      Java documentation API is available at <a href="https://oxpath.github.io/api-docs/1.0" rel="nofollow noreferrer">https://oxpath.github.io/api-docs/1.0</a>.
      3/javadoc/.</p>
</blockquote>

<p>I don't think there is a Javascript API currently, but they could be referring to the fact that you can use java classes into javascript. See here: <a href="https://stackoverflow.com/questions/24577613/use-a-jar-in-javascript-through-java-scriptengine">Use a jar in JavaScript through Java ScriptEngine</a></p>

<p>However, considering that the underlaying engine relies on selenium opening a browser and navigating the various URL's in your OXPath query, even when using X video frame buffer, <strong>OXPath would be unusable in any client code environment</strong> </p>
Load external resource/API
<p>I have a lib, which has a API available under <code>uk.ac.ox.cs.diadem.oxpath.oxpath-example</code></p>

<p>In java I would use it like so</p>

<p><code>// load from API
package uk.ac.ox.cs.diadem.oxpath.oxpath-example;
// invoke OXPath
OXPath.ENGINE.evaluate(input, browser, outputHandler);</code></p>

<p>The complete documentation can be found <a href="http://www.oxpath.org/papers/2017-IntroductionToOxpath-ed1.pdf" rel="nofollow noreferrer">here</a>. Page 30 (last paragraph before section 3.2) says I can embed it in JavaScript, but there is only a java example.</p>

<p>How can I load OXPath into a JavaScript project?</p>

<p>EDIT</p>

<p>I have tried this:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var oxpath = require("uk.ac.ox.cs.diadem.oxpath"); // error</code></pre>
</div>
</div>
</p>

<p>But it throws an error:</p>

<pre><code>Error: Cannot find module 'uk.ac.ox.cs.diadem.oxpath'
</code></pre>