question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding extension causes extra unwanted blank page to open and extension's opened page becomes a 'ghost' page and is completely unreachable!

See original GitHub issue

On JavaScript adding an extension which opens ‘welcome’ page such as MetaMask => extension opens 1 new page and you can close this page and the default page.

On Playwright Python adding an extension which opens ‘welcome’ page such as MetaMask => extension opens 1 extra blank page (2 blank pages / total) and a new ‘extension’ ‘ghost’ page which is unnaccessible from Playwright Python and you cannot close it.

I briefly mentioned this issue on https://github.com/microsoft/playwright-python/issues/681 where the developer who got assigned fixed my main issue in the title but skimmed over this issue. The developer’s given fix only fixed browser.close() raising errors => into => not raising errors, but not this issue. This issue is still ‘at large’ (i.e. especially of a criminal or dangerous animal) at liberty; escaped or not yet captured.)

PROBLEM: this bug causes an unaccessible ‘extension’ page to just hang there and I cannot close it using code. It’s not inside browser.pages.

Illustrative image sets with descriptive captions:

  1. Playwright JS https://imgur.com/a/X13eydu

  2. Playwright Python https://imgur.com/a/mkINpWl

EDIT: adding source as by confusing from @pavelfeldman 's reply

import playwright
from playwright.sync_api import sync_playwright

EXT_1_DIR = "C:/Users/PC/Desktop/PW_PY/metamask_unpck"
USER_DIR = "C:/Users/PC/AppData/Local/Google/Chrome/User Data/Profile 2"

ARGS = [
    "--disable-extensions-except={}".format(EXT_1_DIR),
    "--load-extension={}".format(EXT_1_DIR)
]


with sync_playwright() as p:
    browser = p.chromium.launch_persistent_context(USER_DIR, headless=False, args=ARGS)
    page = browser.new_page()
    _ = input("Wait till Metamask loads? ")
    print("len_pages()", len(browser.pages))
    for pg in browser.pages:
        pg.close()

    _ = input("Close browser? ")
    browser.close()

EDIT: update to @pavelfeldman 's input.

new source

import playwright
from playwright.sync_api import sync_playwright

EXT_1_DIR = "C:/Users/PC/Desktop/PW_PY/metamask_unpck"
USER_DIR = "C:/Users/PC/AppData/Local/Google/Chrome/User Data/Profile 2"

ARGS = [
    "--disable-extensions-except={}".format(EXT_1_DIR),
    "--load-extension={}".format(EXT_1_DIR)
]


with sync_playwright() as p:
	# 1) launch MetaMask
    browser = p.chromium.launch_persistent_context(USER_DIR, headless=False, args=ARGS)
    _ = input("Wait till Metamask loads? ")
   
   	# 2) print len() pages and bg_pagesshould be 2, but is 1 (bug)
    print("len_pages()", len(browser.pages))
    print("len_background_pages()", len(browser.background_pages))

    _ = input("Close pages? ")
    # 2.1) pages don't get closed, only blank page is detected and closed, 2nd page does not get detected,
    # or, closed
    for pg in browser.pages:
        pg.close()


    # 3) close the browser, old bug error on closing was fixed by your dev - all good- thanks him
    _ = input("Close browser? ")
    browser.close()

As we see, the page doesn’t fall into browser.background_pages it’s just not there. Also, note, for Playwright JS it falls into normal pages.

Illustrative screenshot: https://imgur.com/a/Yh1BIQr

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mxschmittcommented, May 14, 2021

Hi, I will get back to you, probably in a few days and probably add some tests from upstream around it to ensure this works. Sorry for the inconveniences!

0reactions
mxschmittcommented, Jun 7, 2021

Closing since the issue seemed stale as part of the triage process. Please create a new issue if the issue is still persistent.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix Google Chrome Blank page(s) problem. - wintips.org
Solution 3: Delete all files in Google Chrome “Local Storage” folder. · Navigate to Windows “Control Panel” and open “Folder Options”. · Select...
Read more >
7 Best Ways to Fix Google Chrome Untitled Blank Page
Step 1: Open Google Chrome, tap on the three-dot menu at the top. Step 2: Navigate to More tools > Extensions. Step 3:...
Read more >
How to Delete an Unwanted Blank Page in Word 2013 or 2016
To watch the updated video and read the full article on the BetterCloud Monitor, visit:
Read more >
How to Delete a Blank Page in Word that Won't ... - YouTube
Download the featured file here: https://www.bluepecantraining.com/wp-content/uploads/2021/03/Document-With-Rogue-Spacing.docxIn this video ...
Read more >
The 70 Best Chrome Extensions for 2022 - HubSpot Blog
Explore these Google Chrome web browser extensions to make your ... new tab Chrome extension that turns your new tab page into a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found