@@ -3231,6 +3231,29 @@ export interface Locator {
32313231 */
32323232 press ( key : string , options ?: KeyboardPressOptions ) : Promise < void > ;
32333233
3234+ /**
3235+ * Focuses the element and then sends a `keydown`, `keypress`/`input`, and
3236+ * `keyup` event for each character in the text.
3237+ *
3238+ * This method is useful for simulating real user typing behavior when the page
3239+ * has special keyboard event handling, such as input validation or autocomplete.
3240+ * For simple text input without special keyboard handling, use {@link fill | fill()}
3241+ * instead as it's faster and more reliable.
3242+ *
3243+ * @example
3244+ * ```js
3245+ * // Type text instantly
3246+ * await locator.pressSequentially('Hello World');
3247+ *
3248+ * // Type text with delay between keypresses (like a real user)
3249+ * await locator.pressSequentially('Hello World', { delay: 100 });
3250+ * ```
3251+ *
3252+ * @param text Text to type into the focused element character by character.
3253+ * @param options Typing options.
3254+ */
3255+ pressSequentially ( text : string , options ?: KeyboardPressOptions ) : Promise < void > ;
3256+
32343257 /**
32353258 * Type a text into the input field.
32363259 * @param text Text to type into the input field.
@@ -5693,6 +5716,120 @@ export interface Page {
56935716 } ,
56945717 ) : Promise < Request | null > ;
56955718
5719+ /**
5720+ * Waits for the specified event to be emitted.
5721+ *
5722+ * This method blocks until the event is captured or the timeout is reached.
5723+ * Supported event types are `console`, `request`, or `response`.
5724+ *
5725+ * @example
5726+ * ```js
5727+ * // Wait for a console message containing 'hello'
5728+ * const msgPromise = page.waitForEvent('console', msg => msg.text().includes('hello'));
5729+ * await page.evaluate(() => console.log('hello world'));
5730+ * const msg = await msgPromise;
5731+ * ```
5732+ *
5733+ * @param event Event name to wait for: `'console'`.
5734+ * @param optionsOrPredicate Either a predicate function or an options object.
5735+ */
5736+ waitForEvent (
5737+ event : "console" ,
5738+ optionsOrPredicate ?:
5739+ | ( ( msg : ConsoleMessage ) => boolean )
5740+ | {
5741+ /**
5742+ * Predicate function that returns `true` when the expected event is received.
5743+ */
5744+ predicate ?: ( msg : ConsoleMessage ) => boolean ;
5745+ /**
5746+ * Maximum time to wait in milliseconds. Defaults to `30` seconds.
5747+ * The default value can be changed via the
5748+ * browserContext.setDefaultTimeout(timeout) or
5749+ * page.setDefaultTimeout(timeout) methods.
5750+ *
5751+ * Setting the value to `0` will disable the timeout.
5752+ */
5753+ timeout ?: number ;
5754+ } ,
5755+ ) : Promise < ConsoleMessage > ;
5756+
5757+ /**
5758+ * Waits for the specified event to be emitted.
5759+ *
5760+ * This method blocks until the event is captured or the timeout is reached.
5761+ * It can wait for any page event such as `console`, `request`, or `response`.
5762+ *
5763+ * @example
5764+ * ```js
5765+ * // Wait for a request to a specific URL
5766+ * const reqPromise = page.waitForEvent('request', req => req.url().includes('/api'));
5767+ * await page.click('button');
5768+ * const req = await reqPromise;
5769+ * ```
5770+ *
5771+ * @param event Event name to wait for: `'request'`.
5772+ * @param optionsOrPredicate Either a predicate function or an options object.
5773+ */
5774+ waitForEvent (
5775+ event : "request" ,
5776+ optionsOrPredicate ?:
5777+ | ( ( req : Request ) => boolean )
5778+ | {
5779+ /**
5780+ * Predicate function that returns `true` when the expected event is received.
5781+ */
5782+ predicate ?: ( req : Request ) => boolean ;
5783+ /**
5784+ * Maximum time to wait in milliseconds. Defaults to `30` seconds.
5785+ * The default value can be changed via the
5786+ * browserContext.setDefaultTimeout(timeout) or
5787+ * page.setDefaultTimeout(timeout) methods.
5788+ *
5789+ * Setting the value to `0` will disable the timeout.
5790+ */
5791+ timeout ?: number ;
5792+ } ,
5793+ ) : Promise < Request > ;
5794+
5795+ /**
5796+ * Waits for the specified event to be emitted.
5797+ *
5798+ * This method blocks until the event is captured or the timeout is reached.
5799+ * It can wait for any page event such as `console`, `request`, or `response`.
5800+ *
5801+ * @example
5802+ * ```js
5803+ * // Wait for a response from a specific URL
5804+ * const resPromise = page.waitForEvent('response', res => res.url().includes('/api'));
5805+ * await page.click('button');
5806+ * const res = await resPromise;
5807+ * ```
5808+ *
5809+ * @param event Event name to wait for: `'response'`.
5810+ * @param optionsOrPredicate Either a predicate function or an options object.
5811+ */
5812+ waitForEvent (
5813+ event : "response" ,
5814+ optionsOrPredicate ?:
5815+ | ( ( res : Response ) => boolean )
5816+ | {
5817+ /**
5818+ * Predicate function that returns `true` when the expected event is received.
5819+ */
5820+ predicate ?: ( res : Response ) => boolean ;
5821+ /**
5822+ * Maximum time to wait in milliseconds. Defaults to `30` seconds.
5823+ * The default value can be changed via the
5824+ * browserContext.setDefaultTimeout(timeout) or
5825+ * page.setDefaultTimeout(timeout) methods.
5826+ *
5827+ * Setting the value to `0` will disable the timeout.
5828+ */
5829+ timeout ?: number ;
5830+ } ,
5831+ ) : Promise < Response > ;
5832+
56965833 /**
56975834 * **NOTE** Use web assertions that assert visibility or a locator-based
56985835 * locator.waitFor([options]) instead.
0 commit comments