```javascript
.evaluate(() => {
console.log('aaaa') // Could console be effected in function 'evaluate() '
})
Yes.
evaluate(): Evaluate Javascript code within Chrome in the context of the DOM.
You can access anything you normally would be able to via script injected on the page, because that's what's being done here. The method you pass to evaluate() is serialized, injected into the page, and then executed.
Yes, I know. I think if there is a method to catch the log executed in the page.
javascript
chromeless.evaluate(() => {
$("button").click();
console.info($("button"))
});
chromeless.onConsoleMessage=(msg) => {
console.log(msg);
};//a method to catch the log executed in the page.
I see. Yes, that would be nice. I've wanted that too.
I guess what you're looking for is access to Console.messageAdded?
Actually Console is deprecated, use Log.entryAdded (_experimental_) or Runtime.consoleAPICalled instead.
Hi, is there a clean way to get the client (CDP) from chromeless instance?
just wanna do like this...
const chromeless = new Chromeless()
const client = ? // o.o?
const { Runtime } = client
Runtime.consoleAPICalled(({ type, args }) => {
console[type].apply(console, args.map(o => o.value))
})
Most helpful comment
Actually
Consoleis deprecated, use Log.entryAdded (_experimental_) or Runtime.consoleAPICalled instead.