[Bug]: context.tracing() breaks Inspector
See original GitHub issuePlaywright version
1.14.1
Operating system
Windows
What browsers are you seeing the problem on?
No response
Other information
No response
What happened? / Describe the bug
Having context.tracing()
and page.pause()
in the same test breaks the inspector.
- Record doesn’t work
- “step over” is not consistent with end result when the test run finishes - Inspector’s console says “element does receive pointer events” (first click), however, the test still fails with “element doesn’t receive pointer events” seconds later
To reproduce:
- Run the code example below, wait until the inspect comes up
- Hit “Record” and click around - no code gets generated
- Step over - see Inspector log say “element does receive pointer events”, but the test will fail with “element doesn’t receive pointer events”
Note: this has only been reproduced in Java, not sure if the same behaviour can be observed in other language bindings.
Code snippet to reproduce your bug
public class _2TraceViewer {
Playwright pw;
Browser browser;
@Test
public void traceViewerDemo() {
pw = Playwright.create();
browser = pw.chromium().launch(new BrowserType.LaunchOptions().setHeadless(false).setSlowMo(1000));
BrowserContext context = browser.newContext();
// Start tracing before creating / navigating a page.
context.tracing().start(new Tracing.StartOptions()
.setScreenshots(true)
.setSnapshots(true));
Page page = context.newPage();
page.setDefaultTimeout(8_000);
page.navigate("https://playwright.dev/java/");
page.pause();
page.click("text=Get Started");
page.click("text=Guides");
page.click("text=Trace Viewer");
Assertions.assertTrue(page.isVisible("text=Recording a trace"));
// Stop tracing and export it into a zip archive.
context.tracing().stop(new Tracing.StopOptions()
.setPath(Paths.get("trace.zip")));
}
@AfterEach
public void cleanup() {
browser.close();
pw.close();
}
}
Relevant log output
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
[bug] EditorGUIUtility appears broken by UIToolkit ...
The Inspector assumes everyone will do this for their fields and with the selected GameObject/Component that it just calls Bind() on the ...
Read more >Stepping through code and inspecting variables to isolate bugs
The Xcode debugger provides several methods to step through your code and inspect variables. You can precisely control execution of your code from...
Read more >43332 – [JSC] Web Inspector: implement breaking from native callback
1. In Settings.js set Preferences.nativeInstrumentationEnabled = true (currently is false). 2. In Elements panel, invoke context menu on some node and enable ...
Read more >Setting position via Inspector breaks BoneLookController - Bugs
Hi I think I have found a minor bug. Chck this out: http://playground.babylonjs.com/#FTD4QV#1. Two issues: If you change the position of the ...
Read more >The 16 JavaScript debugging tips you probably didn't know
If you need to find your JavaScript bugs faster, try Raygun Crash Reporting, ... funcZ = function() { console.trace('trace car') } } func1();...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think I’ve run into the same problem. Maybe you need to say how you execute the repro. I my case it was with the IntelliJ JUnit runner, and no PWDEBUG set (can’t remember which way the headless setting was).
At the
page.pause();
line, the execution will stop, and the inspector will open, but using record from there will not generate any code. I just chalked it up to some weird bug and just stopped usingpause
, since I didn’t really need it.I don’t have time to reproduce it anymore or to try different conditions (since it’s not an important feature for me), but just putting a “me too” here, if anybody is interested.
The expectation is simply to have a working inspector (clicking generates code) when there’s also context.tracing() in the code as in the provided example. It’s not a blocker, of course, so if it’s not reproducible by anyone else, I’m happy to close it or rephrase the issue to focus on the issue that you do see - “if you click Record while paused then clicking ‘Step over’ will continue execution of the script”.