Goal
- I am trying to get remote debugging URL of specific ChromiumWebBrowser object after initializing it with
new ChromiumWebBrowser(...)
Application Info
- My application creates multiple
ChromiumWebBrowser
worker instances at runtime, the number of instances varies according to workload. All of them navigates to some URLs and perform tasks(clicks on buttons, fills inputs, collects values) on sites. If the worker finds unexpected result after it's actions(Couldn't find the div element with given id), it sends notification to the user and hands out it's remote debugging URL which is allowing the user to take control of worker and investigate what went wrong during process.
The Problem
- I don't know how to obtain remote debugging URL of specific
ChromiumWebBrowser
object - e.g. it would be nice if the URL variable could instantiated that easy in the following code block but
ChromiumWebBrowser
class doesn't have such property (RemoteDebuggingUrl).ChromiumWebBrowser worker1 = new ChromiumWebBrowser(...);
string URL = worker1.RemoteDebuggingUrl;
Efforts
I decided to dig down into the source code of CefSharp to find out how remote debugging server creates links per ChromiumWebBrowser
basis, e.g. i assumed maybe it is accessing of ChromiumWebBrowser
objects ID like property because the links of browsers in remote debugging main page (accessed via http://localhost:8088) is like following url ;
The "FA54735587998EFD141A2300AE57F70C" part is the ID of the remote debugging link as seen in http://localhost:8088/json
[
{
"description": "",
"devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:8088/devtools/page/FA54735587998EFD141A2300AE57F70C",
"id": "FA54735587998EFD141A2300AE57F70C",
"title": "Sign In",
"type": "page",
"url": "https://af.sts.mapfre.net/adfs/ls/?SAMLRequest=hZJda8IwFIb%2FSsm9TVvFj9AKtk4Q3BDddrGbEeopBpqkyzl1279fWnFzF3NXgZPzJs9zkhSlrhuxaOlodvDWAlLwoWuDot%2FIWOuMsBIVCiM1oKBS7Bf3G5GEkWicJVvaml1FbickIjhS1rBgvczYa5zP8tE0XxXjPJrdjYer8SiaTIplnAxXwyguWPAMDn1%2FxnzchxBbWBskaciXong2iJNBMn6MExFNxTB5YcHSOygjqU8diRoUnMsqRMJQy6ZyEBogLg8V8ho5CwprELrzbpGX5yZRts75daB0U6tSEQtW1pXQDzBjlawROsytN1Un%2BK4sLuLdZa0Gtwd3UiU87TY%2FkJ7uQlhaHZLjGuraGt5YpB1g0zGwedrNWfSjcPM%2Fsym%2FbkvP7%2FzgvdbLrfXonx24lv9odxV1GFR9qyAnDSqv74U82HvhQJKXJNcC4%2FPzlb9%2F0%2FwL",
"webSocketDebuggerUrl": "ws://localhost:8088/devtools/page/FA54735587998EFD141A2300AE57F70C"
}
]
Finally i couldn't navigate to the implementation of following symbol using Visual Studio 2019
bool CefInitialize(const CefMainArgs& args,
const CefSettings& settings,
CefRefPtr<CefApp> application,
void* windows_sandbox_info);
in purpose of finding how remote debugging server works. I located this symbol in "cef_app.h" header file which is part of the cef-sdk.75.1.14 Nuget Package.
I tried to find the implementation of this symbol because i thought it is the entry point of remote debugging server, because it takes CefSettings
parameter which includes RemoteDebuggingPort
which was 8088 in my case.