Automation by xpath, object names and values through excel sheet

How can I pass x-path, object names (without adding objects to object repo) and values to test script via excel application and achieve automation??

Any inputs? need urgent help !

If I get it correctly, you have an excel sheet with Xpaths and names and you want to parse it in Katalon?

yes exactly, without adding objects to Repo, I want to open tool and import from data sheet and it should run my scripts…

Is it possible with katalon ?

It is possible, but parsing CSV would be much easier. You can save your Excel sheets as CSV and then parse it in Katalon.

I can do a simple POC for you if you give me a sample file of your data.

Please do a sample project for launching any url in any browser by inputting objects x-paths, object names and values in it… Request you to share the link to download complete Katalon project.

Thank You so much. Looking forward for your reply.

I tried to create such a parser for your file. It is possible, BUT:

1/ It is not possible to create objects dynamically, you have to define them in the test explicitly - when your data file contains 3 object, you have to do following:
TestObject to1 = new TestObject()
TestObject to2 = new TestObject()
TestObject to3 = new TestObject()
… and then it is possible to assign properties using parser script using to1.addProperty() method.

I’d recommend you to rewrite your Excel file into a single custom keyword, where you create all your TestObjects and then initialize it in a test. It may look like this:

And then it is very simple to use them wherever you want:

(you don’t have to create an instance of MyTestObjects as all objects are static).

Please visit this page to get more info about creating TestObjects and manipulating with its properties.

myobj1.png

myobj2.png

1 Like

Thank You so much…

I have one more query:

How can I perform Import/Export operations for excel sheet data into my Katalon Test? Is there any method like HP UFT Import or ImportSheet ?

I am afraid that there is no such an option. What exactly does your sheet contain?

I was planning to write test steps status after execution. is there any way to generate HTML reports or extent reports? I couldn’t navigate to test execution results in my katalon folder.

HTML report is generated after running Test Suite in Katalon. It can be found in Reports folder in your project.

so, I can’t pass x-paths through excel sheet and input it to my script for object identification ?

Any inputs on this approach ?

You can, but the object must exist in Katalon before you add a property from Excel/CSV file.

I have deleted all Objects from Object Repo and I am passing x-paths of objects through an excel sheet and I am able to automate scenarios.

I have used below code for this:

TestObject dynamicObject = new TestObject(‘dynamicObject’).addProperty(‘xpath’, ConditionType.EQUALS, xpath)

WebUI.setText(dynamicObject, inputValue)

Hi Marek,
I am also want to store object/elements in excel. Can you give me a sample of test cases?
Also i have scenario we have product, the product is to test with different client with slight changes.
So i planned to capture the objects in excel with flag as Y. If yes means the steps to execute.

hi lord, i’ve the same problem, is it possible to run automation with object from excel? please help :smiley:

i’ve tried with: WebUI.click(variable)
and it doesn’t work hehe :sweat_smile:

You could do it like @Marek_Melocik mentioned above by creating a TestObject at run time, or you can do a KS/Selenium coding, like below:

yourVariable = ...
varItem = driver.findElement(By.xpath(yourVariable));
WebUI.verifyMatch(varItem.isDisplayed().toString(), "true", false)
varItem.click();

or

thankyou so much @grylion54 and @Marek_Melocik it works!!! :grin: