முக்கிய உள்ளடக்கத்திற்குச் செல்லவும்

abortOnce

பின்வரும் பிழைக் குறியீடுகளில் ஒன்றுடன் ஒரு முறை கோரிக்கையை நிறுத்து: Failed, Aborted, TimedOut, AccessDenied, ConnectionClosed, ConnectionReset, ConnectionRefused, ConnectionAborted, ConnectionFailed, NameNotResolved, InternetDisconnected, AddressUnreachable, BlockedByClient, BlockedByResponse.

பயன்பாடு
mock.abortOnce(errorCode)
அளவுருக்கள்
பெயர்வகைவிவரங்கள்
errorCodeErrorCodeபதிலின் பிழைக் குறியீடு, பின்வருவனவற்றில் ஒன்றாக இருக்கலாம்: Failed, Aborted, TimedOut, AccessDenied, ConnectionClosed, ConnectionReset, ConnectionRefused, ConnectionAborted, ConnectionFailed, NameNotResolved, InternetDisconnected, AddressUnreachable, BlockedByClient, BlockedByResponse
எடுத்துக்காட்டு
abortOnce.js
it('should block mock only once', async () => {
const mock = await browser.mock('https://webdriver.io')
mock.abortOnce('Failed')

await browser.url('https://webdriver.io')
// catch failing command as page can't be loaded
.catch(() => {})
console.log(await browser.getTitle()) // outputs: ""

await browser.url('https://webdriver.io')
console.log(await browser.getTitle()) // outputs: "WebdriverIO · Next-gen browser and mobile automation test framework for Node.js"
})

Welcome! How can I help?

WebdriverIO AI Copilot