Highlighted
Valued Contributor.
Valued Contributor.
457 views

Setting Swfcheck box to ON will throw error after setting

I have reqiurement to set many Swfcheck boxes, Window that has these checkboxes will automatically close after setting all the check boxes.

Am using the below code to do this and it works fine but after setting the last checkbox window disappears and UFT gives "Cannot find the "The parking brake must" object's parent "Conditions" (class SwfWindow).
Verify that parent properties match an object currently displayed in your application" error. Can anybody help me to resolve this .

 

 

 

My code :

If WpfWindow("Tech Tool").SwfObject("SwfObject").SwfObject("SwfObject").SwfWindow("SwfWindow").SwfWindow("Conditions").Exist(60) Then
        WpfWindow("Tech Tool").SwfObject("SwfObject").SwfObject("SwfObject").SwfWindow("SwfWindow").SwfWindow("Conditions").SwfCheckBox("Have you checked all the field service tips").Set "ON"
        WpfWindow("Tech Tool").SwfObject("SwfObject").SwfObject("SwfObject").SwfWindow("SwfWindow").SwfWindow("Conditions").SwfCheckBox("Have you checked all the sensor values").Set "ON"
        WpfWindow("Tech Tool").SwfObject("SwfObject").SwfObject("SwfObject").SwfWindow("SwfWindow").SwfWindow("Conditions").SwfCheckBox("Have you recorded, checked").Set "ON"
        WpfWindow("Tech Tool").SwfObject("SwfObject").SwfObject("SwfObject").SwfWindow("SwfWindow").SwfWindow("Conditions").SwfCheckBox("Is the software the latest").Set "ON"
        WpfWindow("Tech Tool").SwfObject("SwfObject").SwfObject("SwfObject").SwfWindow("SwfWindow").SwfWindow("Conditions").SwfCheckBox("Please write down the").Set "ON"
        WpfWindow("Tech Tool").SwfObject("SwfObject").SwfObject("SwfObject").SwfWindow("SwfWindow").SwfWindow("Conditions").SwfCheckBox("The engine must be switched").Set "ON"
        WpfWindow("Tech Tool").SwfObject("SwfObject").SwfObject("SwfObject").SwfWindow("SwfWindow").SwfWindow("Conditions").SwfCheckBox("The parking brake must").Set "ON"
    End If
    

 

0 Likes
9 Replies
Highlighted
Knowledge Partner
Knowledge Partner

Re: Setting Swfcheck box to ON will throw error after setting

Have you put a break-point on that line to verify the checkbox is present?

Mark Smith.

0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

Re: Setting Swfcheck box to ON will throw error after setting

Hi Smith,

I can see the window that checkbox is present and it is also checked ( Set ON) and immediately after this window disappears.

I have not used breakpoints.

 

 

0 Likes
Highlighted
Knowledge Partner
Knowledge Partner

Re: Setting Swfcheck box to ON will throw error after setting

What properties are stored in the OR for this and do they match if you spy on the object.

If you always have to check all checkboxes you could use childitem to get the count, then loop thru setting the checkboxes on.

Mark Smith.

0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

Re: Setting Swfcheck box to ON will throw error after setting

Yes Object properties match when I spy it.

I would try the second option of child objects and see if the issue resolves.

Thanks for the suggestion

0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

Re: Setting Swfcheck box to ON will throw error after setting

Hi,

I tried using the below code to set all the checkboxes using child objects but sill am getting error. Checkboxes are set and my application continues but UFT is throwing error.

 

 Set CB = Description.Create
 CB("micclass").Value = "SwfCheckBox"
 If WpfWindow("Tech Tool").SwfObject("SwfObject").SwfObject("SwfObject").SwfWindow("SwfWindow").SwfWindow("Conditions").Exist(60) Then
    Set cCB = WpfWindow("Tech Tool").SwfObject("SwfObject").SwfObject("SwfObject").SwfWindow("SwfWindow").SwfWindow("Conditions").ChildObjects(CB)
         c = cCB.count
         msgbox cCB.count
         For i = 0 to c-1
             chcb = cCB(i).GetROProperty("text")
             msgbox chcb
             cCB(i).Set "ON"   
         Next 

Please find the HTML report attached for your reference.

Please help me in resolving this issue.

 

 

0 Likes
Highlighted
Micro Focus Contributor
Micro Focus Contributor

Re: Setting Swfcheck box to ON will throw error after setting

Hi,

 

Can you provide more information about the issue (like application under test, what version of the .NET  framework you use?)

0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

Re: Setting Swfcheck box to ON will throw error after setting

Hi,

Am using 4.6.2 .Net framework.

My application under test is windows based application called Tech tool. 

Its a complex application built with .Net, Java and WPF. I have attached screen shot of my application.

After checking all the boxes immediately window disappears. I can see that my scirpt will set all the check boxes but after the last check i get an error and my test is always failed.

Untitled.png

0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

Re: Setting Swfcheck box to ON will throw error after setting

Just wanted to confirm sometimes my application will have only 2 conditions to check and sometimes it will be 6 or even more numbers

0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

Re: Setting Swfcheck box to ON will throw error after setting

Anyhelp is highly appreciated !

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.