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

Prevent opening 2 tabs when Puppeteer.launch(headless: false) #47

Closed
YusukeIwaki opened this issue Dec 29, 2020 · 1 comment · Fixed by #48
Closed

Prevent opening 2 tabs when Puppeteer.launch(headless: false) #47

YusukeIwaki opened this issue Dec 29, 2020 · 1 comment · Fixed by #48

Comments

@YusukeIwaki
Copy link
Owner

Step to reproduce

require 'puppeteer'

Puppeteer.launch(headless: false) do |browser|
  page = browser.new_page
  page.goto("https://github.com/YusukeIwaki/puppeteer-ruby")

  puts browser.pages.count # => 2
  sleep 10
end

Observed behavior

With this code, 2 tabs open.
image

Expected behavior

It would be better if only 1 tab open after Puppeteer.launch and browser.new_page.

Puppeteer (JS) also have the same behavior.
puppeteer/puppeteer#4298

Having an extra blank page uses no CPU and very little memory. I wouldn't worry about it.

It is right, however Playwright already improved it.
microsoft/playwright#1247

@YusukeIwaki
Copy link
Owner Author

Playwright launches Chrome with args below:

headful: <launching> /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees,ImprovedCookieControls,SameSiteByDefaultCookies,LazyFrameLoading --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --user-data-dir=/var/folders/d6/f04pgvzn7zv_sfkxgzs5tfxc0000gn/T/playwright_chromiumdev_profile-SXSNSW --remote-debugging-pipe --no-sandbox --no-startup-window

headless: <launching> /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees,ImprovedCookieControls,SameSiteByDefaultCookies,LazyFrameLoading --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --user-data-dir=/var/folders/d6/f04pgvzn7zv_sfkxgzs5tfxc0000gn/T/playwright_chromiumdev_profile-bsGjQj --remote-debugging-pipe --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --no-startup-window

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant