# How To handle Registration Form If the form is dynamic

**URL:** <https://forum.katalon.com/t/how-to-handle-registration-form-if-the-form-is-dynamic/57853>\
**Category:** Web Testing\
**Tags:** releases, web-testing, katalon-studio\
**Created:** [August 31, 2021, 6:24am UTC](https://forum.katalon.com/t/how-to-handle-registration-form-if-the-form-is-dynamic/57853 "2021-08-31T06:24:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![marvinaj12](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marvinaj12/32/11979_2.png) [@marvinaj12](https://forum.katalon.com/u/marvinaj12)\
**Post date:** [August 31, 2021, 6:24am UTC](https://forum.katalon.com/t/how-to-handle-registration-form-if-the-form-is-dynamic/57853/1 "2021-08-31T06:24:36Z")

</div>

Hello Everyone I Want To Ask How To handle an Form if There can show more than one so i can add per person maybe 5 maybe 3 so the form will showing with the count i add person i already use while do but i still stuck when i adding person

 ![image](https://europe1.discourse-cdn.com/katalon/original/3X/1/4/1485a20272cece21fc20cf32fd08cc2c498be653.png)  
this is the form sample, thanks for the help

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [August 31, 2021, 8:13pm UTC](https://forum.katalon.com/t/how-to-handle-registration-form-if-the-form-is-dynamic/57853/2 "2021-08-31T20:13:57Z")

</div>

Does the text, “Adult Traveller x”, appear before every Form set?

```auto
boolean hasDone = false;
int counter = 1;

while (!hasDone) {
   if (WebUI.verifyTextPresent("Adult Traveller ${counter}", false)) {
      // fill in form
   } else {
      hasDone = true;
   }
   counter++
}

```

I am making an assumption that the Forms are given an array style identification.

---

<div class="post-metadata">

**Author:** ![marvinaj12](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marvinaj12/32/11979_2.png) [@marvinaj12](https://forum.katalon.com/u/marvinaj12)\
**Post date:** [September 1, 2021, 10:28am UTC](https://forum.katalon.com/t/how-to-handle-registration-form-if-the-form-is-dynamic/57853/3 "2021-09-01T10:28:27Z")

</div>

There Had 3 Passager Adult, Infant, and Child so id will add up the text will following example 1 Adult Traveler , 2 Adult Traveler, 1 Child Traveler so The Text Will Follow up when i adding pasanger type

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [September 1, 2021, 3:31pm UTC](https://forum.katalon.com/t/how-to-handle-registration-form-if-the-form-is-dynamic/57853/4 "2021-09-01T15:31:59Z")

</div>

You still might be able to do something similar if the Form sets have an array style of identification (maybe the first Traveler’s **Last Name** textbox has an attribute like `name=box __0_lastname`, the second Traveler’s **Last Name** textbox is like `name=box__ 1_lastname` and the third is like `name=box__2_lastname`. You can check if the next “lastname” textbox element exists and if it does, fill in the form. You will have to check the HTML if this is the case.

---

<div class="post-metadata">

**Author:** ![marvinaj12](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marvinaj12/32/11979_2.png) [@marvinaj12](https://forum.katalon.com/u/marvinaj12)\
**Post date:** [September 2, 2021, 3:34am UTC](https://forum.katalon.com/t/how-to-handle-registration-form-if-the-form-is-dynamic/57853/5 "2021-09-02T03:34:10Z")

</div>

Okay Let Me Try It, Thanks For the Information

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [September 3, 2021, 8:18pm UTC](https://forum.katalon.com/t/how-to-handle-registration-form-if-the-form-is-dynamic/57853/6 "2021-09-03T20:18:59Z")

</div>

Another thought if the Form set has a similar pattern at a “Form” level (or maybe just above). Then you could collect that level in a `List<WebElement>` and get the **number** of Form sets. With that, you could just do a For loop with or without a Case block (with each block calling a Keyword) to fill in the form.

> **Maybe like:**
>
> ```auto
> WebDriver driver = DriverFactory.getWebDriver();
> List<WebElement> formItems = driver.findElements(By.xpath('your common path here'));
> int maxForms = formItems.size(); 
> Loop:
> for (int irow = 0; irow < maxForms; irow++)
> {
> 
> ```
