-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
  • 6,572
  • 8
  • 46
  • 58
Sushmita Goswami
  • 113
  • 1
  • 10

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
  • 336
  • 2
  • 16