@@ -22,7 +22,7 @@ import { evaluationScript } from './clientHelper';
2222import { Coverage } from './coverage' ;
2323import { Download } from './download' ;
2424import { ElementHandle , determineScreenshotType } from './elementHandle' ;
25- import { TargetClosedError , isTargetClosedError , serializeError } from './errors' ;
25+ import { TargetClosedError , isTargetClosedError , parseError , serializeError } from './errors' ;
2626import { Events } from './events' ;
2727import { FileChooser } from './fileChooser' ;
2828import { Frame , verifyLoadState } from './frame' ;
@@ -41,6 +41,7 @@ import { trimStringWithEllipsis } from '../utils/isomorphic/stringUtils';
4141import { urlMatches , urlMatchesEqual } from '../utils/isomorphic/urlMatch' ;
4242import { LongStandingScope } from '../utils/isomorphic/manualPromise' ;
4343import { isObject , isRegExp , isString } from '../utils/isomorphic/rtti' ;
44+ import { ConsoleMessage } from './consoleMessage' ;
4445
4546import type { BrowserContext } from './browserContext' ;
4647import type { Clock } from './clock' ;
@@ -669,6 +670,16 @@ export class Page extends ChannelOwner<channels.PageChannel> implements api.Page
669670 return await this . _mainFrame . fill ( selector , value , options ) ;
670671 }
671672
673+ async consoleMessages ( ) : Promise < ConsoleMessage [ ] > {
674+ const { messages } = await this . _channel . consoleMessages ( ) ;
675+ return messages . map ( message => new ConsoleMessage ( this . _platform , message , this ) ) ;
676+ }
677+
678+ async pageErrors ( ) : Promise < Error [ ] > {
679+ const { errors } = await this . _channel . pageErrors ( ) ;
680+ return errors . map ( error => parseError ( error ) ) ;
681+ }
682+
672683 locator ( selector : string , options ?: LocatorOptions ) : Locator {
673684 return this . mainFrame ( ) . locator ( selector , options ) ;
674685 }
0 commit comments