cancel
Showing results for 
Search instead for 
Did you mean: 

How to Find the value in a specified object

Highlighted
Occasional Contributor

How to Find the value in a specified object

Hi,

 

I m unable to get the value that has been available in a specified field, it is a numerical value which is present during the run time.

Is there any ways to find the return type of an object or variable.

5 REPLIES 5
Highlighted
Community Hero

Re: How to Find the value in a specified object

I'm not sure I understand the question.  You're having problems finding the value of a property of an object (probably wText or something like that, I'm assuming), is that correct?  If you're having problems finding that value, how will returning the object type help?

 

Can you share your code?  What error messages are you experiencing? What script language are you using?


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Occasional Contributor

Re: How to Find the value in a specified object

else if(ProjectSuite.Variables.Type == "checkpoint1")

{

var value1= aqObject.GetPropertyValue(Sys.Browser(ProjectSuite.Variables.browser).

Page(ProjectSuite.Variables.Page).document.frames.Frame("ilboinnerframe").document.all.Item(ProjectSuite.Variables.Item),"innerText");

var value5 = aqConvert.StrToInt(value1);

Log.Message(value5);

}

else if(ProjectSuite.Variables.Type == "checkpoint2")

{

var value2 = aqObject.GetPropertyValue(Sys.Browser(ProjectSuite.Variables.browser).

Page(ProjectSuite.Variables.Page).document.frames.Frame("ilboinnerframe").document.all.Item(ProjectSuite.Variables.Item),"innerText");

var value6 = aqConvert.StrToInt(value2);

Log.Message(value6);

var vaule3 = value5 * value6;

Log.Message(vaule3);

}

else if(ProjectSuite.Variables.Type == "checkpoint")

{ aqObject.CheckProperty(Sys.Browser(ProjectSuite.Variables.browser).Page(ProjectSuite.Variables.Page).document.frames.Frame("ilboinnerframe").document.all.Item(ProjectSuite.Variables.Item),"innerText", cmpEqual,vaule3);

Message.Message(); // calling the message function

}

 

 

Hi,

In the above code, The var value3 return only Nan(not a Number) value after the multiplication is done and I m unable to get the actual output value in var value3 so, I can't proceed with property checkpoint line.

Highlighted
Community Hero

Re: How to Find the value in a specified object

Hi,

 

> if(ProjectSuite.Variables.Type == "checkpoint1")

.Type does not seem to be a property of the Variables object. Where did you get this line of code from?

 

> aqObject.GetPropertyValue(Sys.Browser [...]

Any real need for this complexity?

Why not to use just

Sys.Browser(ProjectSuite.Variables.browser).Page(ProjectSuite.Variables.Page).document.frames.Frame("ilboinnerframe").document.all.Item(ProjectSuite.Variables.Item).innerText ?

 

Also note, that you are using .document property of Page object which means that you are working with native DOM. This means that, for example, innerText property may not exist for some browser: https://support.smartbear.com/testcomplete/docs/app-testing/web/general/cross-browser/handling-diffe...

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Contributor

Re: How to Find the value in a specified object

If your requirement is to retrieve the innerhtml value
Instead of using
*aqObject.GetPropertyValue(Sys.Browser(ProjectSuite.Variables.browser).
Page(ProjectSuite.Variables.Page).document.frames.Frame("ilboinnerframe").document.all.Item(ProjectSuite.Variables.Item),"innerText")*
Please find the object and then retrieve the property of that object by giving .property_name( Sys.Browser(ProjectSuite.Variables.browser).page(ProjectSuite.Variables.Page).document.frames.Frame("ilboinnerframe").document.all.Item(ProjectSuite.Variables.Item).innerTex)

And after receiving the value of the required object just compare with ur value using one condition
Regards,
Sathish Kumar K
Highlighted
Community Manager

Re: How to Find the value in a specified object

Thanks for the help, AlexKaras, K_Sathish_Kumar, tristaanogre!

 

@Arunachalam, do the suggestions given here help you resolve the issue?

 

 

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Top Kudoed Authors