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.

[Question] Is there a way to access the `playwright` object in dev tools in browsers launched within `launch()`?

See original GitHub issue

Hi team,

I’m launching a browser in this way:

with sync_playwright() as playwright:
    browser = playwright.chromium.launch(headless=False)
    ...

In this browser, is there a way to access the playwright object in the Developer Tools Console, similarly to what you can do when launching a browser using open, e.g.,

python -m playwright open http://localhost:3000

and as described in you documentation? I think it could be useful to debug issues, for instance when a selector cannot find the given element because of a recent change and the flow gets stuck, without the need to manually reproduce the page state generated by the Python code after launch.

Alternatively, what could be a good workaround? For instance, I’m wondering if it’s possible in the Developer Tools Console to do something similar to

playwright.selector($0)

when debugging in a browser started with launch.

I tried launching the browser with

playwright.chromium.launch(headless=False, env={"PWDEBUG": True})

but even assuming this is the proper way, I get an error—I can give you more details on this, if you want.

Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kumaraditya303commented, Dec 5, 2020

Yeah, we should fix it, thanks for the report!

@pavelfeldman PR on the way! 🚀

1reaction
pavelfeldmancommented, Dec 5, 2020

Yeah, we should fix it, thanks for the report!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to start with Playwright Debugging | BrowserStack
A step-by-step tutorial to perform Playwright Debugging and help you choose a suitable option to deliver a high-quality web application.
Read more >
Answers to All The Top Questions For Playwright Testing
A: Yes, test runners like pytest and Jest will parallelize Playwright-based tests. Q: Is it possible to show the cursor on a video...
Read more >
Inspect Playwright Selectors in Chrome Dev Tools - YouTube
In this video, I have explained how to Inspect Playwright Selectors in Chrome Dev Tools || Playwright with JavaSchedule a meeting in case...
Read more >
Playwright Tutorial: Getting Started With Playwright Framework
Playwright launches headless browsers by default. They do not display a browser GUI. Instead, you will have to run your scripts via the...
Read more >
Scraping the web with Playwright | ScrapingBee
Playwright is a browser automation library for Node.js (similar to Selenium or Puppeteer) that allows reliable, fast, and efficient browser ...
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