Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用Dream JS加载网页_Javascript_Node.js_Nightmare - Fatal编程技术网

Javascript 如何使用Dream JS加载网页

Javascript 如何使用Dream JS加载网页,javascript,node.js,nightmare,Javascript,Node.js,Nightmare,我正在使用梦魇JS创建一个访问Facebook市场的网络机器人,并为我更新第一个列表。但是,当机器人运行时,只有导航栏加载,而身体的其余部分留空。我很好奇如何加载这个,否则我无法选择marketplace按钮 以下是我目前的代码: const Nightmare = require('nightmare'); const nightmare = Nightmare({ show: true }); nightmare .viewport(1000, 1000) .goto('https:/

我正在使用梦魇JS创建一个访问Facebook市场的网络机器人,并为我更新第一个列表。但是,当机器人运行时,只有导航栏加载,而身体的其余部分留空。我很好奇如何加载这个,否则我无法选择marketplace按钮

以下是我目前的代码:

const Nightmare = require('nightmare');
const nightmare = Nightmare({ show: true });

nightmare
.viewport(1000, 1000)
  .goto('https://www.facebook.com')
    //type email in the email input #email
  .insert('#email', 'EmailHere')
    //type password in the password input #pass
  .insert('#pass', 'PasswordHere')
  //click the login button #loginbutton
  .click('#loginbutton')

  .wait(10000)

  //click on marketplace button
  .click('div.linkWrap.noCount:nth-of-type(3)')

  //.click('div')
  //.goto('https://www.facebook.com/marketplace/selling/')

  .wait(5000)

  .end()
  .then(console.log('Nightmare has ended'))
  .catch(error => {
    console.error('Search failed:', error)
  });