From c3408a44b5b09e74e237d85d010fc9c63dd5f5a5 Mon Sep 17 00:00:00 2001 From: shadowusr Date: Sat, 2 May 2026 23:58:35 +0300 Subject: [PATCH] fix: do not retry errors with code timeout from webdriver --- packages/webdriver/src/request/index.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/webdriver/src/request/index.ts b/packages/webdriver/src/request/index.ts index cb3f19463dd..561336caba8 100644 --- a/packages/webdriver/src/request/index.ts +++ b/packages/webdriver/src/request/index.ts @@ -287,6 +287,17 @@ export default abstract class WebDriverRequest extends EventEmitter { throw error } + /** + * W3C `timeout` (e.g. page load timeout) means the driver already enforced the + * configured timeout. Retrying would spend more time than was configured, so terminate immediately. + */ + if (error.name === 'timeout') { + log.debug('Request timed out on the driver side - terminating request without retry') + this.emit('response', { error }) + this.emit('performance', { request: fullRequestOptions, durationMillisecond, success: false, error, retryCount }) + throw error + } + return retry(error, `Request failed with status ${response.statusCode} due to ${error.message}`) } }