# While statement

**URL:** <https://forum.katalon.com/t/while-statement/14598>\
**Category:** Miscellaneous\
**Created:** [December 5, 2018, 1:10am UTC](https://forum.katalon.com/t/while-statement/14598 "2018-12-05T01:10:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arti\_Mahida](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Arti\_Mahida](https://forum.katalon.com/u/Arti_Mahida)\
**Post date:** [December 5, 2018, 1:10am UTC](https://forum.katalon.com/t/while-statement/14598/1 "2018-12-05T01:10:06Z")

</div>

if (WebUI.verifyElementPresent(findTestObject(‘Object Repository/New  
Folder/Page\_Your store. Wishlist/input\_245.00\_updatecart’),  
5) == true) {  
while (WebUI.verifyElementPresent(findTestObject(‘New Folder/Page\_Your store. Wishlist/h1\_Wishlist’), 5) == true) {  
WebUI.click(findTestObject(‘Object Repository/New Folder/Page\_Your store. Wishlist/input\_Remove\_removefromcart’))

```
    WebUI.click(findTestObject('Object Repository/New Folder/Page\_Your store. Wishlist/input\_245.00_updatecart'))  
}  
  
WebUI.verifyTextPresent('The wishlist is empty!', false)  

```

} else {  
}

first  
time it successfully run till the 1st while but 2nd time again it will  
go to find the while and fails the test case i am not getting how it  
will break and stop the while condition ?

---

<div class="post-metadata">

**Author:** ![albert.vu](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/albert.vu/32/20595_2.png) [@albert.vu](https://forum.katalon.com/u/albert.vu)\
**Post date:** [August 8, 2022, 7:02am UTC](https://forum.katalon.com/t/while-statement/14598/2 "2022-08-08T07:02:22Z")

</div>

Archived on August 8, 2022, 7:02am UTC


