New tab official example not working for headless mode
See original GitHub issueI must have missed something but executing the official example for creating a new tab in headless mode doesn’t work for me:
const CDP = require('chrome-remote-interface');
CDP.New().then((tab) => {
return CDP({tab: tab});
}).then((client) => {
return client.Runtime.evaluate({
expression: 'alert("Closing this tab...")'
}).then(() => {
const tab = client.chooseTab;
return CDP.Close({id: tab.id});
});
}).catch((err) => {
console.error(err);
});
I get: Error: Could not create new page
I tried with the command line: chrome-remote-interface new http://www.ingdirect.fr
. Same error.
I’m executing Chrome on Ubuntu. I customized the IP on which chrome listen but I tried with the default (localhost) and I observed same results.
Regarding the command line, inspect
and list
works. But not new
nor close
.
[ { description: '',
devtoolsFrontendUrl: '/devtools/inspector.html?ws=192.168.1.44:9222/devtools/page/49db60ac-cc96-4e0f-bba2-7403f40a82bf',
id: '49db60ac-cc96-4e0f-bba2-7403f40a82bf',
title: 'about:blank',
type: 'page',
url: 'about:blank',
webSocketDebuggerUrl: 'ws://192.168.1.44:9222/devtools/page/49db60ac-cc96-4e0f-bba2-7403f40a82bf' } ]
I’m using the latest version of node and CRI:
npm ls -g --depth=0
/home/jon/.nvm/versions/node/v7.9.0/lib
├── chrome-remote-interface@0.18.0
└── npm@4.2.0
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
3120 - Headless mode download from new tab - chromedriver
Issue 3120: Headless mode download from new tab ... We have the same problem with Chrome 77.0.3865.90. Is there any workaround ?
Read more >How to download files headless in Selenium (Java) when ...
(But working in non-headless mode). And I found the solution (example in Python):. First step - click Download button and switch to new...
Read more >Getting Started with Headless Chrome - Chrome Developers
The easiest way to get started with headless mode is to open the Chrome binary from the command line. If you've got Chrome...
Read more >Working with windows and tabs - Selenium
Clicking a link which opens in a new window will focus the new window or tab on screen, but WebDriver will not know...
Read more >Multi-tab flows | Checkly
Both Puppeteer and Playwright enable us to control multiple browser tabs, ... Opening tabs directly If we are looking to open brand new...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK good to know. Saw that but thought DevTools was a domain. Thanks.
There’s a note about the headless version:
It will be fixed in Chrome 59, you can use the
google-chrome-unstable
Ubuntu package.