-1

I have encountered the following error while testing using nightwatch.

Expected element to be visible - element was not found - expected "visible" but got: "not found"

I have following two files:-

page-object model(simpleLogin.js)

module.exports = {
  url: 'http://google.com',
 sections :{
  google: {
   selector:'div#fkbx',
    elements: {
     searchBar :{
      selector : 'input[type=text]'
     },
     
     searchButton :{
      selector : 'button[name=btnG]'
     },
    }
  }
 }
};

the test js

module.exports = {
  'Test': function (client) {
    var homepage = client.page.simpleLogin();
 homepage.navigate()
 homepage.expect.section('@google').to.be.visible;
    var googleSection = homepage.section.google;
 client.end();
  }
};

Can anybody help me resolve this issue?

Paolo Forgia
  • 5,804
  • 7
  • 39
  • 55

1 Answers1

0

Try it with the following code and let me know if it is working:

module.exports = {
url: 'http://google.com',
sections: {

google: {

  selector: 'div#fkbx',

  elements: {
    searchBar: {
      selector: 'input[type=text]',
    },
    searchButton: {
      selector: 'button[name=btnG]',
    },
   },
  },
 },
};

Also, please take a look at this link to see if it can help you a bit.

timetraveler90
  • 168
  • 1
  • 13