TestProject Forum

Search specific Field & fetch it's value

hi,
I am new to Testproject.io & try to automate below scenario.

When using search functionality ex. using Name to search all details of user. On successful search, all the details will get displayed on Webpage associated with that Name . Now I want to search the Name on that web page & get it’s value & then compare the same with input Name value.

Can anybody help me on this.

Thanks

Hello @smriti.dalal17
I explain to you how to do this in the following example:
Let’s say I want to do a login test, so I will record typing a username and password into the fields:


and on the next page, I’ll check if my name is contained where the username should be:

To do a verification, you need to stand on the text you want to check with your mouse and double-click the Shift key that will open the menu you see in the image above.
and click on Contains Text.
image
Now, if I want to use a parameter for username, I will go into the step, create a parameter if it does not already exist, and select it:

image

image

so now I can delete my name from the field and save the step:


As you can see in the following image I also replaced the typing I did with the username parameter:

All I have left is to just run the test:

Another thing you can do is to use Get Text action:


add the text to a parameter and use it in your other steps in the test, for example, do verification as I showed you.

Thanks Kfiryo for prompt response. I have done this using get text but there is a slight difference in my scenario. After search, I have to go to Name field & then fetch the value displayed for that field.

Thanks

@smriti.dalal17
I hope it worked for you :slight_smile:
You can do that this way, just adjust it to your scenario.

Hi,
This I have already done. As of now I have fetched the xpath for element where value is coming & then get text. But not able to search a Name field on web page then fetch the value corresponding to this field. This is my issue.
Thanks

@smriti.dalal17
After I get the text I add that to the parameter:

and Save the step

When I want to put him in the field I choose type text action:


and choose the text parameter that I created:


and save the step:


So now if i will run it:

The text will be taken, entered into a parameter, and typed on the field:

Tell me if you were able to do that :slight_smile: