メインコンテンツにスキップ

abort(中止)

以下のエラーコードのいずれかでリクエストを中止します: Failed, Aborted, TimedOut, AccessDenied, ConnectionClosed, ConnectionReset, ConnectionRefused, ConnectionAborted, ConnectionFailed, NameNotResolved, InternetDisconnected, AddressUnreachable, BlockedByClient, BlockedByResponse.

使用方法
mock.abort(errorCode)
パラメータ
名前タイプ詳細
errorCodeErrorCodeレスポンスのエラーコード。次のいずれかを指定できます:Failed, Aborted, TimedOut, AccessDenied, ConnectionClosed, ConnectionReset, ConnectionRefused, ConnectionAborted, ConnectionFailed, NameNotResolved, InternetDisconnected, AddressUnreachable, BlockedByClient, BlockedByResponse
abort.js
it('should block Google Analytics from page', async () => {
const mock = await browser.mock('https://www.google-analytics.com/**')
mock.abort('Failed')
})

Welcome! How can I help?

WebdriverIO AI Copilot