Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.
This repository was archived by the owner on Nov 24, 2018. It is now read-only.

Unable to handle errors with try/catch #279

@just-boris

Description

@just-boris

I have the following code (same in playground)

try {
  await chromeless.goto('https://www.graph.cool')
  await chromeless.click('.no-such-selector')
} catch(e) {
  console.log('Failed to click an element')
  const screenshot = await chromeless.screenshot()
  console.log(screenshot)
}
await chromeless.end()

When element is not found on the page, I expect an Exception to be thrown, that I can handle in catch and make a screenshot. But instead I am seeing an globally thrown error Error: wait(".no-such-selector") timed out after 10000ms that I cannot catch.

How should I handle such case and dump screenshot of the page, if anything goes 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