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.

[Bug]: context.tracing() breaks Inspector

See original GitHub issue

Playwright 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.

  1. Record doesn’t work
  2. “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:

  1. Run the code example below, wait until the inspect comes up
  2. Hit “Record” and click around - no code gets generated
  3. 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:open
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jhyotcommented, Sep 16, 2021

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 using pause, 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.

0reactions
andrejs-pscommented, Sep 9, 2021

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”.

Read more comments on GitHub >

github_iconTop 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 >

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