← Back to Discord Forum

Unable to connect to remote browser instance

dedsec_30718posted in #help-playwright
Open in Discord
/venv/lib/python3.9/site-packages/playwright/_impl/_connection.py", line 377, in dispatch
    parsed_error = parse_error(error["error"])  # type: ignore
KeyError: 'error'

The above error is what i get with the following python script:

from playwright.sync_api import sync_playwright
p = sync_playwright().start()
url = "https://www.google.com"
browser = p.chromium.connect(
context = browser.new_context()
page = context.new_page()

Any help would be appreciated.

This thread is trying to answer question "Why am I unable to connect to a remote browser instance using Python's Playwright library and how can I fix it?"

1 reply

Is it something like this?

from playwright_remote.sync_api import sync_playwright_remote

with sync_playwright_remote('ws://') as playwright: with playwright.chromium.launch() as browser: page = browser.new_page() page.goto('https://github.com/YusukeIwaki') page.screenshot(path='YusukeIwaki.png')

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.