jtbandes
jtbandes

Reputation: 118751

Is it possible to load chrome://gpu using Puppeteer?

I'm using Puppeteer to take screenshots of some pages. I'd like to inspect the GPU/WebGL support, but when I use await page.goto("chrome://gpu"), I get this error:

Error: Navigation failed because browser has disconnected!
    at CDPSession.LifecycleWatcher._eventListeners.helper.addEventListener (/app/node_modules/puppeteer/lib/LifecycleWatcher.js:47:107)
    at emitNone (events.js:106:13)
    at CDPSession.emit (events.js:208:7)
    at CDPSession._onClosed (/app/node_modules/puppeteer/lib/Connection.js:215:10)
    at Connection._onClose (/app/node_modules/puppeteer/lib/Connection.js:138:15)
    at WebSocketTransport._ws.addEventListener.event (/app/node_modules/puppeteer/lib/WebSocketTransport.js:45:22)
    at WebSocket.onClose (/app/node_modules/ws/lib/event-target.js:124:16)
    at emitTwo (events.js:126:13)
    at WebSocket.emit (events.js:214:7)
    at WebSocket.emitClose (/app/node_modules/ws/lib/websocket.js:180:10)
  -- ASYNC --
    at Frame.<anonymous> (/app/node_modules/puppeteer/lib/helper.js:108:27)
    at Page.goto (/app/node_modules/puppeteer/lib/Page.js:662:49)
    at Page.<anonymous> (/app/node_modules/puppeteer/lib/helper.js:109:23)
    at main (/app/index.js:21:16)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

If I instead use await page.evaluate(() => window.location.href = "chrome://gpu"), the page logs an error message in the console saying

Not allowed to load local resource: chrome://gpu/

Is there any way to load the GPU status page from Puppeteer?

Upvotes: 0

Views: 1042

Answers (1)

vsemozhebuty
vsemozhebuty

Reputation: 13822

I cannot reproduce with the last tip-of-tree puppeteer version on Windows 7 x64:

'use strict';

const puppeteer = require('puppeteer');

(async function main() {
  try {
    const browser = await puppeteer.launch();
    const [page] = await browser.pages();

    await page.goto('chrome://gpu');

    const data = await page.evaluate(() =>
      [...document.querySelectorAll('h3')].map(({ innerText }) => innerText)
    );

    console.log(data);

    await browser.close();
  } catch (err) {
    console.error(err);
  }
})();

Output:

[ 'Graphics Feature Status',
  'Driver Bug Workarounds',
  'Problems Detected',
  'Version Information',
  'Driver Information',
  'Compositor Information',
  'GpuMemoryBuffers Status',
  'Display(s) Information',
  'Video Acceleration Information',
  'Diagnostics',
  'Driver Information for Hardware GPU',
  'Graphics Feature Status for Hardware GPU',
  'Driver Bug Workarounds for Hardware GPU',
  'Problems Detected for Hardware GPU',
  'Log Messages' ]

Upvotes: 1

Related Questions