w3c / webdriver-bidi

Bidirectional WebDriver protocol for browser automation
https://w3c.github.io/webdriver-bidi/
355 stars 39 forks source link

Add command for getting process info of the browser #397

Open CanadaHonk opened 1 year ago

CanadaHonk commented 1 year ago

See CDP command SystemInfo.getProcessInfo: https://chromedevtools.github.io/devtools-protocol/tot/SystemInfo/#method-getProcessInfo

Not sure what domain this could fall under (if any existing)

jgraham commented 1 year ago

Can you talk more about the specific use cases that you have here? I don't know how well the CDP model will generalise across different browsers (this turned out to be surprisingly difficult with browser.close for example, since some browsers don't want to allow you to actually close the entire browser, but just windows specifically related to automation).

CanadaHonk commented 1 year ago

My main use case is monitoring the resource usage of the browser by getting the usage of each pid given back.

whimboo commented 1 year ago

Note that the SystemInfo.getProcessInfo command is available at least in Chrome's and Firefox's CDP implementation. Generally I don't think that this should be a problem for Safari as well.

CanadaHonk commented 1 year ago

The main trouble would likely be with type, but can likely be standardised as process models between browsers are now pretty similar.

jgraham commented 1 year ago

I think being able to get PIDs makes some sense; it seems to be a concept that's sufficiently OS-agnostic that we can expose it. I agree that process types is going to be tricky; I don't think the process models are standard enough if you also want information about helper processes (e.g. processes that just handle networking, or WebGL) vs just the parent and content (render) processes.

whimboo commented 1 year ago

We could define default process types like browser, gpu, web, and allow the list to be extensible?