Thats already what the webdriver API accomplishes, and its a w3c standard. https://www.w3.org/TR/webdriver/
People still call it 'selenium' for whatever reason, but chromedriver/geckodriver/edgedriver are all implementations of the protocol for each existing browser (safari's might be built in?).
Granted the web extensions API would likely allow for some additional powerful options, but at the cost of some missing features.
In contrast, the Web Extension API is now part of all major browsers, and makes interacting with different page contexts effortless. To give a sense of the project, we wrote an interactive tour of Remote Browser which runs browser instances on our backend.
Yeah, you can simulate events, but that can be a lot of work (e.g. typing an 'a' key might require you to simulate all of keydown, keypress, and keyup and set various non-standardized properties on them). And that won't even work in a standard text input as isTrusted is set to False on events you generate. Simulating something like a Tab key press will require you writing code to try to replicate your browser's logic in determining what the next element should be.
Why would this be preferable over something like Selenium?
You can simulate some parts of typing by mimicking browser behavior on a case by case basis, but there are places where this will be strictly impossible. For example, if you are working with anything that checks the isTrusted event bit, you're out of luck as you there is no mechanism for you to set that to true.
Selenium on the other hand is actually triggering events as if a person physically triggered them. So, for instance, the isTrusted bit will be set to true when you use the send_keys method in Selenium.
How would you go about installing the extension in a CI/CD setup? Can it be installed on headless Chrome?
 - https://github.com/intoli/remote-browser/blob/master/.circle...