(chrome:39371): Gtk-WARNING **: 13:26:01.895: cannot open display
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: puppeteer@1.19.0
- Platform / OS version: CentOS Linux release 7.5.1804 (Core)
- URLs (if applicable):ls
- Node.js version: v8.16.0
- pm2 : 3.0.3
What steps will reproduce the problem?
Please include code that reproduces the issue.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
headless: false,
defaultViewport: {
width: 1000,
height: 920
},
userDataDir : '/tmp/puppeteer',
args: ['--start-maximized', '--no-sandbox', '--disable-setuid-sandbox']
})
var timeoutID = setTimeout(async function (){ logger.debug('TIME OUT'); clearTimeout(timeoutID); return {"status" : false, "comment" : "TIMEOUT 5 minutes"}},300000)
const page = await browser.newPage();
const userAgent = await page.evaluate('navigator.userAgent');
console.log('userAgent : ' + userAgent);
var siteURL = 'https://epaper.faz.net/';
var selectorName = 'body > div.content-wrapper > div > div.row.newspapers-row > div:nth-child(1) > div.newspaper.main-issue.with-shadow > div > div.newspaper-cover-inner > a > img'
const response = await page.goto(siteURL, {timeout: 0});
console.log('wait loading page 1 seconds');
await page.waitFor(1000);
var statut = `${response['_status']}`;
if (statut.substring(0,1) != "2") {
console.log(`#check Change : ${response["_url"]} - ${response["_status"]} - ${response["_headers"]}`);
clearTimeout(timeoutID);
return;
}
if (await page.$(selectorName) == null) {
console.log(`#check Change : selector (${selectorName}) NOT FOUND`);
clearTimeout(timeoutID);
return;
}
var res = await Promise.all([page.waitFor(selectorName,{timeout: 0,visible:true})]).then(async () => {
const screenshotElement = await page.$(selectorName);
await screenshotElement.screenshot({path: 'currentScreenShot.jpg'});
await browser.close();
clearTimeout(timeoutID);
return null;
}
)
})()
What is the expected result?
screenShot for the selector
What happens instead? [2019-08-07T12:56:03.857] [DEBUG] default - LOG-606145–3.puppeteer.launch [2019-08-07T12:56:03.947] [ERROR] default - Failed task execution Failed to launch chrome!
(chrome:33933): Gtk-WARNING **: 12:56:03.941: cannot open display: [0807/125603.945853:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox! Most likely you need to configure your SUID sandbox correctly
TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
[2019-08-07T12:56:03.947] [ERROR] default - An exception occurred in task executor ‘Executor #1’: [2019-08-07T12:56:03.949] [ERROR] default - Error: Failed to launch chrome!
(chrome:33933): Gtk-WARNING **: 12:56:03.941: cannot open display: [0807/125603.945853:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox! Most likely you need to configure your SUID sandbox correctly
TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
at onClose (/data01/batch/backend/app-task-handler/node_modules/puppeteer/lib/Launcher.js:349:14)
at Interface.helper.addEventListener (/data01/batch/backend/app-task-handler/node_modules/puppeteer/lib/Launcher.js:338:50)
at emitNone (events.js:111:20)
at Interface.emit (events.js:208:7)
at Interface.close (readline.js:368:8)
at Socket.onend (readline.js:147:10)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at args.(anonymous function) (/usr/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:133:29)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickDomainCallback (internal/process/next_tick.js:219:9)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6
Top GitHub Comments
I think the problem here is the option: “headless: false” at browser = await puppeteer.launch. You can try headless: true
We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it!