காத்திருப்பதற்காக
ஒரு உறுப்பு DOM-இல் இருப்பதற்காக வழங்கப்பட்ட மில்லிவினாடிகளுக்கு காத்திருக்கவும். தேர்வுசெய்பவர் DOM-இல் உள்ள குறைந்தபட்சம் ஒரு உறுப்பைப் பொருந்தினால் true ஐத் திருப்பித் தருகிறது, இல்லையெனில் பிழையை எழுப்புகிறது. reverse கொடி true என்றால், தேர்வுசெய்பவர் எந்த உறுப்புகளையும் பொருந்தவில்லை என்றால் கட்டளை true ஐத் திருப்பித் தரும்.
தகவல்
மற்ற உறுப்பு கட்டளைகளுக்கு மாறாக, இந்த கட்டளையை நிறைவேற்ற WebdriverIO உறுப்பு இருப்பதற்காகக் காத்திருக்காது.
பயன்பாடு
$(selector).waitForExist({ timeout, reverse, timeoutMsg, interval })
அளவுருக்கள்
பெயர் | வகை | விவரங்கள் |
---|---|---|
options optional | WaitForOptions | waitForEnabled விருப்பங்கள் (விருப்பமானது) |
options.timeout optional | Number | ms இல் நேரம் (இயல்புநிலை waitforTimeout கட்டமைப்பு மதிப்பின் அடிப்படையில் அமைக்கப்பட்டுள்ளது) |
options.reverse optional | Boolean | true என்றால் அது எதிர்மறைக்காக காத்திருக்கிறது (இயல்புநிலை: false) |
options.timeoutMsg optional | String | இருந்தால் அது இயல்புநிலை பிழை செய்தியை மேலெழுதுகிறது |
options.interval optional | Number | சோதனைகளுக்கு இடையேயான இடைவெளி (இயல்புநிலை: waitforInterval ) |
எடுத்துக்காட்டு
waitForExistSyncExample.js
it('should display a notification message after successful form submit', async () => {
const form = await $('form');
const notification = await $('.notification');
await form.$(".send").click();
await notification.waitForExist({ timeout: 5000 });
expect(await notification.getText()).to.be.equal('Data transmitted successfully!')
});
it('should remove a message after successful form submit', async () => {
const form = await $('form');
const message = await $('.message');
await form.$(".send").click();
await message.waitForExist({ reverse: true });
});
திருப்பி அனுப்புகிறது
- <Boolean>
return
: true if element exists (or doesn't if flag is set)