Click() fails on a button accessed through getAccessibleChild()
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Click() fails on a button accessed through getAccessibleChild()
I am evaluating TestComplete 7.51, and am writing a JScript that will install my application using InstallShield. I want to run the InstallShield and then click on the "Next" button.
Our build server builds the application in a different folder (according to date) every day, so I don't think that I can add the InstallShield to the TestedApps. In my test, I start InstallShield using the windows explorer and get the InstallShield window with
javaw = Sys.WaitProcess("javaw", 600000);
In the InstallShield main window there is a panel with 3 buttons "Cancel" "Previous" and "Next". I get the panel using
PropArray = new Array("JavaClassName", "Visible");
ValuesArray = new Array("ZeroGf9", true);
ConvertedPropArray = ConvertJScriptArray(PropArray);
ConvertedValuesArray = ConvertJScriptArray(ValuesArray);
mainpanel = javaw.FindChild(ConvertedPropArray, ConvertedValuesArray, 8);
Then I find the "Next" button thus:
childno = mainpanel.getAccessibleChildrenCount;
for ( i = 0 ; i < childno ; i ++ )
{
nextbtn1 = mainpanel.getAccessibleChild( i ) ;
if ( nextbtn1.text.equals("Next") )
break;
}
Then I want to click the "Next" button, so I do:
nextbtn1.Click();
but this gives me a Microsoft JScript runtime error: Object doesn't support this property or method
I don't understand why.
If instead I access the "Next" button through Aliases for a particular instance of InstallShield, like this:
Aliases.javaw.frame0.RootPane.null_layeredPane.null_contentPane.ZeroGge.ZeroGf9.ZeroGgb1.Click();
then I can use it. But I don't think that I can use Aliases with an application which is not in the TestedApps and in any case the button names are created dynamically, so they are different every time.
What am I doing wrong?
Best Regards
Tina
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tina,
The Click action is a TC method, and it applies to onscreen objects. In TestComplete, onscreen objects are retrieved through the Child and FindID methods (which are TC methods too). As you are using a native getAccessibleChild method, the retrieved object is not considered as an onscreen object, so, the Click method is not available to this object.
So, to be able to use the Click method for the target object, you need to use the Child method to retrieve the object.
Please see the "Onscreen Object" and "Click Action" help topics for details.
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your suggestion works.
Thank you
Tina
