-
Notifications
You must be signed in to change notification settings - Fork 321
Closed
Labels
Description
When running my script the first time I get one log message, but as I run it again I get two messages, the old log and the new log. What am I doing wrong?
versions:
Google Chrome 59.0.3071.71 beta
chrome-remote-interface@0.23.0
my script:
"use strict";
const chrome = require("chrome-remote-interface");
(async () => {
chrome(async protocol => {
const { Page, Console } = protocol;
Console.messageAdded(({ message }) => {
console.log(message);
});
await Promise.all([
Page.enable(),
Console.enable(),
]);
await Page.navigate({ url: "http://127.0.0.1:8081/index.html" });
await Page.loadEventFired();
protocol.close();
}).on("error", e => console.log(e));
})().catch(e => console.log(e));the example page:
<!DOCTYPE html>
<script>console.log("hi")</script>console output:
{ source: 'console-api',
level: 'log',
text: 'hi',
url: 'http://127.0.0.1:8081/index.html',
line: 2,
column: 17 }
{ source: 'console-api',
level: 'log',
text: 'hi',
url: 'http://127.0.0.1:8081/index.html',
line: 2,
column: 17 }