TestProject Forum
Powered by leading experts in the test automation community

Is there a way to capture the parameters from the recorded tests and use them in Coded tests that follow next

e.g: I have a parameter text
My coded test which is the next step has to take that parameter and perform certain tasks and also vice versa. I only found traces of this in the documentation would appreciate it if you would explain the details

Hi @SaiPreetham,

TestProject allows you to combine coded tests inside your recorded tests. You can also pass parameters from the recorded test to the coded test and vice versa.

Let’s say you have a parameter in your recorded test and you want to pass it to the coded test. To do so, you need to define an input parameter in your coded test. Here’s an example:
image

Now, if you will add the coded test as a step inside the recorded test, you will be able to pass a parameter to the “keys” parameter you defined in the coded test.

You can do the same with output parameters. If you will define an output parameter in your coded test, you will be able to export parameters to the recorded test.

Let me know if you have further questions :slight_smile:

Kind regards,
Amit

Thanks for the reply. I am a little confused regarding the defining parameters part. SO I defined a parameter and placed a text I grabbed in that. Then in my coded test, I defined the parameter with the same name and the used it. Now when I use this coded test in my test Should I create a new parameter with the same name or pass it the old parameter without creating the parameter?

You don’t need to use the same name.
In your coded test, you should create an input parameter. Let’s call this parameter firstName.
Now, in your recorded test, when you add your coded test as a step to it, you will have the option to pass value to this “firstName” parameter that you created before.

Ok That worked. Now I am curious Can I natively grab the attribute of an element into a parameter?
I used an addon but I am getting Null Pointer Exception.

You want to get an attribute of an element from the recorder and pass it on to the coded test?

Yes
I want the xpath of an element in a parameter. So I can use it

You can use the action “Get Xpath” and save the result in an output parameter. Then, simplr pass it to the coded test as an input parameter.

Yes I saw that and tried to use it but I am getting Null Pointer Exception when I used it

What did you do exactly? I want to try it myself too.

I created a parameter say xpathOfElement. And then selected the Get Xpath from the Actions menu. When I run this It gives me null pointer exception.image

I just tried to get the XPath value of an element and it’s working fine:

When exactly it’s failing?

I did the exact same thing. Just so we are on the same page you are using the Element Extensions Addon right? If so then idk why its failing It’s always showing Null pointer exception
image

I can see that there’s a difference in the action name. Very weird. Can you go to the Addons page and check if theres’s an update for this addon? Maybe you are using an old version.

image There is no check for updates option Should i reinstall it?

Let’s try something else. Can you please move your mouse to the element and click twice on the shift button? Then, under “Actions”, search for “Get Xpath”. Let me know if this action is working.

Haha I was just about to send that as well
image

Ohhh just noticed that you are testing Android app. I confused it with web. Let me test it myself for Android.

OK, so there’s indeed an issue with the “Get XPath” for Android. We will fix that and keep you updated.
Thank you for bringing it to our attention :slight_smile:

No Problem Please update me once it’s done.
Thank you for your help