Skip to content

Why debugger.sendCommand("DOM.getDocument") not working from rendered process  #5443

Closed

Description

@hahamed

Hello,
In rendered process I want to use DOM method in sendCommand, but not working.
my code is:

var remote = require('remote'), wc= remote.getCurrentWebContents();
wc.debugger.sendCommand("DOM.getDocument", {}, function (err, res) {
console.log(err); // not work
console.log(res); // not work
})

  • Electron version: 0.37.8
  • Operating system: Win7

Activity

  1. deepak1556 commented on May 8, 2016

    @deepak1556
    Member

    The debugger should be attached before sending commands.

    var remote = require('electron').remote, wc = remote.getCurrentWebContents();
    try {
      wc.debugger.attach("1.1");
    } catch(err) {
      console.log("Debugger attach failed : ", err);
    };
    if (wc.debugger.isAttached()) {
      wc.debugger.sendCommand("DOM.getDocument", {}, function (err, res) {
        console.log(res);
      })
    }
    
  2. hahamed commented on May 11, 2016

    @hahamed
    Author

    Thank you @zcbenz
    but i get this error:
    Debugger attach failed : Error: Could not call remote function 'attach'. Check that the function signature is correct. Underlying error: Another debugger is already attached to this target Error: Could not call remote function 'attach'. Check that the function signature is correct. Underlying error: Another debugger is already attached to this target at callFunction (C:\Users\Administrator.WIN-K5IA7RTF2VJ\Desktop\KM\client\engine\resources\electron.asar\browser\rpc-server.js:229:11) at EventEmitter....

  3. deepak1556 commented on May 11, 2016

    @deepak1556
    Member

    If you have devtools opened for this target, then you would receive this error on attaching. Only one debugger can be attached to a target currently and devtools takes precendence. This is a limitation on chromium side.

  4. hahamed commented on May 12, 2016

    @hahamed
    Author

    very very thanks

  5. lishoulong commented on Jun 7, 2018

    @lishoulong

    chrome 63 Chrome Extensions using the chrome.debugger API can now run at the same time as DevTools. Does Electron support the 63 Chrome?

  6. rr13k commented on Sep 27, 2020

    @rr13k

    hi, I try "electron": "^9.0.0" in use webcontext.debugger.sendCommand() in webviewTag
    It doesn't work properly

    previously it in "electron": "^4.1.0" is ok,
    I tried his command in electron ^9. Nothing happened to him
    @zcbenz

    please tell me , Why is it happen?

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions