Forum Discussion
Well, what errors are you getting, first of all, because that will help us know better what EXACTLY is going wrong.
But suffice it to say, you need to Name as EXACTLY the string as it shows in Object Browser. So, if the string shwos as ["Panel"](2) then you need to present that as a string.
So... I don't know C#Script well, but I'm assuming that the code should be something more like
ChildObjectName = "[\"Panel\"](2)"
Because the C# Script language base in TestComplete has it's root in JScript, you need the slash (\) characters before the double quotes to indicate that you are using the double quotes.
Sorry,
Should have mentioned that that syntax doesn't work either. :(
- tristaanogre8 years agoEsteemed Contributor
So, what do you get in the way of errors, if any?
Have you tried the following?
ChildObjectName = "[\"Panel\"](2)" if (Obj["WaitChild"](ChildObjectName, 10000)["Exists"])
According to the help documentation, (https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/waitchild-method.html), that second parameter, if it's set to 0, will return immediately... even if the object is not found. By changing it to 10000, it actually sets a maximum time to wait for the object to appear. It COULD be that the object may have a delay before it "Exists" and you need to actually wait for it.
- bo_roop8 years agoContributor
Good grief!
So as I was waiting 10000ms for the panel to be missing, it was found! Seems there's a 2nd panel(2) that exists when my first condition doesn't happen. So essentially, my code is always falling into the true section of the if statement which made me believe that the false was never being triggered.
Ugh.
Is it Friday yet? :)
- tristaanogre8 years agoEsteemed Contributor
This is one reason why depending upon a single property (like Name) is insufficient for object identification... there are two objects that potentially are identified as ["Panel"](2)... what makes them unique? is there a className that distinguishes them? innerText? contentText? etc...
This is why "FindChild" has arrays as the first two parameters... an array of property names and an array of property values so, again, you're not dependant upon a single property...
AND... again... this is why NameMapping works the way it does... it works on that same "Child" object principle... look for a child of the parent objects with this set of property/value pairs...
Related Content
- 6 years ago
- 8 years ago
Recent Discussions
- 12 hours ago