Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] timesnap always closes the browser even on using remoteUrl, where a disconnect would make more sense #80

Open
cb109 opened this issue Jan 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@cb109
Copy link

cb109 commented Jan 17, 2024

Describe the bug

Passing the remoteUrl option allows reusing a running Chrome instance for screenshots, but it will always close that browser at the end. Instead I would expect it to only close the tab it created, and just disconnect from the browser, so that the browser instance can be reused further.

To Reproduce

Please run this script (node chrome_server.js) in a shell with puppeteer installed to open a Chrome instance, the browserWSEndpoint URL will be printed to the terminal for you to copy-paste:

// chrome_server.js
const puppeteer = require('puppeteer');

(async () => {
    var browser = await puppeteer.launch({
      headless: false,
      executablePath: '/usr/bin/google-chrome',  // Adjust as needed or remove to use default Chrome binary.
    });
    var browserWSEndpoint = browser.wsEndpoint();
    console.log(browserWSEndpoint);

    browser.disconnect();
})();

Then in a separate shell run timesnap against that remoteUrl like:

timesnap --remote-url <browserWSEndpoint> ...

Expected behavior

It should open a new tab in the running Chrome, do its thing, then close the tab but leave the browser opened/alive.

Attachments and Screenshots

Browser is closed at the end of the timesnap call:

Peek 2024-01-17 11-07

Desktop (please complete the following information):

  • OS: Ubuntu LTS 20.04
  • Node Version: v16.20.2
  • Timesnap Version 0.3.3

A so far simple PR: #81
Please let me know what you think, thanks.

@cb109 cb109 added the bug Something isn't working label Jan 17, 2024
@cb109 cb109 changed the title [BUG] [BUG] timesnap always closes the browser even on using remoteUrl, where a disconnect would make more sense Jan 17, 2024
cb109 added a commit to cb109/timesnap that referenced this issue Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant