# Do-While loop is not working Katalon 9.0.0

**URL:** <https://forum.katalon.com/t/do-while-loop-is-not-working-katalon-9-0-0/103771>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [November 7, 2023, 2:45pm UTC](https://forum.katalon.com/t/do-while-loop-is-not-working-katalon-9-0-0/103771 "2023-11-07T14:45:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhilario](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jhilario/32/27475_2.png) [@jhilario](https://forum.katalon.com/u/jhilario)\
**Post date:** [November 7, 2023, 2:45pm UTC](https://forum.katalon.com/t/do-while-loop-is-not-working-katalon-9-0-0/103771/1 "2023-11-07T14:45:28Z")

</div>

Since Groovy 3.0.0.0 was introduced in the new version of Katalon 9.0.0, I understood that the Do-While loop could be used. I tried the following code but got the error:  
Groovy:unexpected token: do Utils.groovy

````auto
		do {
			element = driver.findElementByIosNsPredicate("label == '${text}'")
			if (!element.isDisplayed()) {
				Mobile.swipe(startX, startY, startX, endY)
			}
		} while (!element.isDisplayed())```
````

---

<div class="post-metadata">

**Author:** ![duyluong](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/duyluong/32/1116_2.png) [@duyluong](https://forum.katalon.com/u/duyluong)\
**Post date:** [November 7, 2023, 6:49pm UTC](https://forum.katalon.com/t/do-while-loop-is-not-working-katalon-9-0-0/103771/2 "2023-11-07T18:49:11Z")

</div>

Assigned @duc.tnguyen on November 7, 2023, 6:49pm UTC



---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [November 8, 2023, 12:20am UTC](https://forum.katalon.com/t/do-while-loop-is-not-working-katalon-9-0-0/103771/3 "2023-11-08T00:20:41Z")

</div>

Do … while does not work for me as well.

 ![Screenshot 2023-11-08 at 9.18.56](https://europe1.discourse-cdn.com/katalon/original/3X/1/d/1d9a6e01480e5cb8e5cc0c0cf3ea032751ca9876.jpeg)

---

<div class="post-metadata">

**Author:** ![duc.tnguyen](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/duc.tnguyen/32/21936_2.png) [@duc.tnguyen](https://forum.katalon.com/u/duc.tnguyen)\
**Post date:** [November 8, 2023, 3:24am UTC](https://forum.katalon.com/t/do-while-loop-is-not-working-katalon-9-0-0/103771/4 "2023-11-08T03:24:29Z")

</div>

Hi @jhilario, @kazurayam  
If you want to use Groovy Syntax 3.0, please follow the below steps:

- Go to Katalon execution folder
- open katalon.ini
- add `-Dgroovy.antlr4=true` in the end of the file and save
- Restart Katalon Studio

Hope it can help 😆

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [November 8, 2023, 6:07am UTC](https://forum.katalon.com/t/do-while-loop-is-not-working-katalon-9-0-0/103771/5 "2023-11-08T06:07:40Z")

</div>

> [@duc.tnguyen](#):
>
> -Dgroovy.antlr4=true

I tried it, but doesn’t work in the Katalon Studio Arm64 binary.

I read an article

> **[Trying out Apache Groovy's new Antlr4 parser with Java 8 support](https://glaforge.dev/posts/2017/05/29/trying-out-apache-groovy-new-antlr4-parser-with-java-8-support/)**
>
> Apache Groovy is coming up with a new parser, that supports the Java 8 syntax elements, as well as some new notation and operators of its own (like !in, !instanceof or ?\[\] for safe navigation with collections, or with ?= for Elvis assignment). I...

According to this article, there is one more necessary step. It says

> Build Apache Groovy from the master branch with the Antlr4 parser:

```auto
./gradlew -PuseAntlr4=true installGroovy

```

I guess the Groovy parser bundled in the Katalon Studio Arm64-9.0 binary was NOT built with the Antlr4 parser.

By the way, I personally don’t need the `do ... while` syntax. Just I was interested in this topic.

---

<div class="post-metadata">

**Author:** ![jhilario](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jhilario/32/27475_2.png) [@jhilario](https://forum.katalon.com/u/jhilario)\
**Post date:** [November 8, 2023, 4:37pm UTC](https://forum.katalon.com/t/do-while-loop-is-not-working-katalon-9-0-0/103771/6 "2023-11-08T16:37:18Z")

</div>

Can you explain more this step

```auto
./gradlew -PuseAntlr4=true installGroovy

```

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [November 8, 2023, 6:11pm UTC](https://forum.katalon.com/t/do-while-loop-is-not-working-katalon-9-0-0/103771/7 "2023-11-08T18:11:07Z")

</div>

The article “[Trying out Apache Groovy's new Antlr4 parser with Java 8 support](https://glaforge.dev/posts/2017/05/29/trying-out-apache-groovy-new-antlr4-parser-with-java-8-support/)” explains that the command is _to build Groovy with the new Parser_ which recognizes the “do … while” syntax. The new Parser is generated using [ANTLR4](https://www.baeldung.com/java-antlr), a Parser Generator. The code name of the new Parser is [Parrot](https://github.com/daniellansun/groovy-parser).

I guess that `Katalon Studio Arm64.app` as v9.0.0 does not contain Groovy built with Parrot. It contains Groovy built with previous parser.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [November 8, 2023, 6:28pm UTC](https://forum.katalon.com/t/do-while-loop-is-not-working-katalon-9-0-0/103771/8 "2023-11-08T18:28:15Z")

</div>

I found that Katalon Studio Arm64.app as v9.0.0 contains Groovy v3.0.17.

 ![Screenshot 2023-11-09 at 3.20.39](https://europe1.discourse-cdn.com/katalon/original/3X/c/4/c4def7dc1a70120bfbfdf49211c839292ac27461.jpeg)

So I may be wrong in saying that Katalon Studio Arm64.app as v9.0.0 does NOT contain Groovy appropriately built to support `do ... while ...` syntax.

Then do not know why the instruction by @duc.tnguyen does not work.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [November 8, 2023, 11:56pm UTC](https://forum.katalon.com/t/do-while-loop-is-not-working-katalon-9-0-0/103771/9 "2023-11-08T23:56:56Z")

</div>

@duc.tnguyen 's instruction worked for me.

I made a silly typing mistake in the `katalon.ini`.

Wrong:

```auto
ーDgroovy.antlr4=true

```

Right:

```auto
-Dgroovy.antlr4=true

```

---

<div class="post-metadata">

**Author:** ![jhilario](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jhilario/32/27475_2.png) [@jhilario](https://forum.katalon.com/u/jhilario)\
**Post date:** [November 22, 2023, 6:43pm UTC](https://forum.katalon.com/t/do-while-loop-is-not-working-katalon-9-0-0/103771/10 "2023-11-22T18:43:18Z")

</div>

This works for me!! Thanks!! 👌
