Skip to content

Not possible to read value returned from Chromy #593

@VladimirPittner

Description

@VladimirPittner

Hi,
according to Chromy documentation, something like this should be possible:

const Chromy = require('chromy')

async function main () {
  let chromy = new Chromy()
  await chromy.goto('http://example.com/')
  const result = await chromy.evaluate(() => {
          return document.querySelectorAll('*').length
        })
  console.log(result)
  await chromy.close()
}

main()

Therefor I would expect something like this should be possible within BackstopJs:

async function myFunction(chromy, scenario, vp) {


    const result = await chromy.evaluate(() => {
        return document.querySelectorAll('*').length
    })
    console.log(result)

};

module.exports = myFunction;

But I am getting this error:

(node:15120) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: 'then' is not defined on a target object.
(node:15120) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Any idea what I might doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions