跳至主要内容

中止

使用以下错误代码之一中止请求:FailedAbortedTimedOutAccessDeniedConnectionClosedConnectionResetConnectionRefusedConnectionAbortedConnectionFailedNameNotResolvedInternetDisconnectedAddressUnreachableBlockedByClientBlockedByResponse

用法
mock.abort(errorCode)
参数
名称类型详细信息
errorCode错误代码响应的错误代码,可以是以下之一:FailedAbortedTimedOutAccessDeniedConnectionClosedConnectionResetConnectionRefusedConnectionAbortedConnectionFailedNameNotResolvedInternetDisconnectedAddressUnreachableBlockedByClientBlockedByResponse
示例
abort.js
it('should block Google Analytics from page', async () => {
const mock = await browser.mock('https://www.google-analytics.com/**')
mock.abort('Failed')
})

欢迎!我如何帮助您?

WebdriverIO AI Copilot