Chrome DevTools – how do you close an alert box?

I am using Chrome DevToools through the Chrome remote interface.

One thing I don’t see a way to do here is to close an alert box. Is this possible?

Chrome remote debugging Basic Authentication

How can I do a basic authentication via chrome remote debugging?

That is I have a chrome running in remote debug like this

chrome.exe –remote-debugging-port=9222

then I use WebSocket4Net to comunicate with chrome. I would like to automate the basic authentication, by passing user and password in the json. I know that I could do simply

https://username:[email protected]/

but I would like also to try to pass them in the json.

I also have another question related to this.. Is it possible to pass in the json a javascript expression to evaluate? I have a javascript function to evaluate in order to get an id in a webpage

var children = document.body.getElementsByTagName('*');
var id='userScreenName';
var elements = [], child;
for (var i = 0, length = children.length; i < length; i++) {
   child = children[i];
   if (child.id.indexOf(id)>-1)
       elements.push(child);
};
return elements[0].id;

Extracting nodeId from Selenium WebDriver for Chrome Remote Interface

I was able to invoke Chrome Remote Interface functions inside Selenium WebDriver session (Page.captureScreenshot, Emulation.clearDeviceMetricsOverride etc). But I have problem with invoking methods which work on DOM element. The problem is with nodeId parameter. For example this function https://chromedevtools.github.io/devtools-protocol/tot/DOM/#method-setFileInputFiles accepts as one of parameters nodeId. I can’t figure out how to extract nodeId based on IWebElement (or RemoteWebElement) from SeleniumWebdriver.

How can I find nodeId using Selenium or Javascript?

More info about Chrome Remote Interface could be found here https://chromedevtools.github.io/devtools-protocol/