A
A
adrenalinruslan2019-06-04 16:38:48
JavaScript
adrenalinruslan, 2019-06-04 16:38:48

Nightmare forced to stop?

I have code like this how to stop running when

if(window.document.querySelector('#validate') === null)

nightmare.goto('https://').wait(2000)
  .evaluate(() => {
    if(window.document.querySelector('#validate') === null)
    {
      return this.end();
    }
  })
  .type('#validateInput', 'Hello World!')
  .click('#validateButton')
  .wait(2000)
  .end()
  .catch(e => {
    console.error(e);
  });

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question