Warning message on goTo function
Closed this issue · 6 comments
I use node 7.10.1,
when I use the browser.goTo function in code,
await browser.goTo('https://www.npmjs.com/package/simple-headless-chrome')
I get the following error,
(node:28261) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: browser.goTo is not a function
(node:28261) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Since goTo function throws an error the URL does not open.
Thanks
@kavipreetha is the browser variable defined in your code? (and reachable from the code that does the await
?)
Yes, please find the snippet below,
"use strict"
const HeadlessChrome = require('simple-headless-chrome')
const browser = new HeadlessChrome({
headless: false
});
async function navigateWebsite() {
await browser.init();
await browser.goTo('https://www.npmjs.com/package/simple-headless-chrome')
await browser.resizeFullScreen();
await browser.saveScreenshot('./sample.png' )
}
navigateWebsite();
Hi @kavipreetha !
What version of this module are you using?
Yesterday we upgraded to v4.0.0. If you are using that one, please check the notes below:
https://github.com/LucianoGanga/simple-headless-chrome/blob/master/release-notes.md
Otherwise, if you're on a version < 4.0.0 please let us know which one so we can help you :)
Cheers!
Lucho
Thanks for the info
I use the latest version of npm 4.0.3
Also, tried the updated syntax. Please find the snippet below,
const HeadlessChrome = require('simple-headless-chrome')
const browser = new HeadlessChrome({
headless: true
})
async function navigateWebsite() {
await browser.init()
const mainTab = await browser.newTab({
privateTab: false
})
await mainTab.goTo('https://github.com/LucianoGanga/simple-headless-chrome')
await browser.close()
}
navigateWebsite()
I get the following warning
(node:31682) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: 'Target.createTarget' wasn't found
(node:31682) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Please help me to move further.
Thanks
Sorry for the late reply @kavipreetha !
It's weird, I copy pasted your code, and it works for me. In fact, I added it to the example folder:
https://github.com/LucianoGanga/simple-headless-chrome/blob/master/examples/basicNavigation.js
What NodeJS version are you using? I'm on v8.1.4, with Chrome version > 59
Closed for lack of activity. Please, reopen if this still happens!
Cheers,
Luciano