mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: add Page/Frame title method (#10260)
This commit is contained in:
parent
73b72b31b2
commit
a94dbceade
@ -270,6 +270,12 @@ export class BrowsingContext extends EventEmitter {
|
||||
this.removeAllListeners();
|
||||
this.connection.unregisterBrowsingContexts(this.#id);
|
||||
}
|
||||
|
||||
title(): Promise<string> {
|
||||
return this.evaluate(() => {
|
||||
return document.title;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -111,6 +111,10 @@ export class Frame extends BaseFrame {
|
||||
return this.#context.content();
|
||||
}
|
||||
|
||||
override title(): Promise<string> {
|
||||
return this.#context.title();
|
||||
}
|
||||
|
||||
context(): BrowsingContext {
|
||||
return this.#context;
|
||||
}
|
||||
|
@ -496,6 +496,10 @@ export class Page extends PageBase {
|
||||
this.#closedDeferred.valueOrThrow()
|
||||
);
|
||||
}
|
||||
|
||||
override title(): Promise<string> {
|
||||
return this.mainFrame().title();
|
||||
}
|
||||
}
|
||||
|
||||
function isConsoleLogEntry(
|
||||
|
Loading…
Reference in New Issue
Block a user