Skip to content

[Bug]: attached webContents.debugger interferes with renderer devtools dom element selection #34260

Closed as not planned

Description

@bughit

Preflight Checklist

Electron Version

18.2.3, 17.1.2

What operating system are you using?

Windows

Operating System Version

win7 sp1

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

devtools DOM element selector should work

Actual Behavior

  1. run the testcase fiddle
  2. in devtools console enter location = 'https://www.verizon.com/'
  3. switch to the elements tab and use the element selector tool to select an element in the page
  4. the selected element does not get highlighted in the elements tree, seemingly because the tree is not in sync with the page

Testcase Gist URL

https://gist.github.com/8d64059054a91672a21a5aef1ca32dcf

Additional Information

Reproducibility appears to depend on the complexity of the site. Some sites are intermittent, for me https://www.verizon.com is reliable.

Activity

  1. added
    has-repro-gist
    on May 23, 2022
  2. Kilian commented on Jul 18, 2022

    @Kilian
    Member

    Can confirm this has been an issue since at least Electron 8 if not earlier. The issue goes away if the debugger is never attached. Can also confirm that its related to the complexity of the site, making me think its some sort of race condition.

    According to the chromium slack, attaching multiple debuggers should be possible, and the likely cause is that devtools is not receiving the right chrome devtools protocol events.

  3. Kilian commented on Jul 21, 2022

    @Kilian
    Member

    protocol events sent this as response to DOM.pushNodesByBackendIdsToFrontend upon an inspectElement invocation:

    {
        "code": -32000,
        "message": "Document needs to be requested first"
    }
    

    so it seems the document gets invalidated?

  4. Kilian commented on Jul 22, 2022

    @Kilian
    Member

    When following the instructions on https://chromedevtools.github.io/devtools-protocol/ I can successfully load verizon and add a devtools and two remote devtools and all of them behave correctly, pointing to the issue being Electron-related. Chrome seems to make use of a single devtools backend, and I'm not sure webContents.debugger uses the same devtools backend as the devtools.

    The code to set up and open devtools is here (I think): https://github.com/electron/electron/blob/main/shell/browser/ui/inspectable_web_contents.cc#L441

    And the code to set up a debugger is here: https://github.com/electron/electron/blob/main/shell/browser/api/electron_api_debugger.cc#L90

    Would be worth checking if those refer to the same DevToolsAgentHost(?)

  5. github-actions commented on Oct 21, 2022

    @github-actions
    Contributor

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  6. bughit commented on Oct 21, 2022

    @bughit
    ContributorAuthor

    bump

  7. github-actions commented on Jan 21, 2023

    @github-actions
    Contributor

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  8. 41 remaining items

  9. bughit commented on Sep 1, 2025

    @bughit
    ContributorAuthor

    bump

  10. electron-issue-triage commented on Dec 1, 2025

    @electron-issue-triage

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  11. bughit commented on Dec 1, 2025

    @bughit
    ContributorAuthor

    bump

  12. electron-issue-triage commented on Mar 2, 2026

    @electron-issue-triage

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  13. bughit commented on Mar 2, 2026

    @bughit
    ContributorAuthor

    bump

  14. electron-issue-triage commented on Jun 1, 2026

    @electron-issue-triage

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  15. electron-issue-triage commented on Jul 2, 2026

    @electron-issue-triage

    This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    17-x-y18-x-ybug 🪲component/devtoolshas-repro-gistplatform/allstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions