How To Attach a Running Chrome - nodebotrpa/editor GitHub Wiki

To attach a running chrome browser using w3Driver protocol, you must launch chrome with remote debug enabled.

Launch Chrome In Debug Mode

Run the Chrome instance that you will be debugging remotely with the remote debugging command line switch:

chrome.exe --remote-debugging-port=9222 --user-data-dir=<profile-path>

It is essential that you use a different instance of Chrome for the remote session and that is why we run it with the --user-data-dir argument.

Navigate to the pages you intend to debug.

Now run a regular (client) Chrome instance and navigate to http://localhost:9222 there.

You will see a number of links that will bring you to the remote debugging sessions for the corresponding pages Reference Link

Find Chrome Profile Path

Open chrome instance and navigate to chrome://version and get the profile path information.

Launch Chrome Always With Remote Debug Enabled

Go to Windows registry editor and search this command

Computer\HKEY_CLASSES_ROOT\ChromeHTML\shell\open\command

Modify the key with the following

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir=<profile-path> -- "%1"

If you dont want to edit your registry settings, append parameters to your Chrome short cut.

Chrome Attach Settings

Use CHROME_ATTACH as browser type on "New Session" node.

{"url":"http://localhost:9515",
"driver":"chromedriver.exe",
"capabilities":{
	"firstMatch":[
	  {"browserName":"chrome",
		"goog:chromeOptions":{
			"debuggerAddress":"localhost:9222",
			"args":["--disable-extensions","--disable-infobars"],
			"extensions":[]
		}
	  }
	]
},
"desiredCapabilities":{
	"browserName":"chrome",
	"goog:chromeOptions":{
		"debuggerAddress":"localhost:9222",
		"args":["--disable-extensions","--disable-infobars"],
		"extensions":[]
	}
}
}

Now you can attach to a running session and switch to window.