carlo icon indicating copy to clipboard operation
carlo copied to clipboard

Sometimes carlo launches into the wrong window when using "--auto-open-devtools-for-tabs" launch arg

Open gadamsgh opened this issue 5 years ago • 2 comments

When debugging, it is useful to automatically launch devtools for the window, using the "--auto-open-devtools-for-tabs" flag.

Example main.js:

const carlo = require('carlo');

(async () => {
  const app = await carlo.launch({args:["--auto-open-devtools-for-tabs"]});
  app.on('exit', () => process.exit());
  app.serveFolder(__dirname);
  await app.load('https://www.google.com');
})();

Most of the time, google.com (site being launched in this case, happens with any site) will open in one window, and devtools will open in another window: image

Occasionally, both windows will initialize but google.com will open in the window intended for devtools (making the devtools inaccessible), leaving the window intended for google.com in an odd state. This occurs maybe 20% of the time on my Windows 10 machine.

image

gadamsgh avatar Jan 24 '19 22:01 gadamsgh

Carlo assumes it manages windows and --auto-open-devtools-for-tabs breaks that assumption I guess...

pavelfeldman avatar Jan 29 '19 01:01 pavelfeldman

Yep, I've been encountering the same issue on Mac.

A crude workaround:

const app = await carlo.launch({ args: ['--auto-open-devtools-for-tabs'] });
app.on('exit', () => process.exit());
app.serveFolder(__dirname);

await app.createWindow(); // create a second window
await app.mainWindow().close(); // dispose the first window
await app.load('index.html');

lukehorvat avatar Apr 12 '19 15:04 lukehorvat