# How to pass more than one test object as argument to a method in Katalon

**URL:** <https://forum.katalon.com/t/how-to-pass-more-than-one-test-object-as-argument-to-a-method-in-katalon/32984>\
**Category:** Web Testing\
**Tags:** web-testing, katalon-studio\
**Created:** [September 12, 2019, 5:21am UTC](https://forum.katalon.com/t/how-to-pass-more-than-one-test-object-as-argument-to-a-method-in-katalon/32984 "2019-09-12T05:21:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![seshaphani.Matcha](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@seshaphani.Matcha](https://forum.katalon.com/u/seshaphani.Matcha)\
**Post date:** [September 12, 2019, 5:21am UTC](https://forum.katalon.com/t/how-to-pass-more-than-one-test-object-as-argument-to-a-method-in-katalon/32984/1 "2019-09-12T05:21:57Z")

</div>

Hi,

I tried to pass two test objects to a method but it accepts only one Test Object.How to pass two test objects to a method?

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [September 12, 2019, 5:22am UTC](https://forum.katalon.com/t/how-to-pass-more-than-one-test-object-as-argument-to-a-method-in-katalon/32984/2 "2019-09-12T05:22:31Z")

</div>

Hello,

which method do you try to pass two parameters to?

---

<div class="post-metadata">

**Author:** ![seshaphani.Matcha](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@seshaphani.Matcha](https://forum.katalon.com/u/seshaphani.Matcha)\
**Post date:** [September 12, 2019, 5:57am UTC](https://forum.katalon.com/t/how-to-pass-more-than-one-test-object-as-argument-to-a-method-in-katalon/32984/4 "2019-09-12T05:57:00Z")

</div>

I have created a custom keyword which accepts two Test Objects:

def selectMonthAndYear(TestObject testObj1,TestObject testObj2){  
//code definition  
}

While calling the customkeyword in a TestCase(created under Testcase folder), I tried to pass two test objects but it accepts only one testobject as parameter.

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [September 12, 2019, 5:58am UTC](https://forum.katalon.com/t/how-to-pass-more-than-one-test-object-as-argument-to-a-method-in-katalon/32984/5 "2019-09-12T05:58:17Z")

</div>

What error do you get when you enter two TestObjects?

---

<div class="post-metadata">

**Author:** ![seshaphani.Matcha](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@seshaphani.Matcha](https://forum.katalon.com/u/seshaphani.Matcha)\
**Post date:** [September 12, 2019, 6:22am UTC](https://forum.katalon.com/t/how-to-pass-more-than-one-test-object-as-argument-to-a-method-in-katalon/32984/6 "2019-09-12T06:22:41Z")

</div>

Thanks for your time and support.I understood that under object column in test case we can give only one test object but under input we can give remaining test objects.  
 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/7/77acd22777916313c5f0648e9672325c3d20b7ae.png)

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [September 12, 2019, 7:04am UTC](https://forum.katalon.com/t/how-to-pass-more-than-one-test-object-as-argument-to-a-method-in-katalon/32984/7 "2019-09-12T07:04:53Z")

</div>

Oh, I see. Simply switch to script mode and put parameters directly to keyword method.

---

<div class="post-metadata">

**Author:** ![seshaphani.Matcha](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@seshaphani.Matcha](https://forum.katalon.com/u/seshaphani.Matcha)\
**Post date:** [September 12, 2019, 7:11am UTC](https://forum.katalon.com/t/how-to-pass-more-than-one-test-object-as-argument-to-a-method-in-katalon/32984/8 "2019-09-12T07:11:08Z")

</div>

Thanks. And I have a small doubt:

Is there any possible way to create dynamic test objects instead of writing them in scripts?

Ex: Create a test Object under ObjectRepository folder with xpath as “div[@id=’%s’]” and pass values dynamically to that TestObject in script

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [September 12, 2019, 7:17am UTC](https://forum.katalon.com/t/how-to-pass-more-than-one-test-object-as-argument-to-a-method-in-katalon/32984/9 "2019-09-12T07:17:32Z")

</div>

It is, but having them in scripts is IMO better.

> **[Manage Test Object](https://docs.katalon.com/katalon-studio/docs/manage-test-object.html)**
>
> Create a Test Object Select File \> New \> Test Object from the main menu. The New Test Object dialog will display. Provide the name for the new test object, then click OK button. A new...

Read the chapter about parametrizing objects.

---

<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:39am UTC](https://forum.katalon.com/t/how-to-pass-more-than-one-test-object-as-argument-to-a-method-in-katalon/32984/10 "2022-08-08T07:39:54Z")

</div>


