title: Testcafe client function failing "An error occurred in ClientFunction code: ReferenceError: _from2 is not defined"
body: <p>I am trying to use a client function to access the values in child elements on a page, not necessarily the ones in this example, but ones which are difficult to find with provided testcafe selectors.</p>
  
  <p>In defining a page object model I want to be able to access Next, Back and Save buttons on multiple iFrame modals, they can have different locations on the DOM depending on modal view, and do not have ids (product is an old one).</p>
  
  <p>They do however all follow a similar pattern, they would all be child elements of a span, and contain a Display text and title bearing their name, through chrome Dev Tools Console I can access them with something similar to the following </p>
  
  <pre><code>Array.from(document.querySelectorAll('span')).find(el =&gt; el.textContent === "Next")
  </code></pre>
  
  <p>However when I try to call this as a client function in testcafe I get an error, the following is an example based on my approach but against testcafe site, which gives the same error.</p>
  
  <pre><code>import { Selector } from 'testcafe';
  import { ClientFunction } from 'testcafe';
  fixture `Client Function`
  .page `https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors/functional-style-selectors.html`;
  
  const query = ClientFunction(() =&gt;  Array.from(document.querySelectorAll('a')).find(el =&gt; el.textContent === "Filter DOM Nodes"));
  
  test('Test query', async t =&gt; {
        const queryResult = await query();
        await t
        .click(Selector(queryResult))
        .wait(1500);
  });
  </code></pre>
  
  <p>The error this gives is rather cryptic to me: </p>
  
  <pre><code>  1) An error occurred in ClientFunction code:
  
        ReferenceError: _from2 is not defined
  
        Browser: Chrome 71.0.3578 / Mac OS X 10.13.6
  
            6 |    .page
  
     `https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors/functional-style-selectors.html`;
            7 |
            8 |const query = ClientFunction(() =&gt;
        Array.from(document.querySelectorAll('a')).find(el =&gt; el.textContent
        === "Filter DOM Nodes"));
            9 |
           10 |test('Login and register user', async t =&gt; {
         &gt; 11 |      const queryResult = await query();
           12 |      await t
           13 |      .click(Selector(queryResult))
           14 |      .wait(1500);
           15 |});
           16 |
  
           at query (/Users/david/Documents/testcafe/demo/query.js:11:33)
           at test (/Users/david/Documents/testcafe/demo/query.js:10:1)
           at markeredfn
  
     (/usr/local/lib/node_modules/testcafe/src/api/wrap-test-function.js:17:28)
           at &lt;anonymous&gt;
        (/usr/local/lib/node_modules/testcafe/src/api/wrap-test-function.js:7:5)
           at fn
        (/usr/local/lib/node_modules/testcafe/src/test-run/index.js:239:19)
           at TestRun._executeTestFn
        (/usr/local/lib/node_modules/testcafe/src/test-run/index.js:235:38)
           at _executeTestFn
        (/usr/local/lib/node_modules/testcafe/src/test-run/index.js:284:24)
  
  
  
   1/1 failed (5s)
  </code></pre>
  
  <p>Does anyone know if this is a legitimate bug or an implementation error? Thanks - any pointers greatly welcome too!</p>