cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to access the checkbox object

SOLVED
ssv
Occasional Contributor

Unable to access the checkbox object

I am trying to perform an upgrade tests.

In the upgrade tests dialog, there are 4 objects.

 

The first one is "Uninstall earlier version", which is a checkbox, eventhough the object mapping says Button, with the object mapping of "Window("Button","",1)", the object Type is CheckBox

 

Then we have three buttons, "Back", "Next" and "Cancel", their object Types are Button. The BACK and NEXT button are disabled untill we have checked the "Checkbox" of "Uninstall earlier Version". When trying to access the "uninstall earlier version", the button of "Cancel" is clicked.

 

To be put in more detail, if i consider the "uninstall earlier version" as a button,  "mainDialog.Window("Button", "", 1)", then the cancel button object is clicked, eventhough the mapped object name of cancel button is Button("Cancel").

 

And if i consider it as a checkbox object, i get the "Invalid procedure call or argument", the code for that checkbox goes as follows, 

 

If mainDialog.Window("Button", "", 1).wState = cbUnchecked Then
        mainDialog.Window("Button", "", 1).wState = cbChecked
End If

 

Any help on solving this problem is highly appreciated.

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Unable to access the checkbox object

I'm not a VB guru so forgive bad code syntax.  Also, your first screenshot showing the Standard view of the preoprties cuts off at WndStylesEx.  Other than the Extended options in the second shot, I'm assuming there are no other properties?

 

That said, instead of using Window("Button", "", 1) to identify it, you can do a FindChild call.  It would look something like this

 

If mainDialog.FindChild(["ObjectType", "ObjectIdentifier"], ["Checkbox", "0"], 1).wState = cbUnchecked Then
        mainDialog.FindChild(["ObjectType", "ObjectIdentifier"], ["Checkbox", "0"], 1).wState = cbChecked
End If

Some articles for your reading pleasure:

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/findch...

 

And, I would suggest you investigate using NameMapping for object identification.  Please review

 

https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/over...


Robert Martin
[Community Expert Group]
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
Extensions available
3 REPLIES 3
Community Hero

Re: Unable to access the checkbox object

Using the object spy, please post the full advanced list of the properties and methods of the checkbox object.

Just as a side note: "mapped" is a particular term in TestComplete which means that an object is identified within the NameMapping module of the tool.  So... to clarify, when you say "the object mapping says Button", do you mean that you have something mapped in NameMapping for this object?


Robert Martin
[Community Expert Group]
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
Extensions available
ssv
Occasional Contributor

Re: Unable to access the checkbox object

I have attached the screenshots

Community Hero

Re: Unable to access the checkbox object

I'm not a VB guru so forgive bad code syntax.  Also, your first screenshot showing the Standard view of the preoprties cuts off at WndStylesEx.  Other than the Extended options in the second shot, I'm assuming there are no other properties?

 

That said, instead of using Window("Button", "", 1) to identify it, you can do a FindChild call.  It would look something like this

 

If mainDialog.FindChild(["ObjectType", "ObjectIdentifier"], ["Checkbox", "0"], 1).wState = cbUnchecked Then
        mainDialog.FindChild(["ObjectType", "ObjectIdentifier"], ["Checkbox", "0"], 1).wState = cbChecked
End If

Some articles for your reading pleasure:

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/findch...

 

And, I would suggest you investigate using NameMapping for object identification.  Please review

 

https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/over...


Robert Martin
[Community Expert Group]
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
Extensions available
New Here?
Join us and watch the welcome video:
6 / 7 API Testing Mistakes Video
Top Kudoed Authors