Skip to content

Commit

Permalink
Merge pull request #18 from steel-dev/nasr/fix-wrong-target-type
Browse files Browse the repository at this point in the history
fix(api): logging listeners not being used
  • Loading branch information
fukouda authored Dec 3, 2024
2 parents 5f7c4f3 + b886f18 commit bd8accb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions api/src/services/cdp.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class CDPService extends EventEmitter {
}

private async handleNewTarget(target: Target) {
if (target.type() !== "page") {
if (target.type() === "page") {
const page = await target.page().catch((e) => {
this.logger.error(`Error handling new target in CDPService: ${e}`);
return null;
Expand Down Expand Up @@ -181,7 +181,6 @@ export class CDPService extends EventEmitter {
});

page.on("console", (message) => {
console.log("console - ", message.text());
this.logger.info(`Console message: ${message.type()}: ${message.text()}`);
this.customEmit(EmitEvent.Log, {
type: BrowserEventType.Console,
Expand Down

0 comments on commit bd8accb

Please sign in to comment.