Dynamic xpath in Frame having div tags

I m working on a application developed in jqwidgets. Now there is grid which has certain rows. These are dynamic rows and for each row there are placeholder of City and Phone number. Now I want to select a row and then based on the selected row I have to enter it’s city and phone number.
The aplication is developed under Frame and all the places div tag is used.
I have made Test Object using the text() of row and then for City and Phone number used the same text() with following siblings.
For my complete test case I m using CSV to import value but in the above condition I m not able to use it.
For the row I use xpath = //div[@text()=‘username’] and I created it in Test Repository
How to pass variable in place of username , so I can use that variable and call different values from CSV.

You seem to have 2 challenges.

First, you need to make a Test Object applicable to a element inside iframe.
Second, you need to parameterize a Test Object for username data.

As for iframe, read the document https://docs.katalon.com/katalon-studio/docs/manage-test-object.html#manage-parent-object, especially “Manage parent object” section.

As for parameterizing, read the document https://docs.katalon.com/katalon-studio/docs/parameterize-webmobile-test-object-properties.html

1 Like

I already did both this.
My problem is to pass variable in xpath for my test case.
There are five rows each having name as A, B,C,D,E and different logins can have different names . now it’s xpath is dynamic. I have setup Test Obeject , Name = //div(@text() = ‘C’) to select row 3.
I my test case I wrote WebUI.click (findTestObject(“Name”))
My problem is in place of C I need to make it dynamic so that when I can pass those values in excel n directly call it .

@kazurayam linked you the documentation you would need to do this:

In your test object, your xpath should look like:


And you would call it like this:

WebUI.click(findTestObject("Name", ["text" : "C"]))

Ok I will try this . This is the first part done
Now the big issue is the five rows which I have each have two boxes City and Phone number.
Like this
A (City) (PhoneNumber)
B (City) (PhoneNumber)
C (City) (PhoneNumber)
D (City) (PhoneNumber)
E (City) (PhoneNumber)

Now as per ur solution we can solve the problem to select the row. But now I have to click the text box of City and then Phone number to enter values.
Previously I used siblings method to select the box. Hard coded values based on the row selection.

Now what can we do . Is there any way this can also be done dynamic ?

Sure, just adjust your xpath:


Awsm. Will surely try this approach.

Few quick question I know it is not related to this thread.

Que 1. If I want to put delay after a test step I use WebUI.delay(1) but it is very confusing.
Is there any way I can use it within my test step.
Ex - I have following steps in test case
A) I click on drop down scroll
B) I clear text of the box
C) I enter value in the box
D) I again click on drop down scroll to close it
E) I click on next text box
Instead of applying delay after each steps can I apply delay on the test step only ?

Que 2 - As I am passing test cases from excel . Can I validate those data and print them in the log also ?

Que 3 - How to handle date picker in a frame? I m not able to pass it through excel file ?

Que 4 -After placing request form , system generate it’s request id. Can we capture that id in the excel so we can use it as a reference for other test case ?

Thanks for the help

I’m not sure I understand. You can use WebUI.delay() anywhere you want.

Sure. To validate:

assert data.equals("expected value");

To print:


You handle date pickers just like any other set of elements on a web page. Create test objects with xpaths, click, send keys, etc.

You would get the request using an xpath again. Storing it in your excel data is a little tricky, and should probably have its own topic.

Ok will create separate topic for point 4, will try remaining points . Thanks

In the meantime, I’m going to mark @kazurayam’s answer as the solution, as he technically gave you everything you would need for this topic.

1 Like

Can I try once today then will let you know if the solution works for me or not

Pls close this topic…It worked… I was just not writing the syntax properly.