jeudi 25 octobre 2018

Nightwatch - How to determine if scroll top button has worked?

Anyone know how to check if a scroll top button has worked well and the current position of the scroll is 0 to top?

I have tried a lot of nightwatch functions and none of them has worked well.

My current code is this:

'Homepage - ScrollTop' : function(browser) {
    browser
      .url('https://prueba.com')
      .waitForElementPresent('body', 1000, 'Page completely loaded')
      .moveToElement('footer', 10, 10).pause(1000)
      .assert.visible('.scroll_top', 'ScrollTop button is visible')
      .assert.cssClassPresent('.scroll_top', "in")
      .click('#cookie-bar .cerrar').pause(1000)
      .click('.scroll_top').pause(1000)
      .element('css selector', '#cars_header', function(result){
        console.log(result)
        // This is not working
        if (result.value && result.value.ELEMENT) {
          // Element is present, do the appropriate tests
        } else {
          // Element is not present.
        }
      })
      .end()
  }

Aucun commentaire:

Enregistrer un commentaire