Forum Discussion
- rraghvaniChampion Level 3
If you use the Object Spy tool, it will list all the exposed properties of the UI Object.
Or do you mean verifying a property, if so, see aqObject.CompareProperty Method
- lodecesaContributor
rraghvani wrote:If you use the Object Spy tool, it will list all the exposed properties of the UI Object.
Or do you mean verifying a property, if so, see aqObject.CompareProperty Method
Sorry, I have corrected my original post. I meant in a script, so via javascript code.
- rraghvaniChampion Level 3
- lodecesaContributor
rraghvani wrote:See aqObject.CheckProperty Method
Thanks but this method evaluate the Value of a Property of an Element and not if the Property exist for the Element
- rraghvaniChampion Level 3
Hopefully, I understand what you mean now. Try this,
function CheckProperty() { const Name = { Firstname: "SmartBear" } Log.Message(Name.Firstname); Log.Message(Name.hasOwnProperty("Firstname")); // true Log.Message(Name.hasOwnProperty("Surname")); // false }
Use "hasOwnProperty()"
- AlexKarasChampion Level 3
Hi,
> if an HTML object has a specific property
I believe that you are looking for how to check if HTML object (actually - html markup for the given element) has not a specific property, but some specific attribute, aren't you?
In this case use the .hasProperty() html built-in method accessible from within TestComplete.
https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute
https://www.w3schools.com/jsref/met_element_hasattribute.asp
- eykxasRegular Contributor
Use this method :
//javascript var hasProperty = aqObject.IsSupported(obj, "property_name");
if "hasProperty" is true, then the property is available on your object and you can interact with. If false, then the property does not exist in your object.
Related Content
- 8 years ago
- 5 years ago
- 8 years ago
Recent Discussions
- 16 hours ago
- 16 hours ago
- 4 days ago