Ask a Question

Testing Modal Windows

SOLVED
kandy1984
Contributor

Testing Modal Windows

Hi,

 

I am trying to perform some actions on a modal form (click on Cancel button) which opens when i clicked on the green '+' button. I have read about it in http://support.smartbear.com/viewarticle/72921/ . In this topic, it has asked me to use Runner.CallObjectMethodAsync(w, "MyShowModalDialog", "Param1", "Param2") method. But i do not know what is MyShowModalDialog and where i can get it from. Can someone tell me where i can see this name of the form which is modal?

 

Thank you.

 

Sudha

1 ACCEPTED SOLUTION

Accepted Solutions
kandy1984
Contributor

Re: Testing Modal Windows

Hi Tanya,

Thanks for replying. We have figured out how it works now. i have asked my developer to have the button click in a function and i have used the function in the code. This worked perfectly.

 

Thank you.

 

Sudha

View solution in original post

6 REPLIES 6
kandy1984
Contributor

Re: Testing Modal Windows

Hi,

 

I have understand that the "MyShowModalDialog" event is where the click event is started. I am currently using the 'Object Spy' to go over the button to see its Properties, Fields and Methods. Where exactly can this be found in TC or do i have to ask my programmer  on the name used in vb.net?

 

 

Thanks for helping.

 

Sudha

TanyaYatskovska
Community Manager

Re: Testing Modal Windows

Hi Kandy1984,

 

Let me quote the topic you’ve found:

In the code snippet below, the tested application’s name is MyTestApplication. This application has a form named Form1. The form class contains the MyShowModalDialog method that displays a modal window. This method uses two string parameters and returns an integer value as a result.

 

From my understanding, you can get the information you need from your developers.

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
kandy1984
Contributor

Re: Testing Modal Windows

Hi Tanya,

 

Thanks for helping me. Yes i have asked my developer the equivilent for MyShowModalDialog which is btnAddWellType_Click. However, the code was not able to open the modal form "frmWellTypeEdit" which should appear after the button is clicked to open the modal form. Is there any other specific method that needs for the code to work?

 

 

 

Sub Test()
' Obtains the desired object
Set p = Sys.Process("PFU-3")
Set w = p.WinFormsObject("frmWellEdit")


' Calls the method that displays a modal window
Set ResObject = Runner.CallObjectMethodAsync(w, "btnAddWellType_Click")



Set w = p.WinFormsObject("frmWellTypeEdit")
If w.Exists then
w.WinFormsObject("btnCancel").ClickButton ' Close
End If

 

' Waits for method completion
ResObject.WaitForCompletion 2000

' Processes the result
If ResObject.ReturnValue = 1 Then
Log.Message "Success"
Else
Log.Message "Failure"
End If
End Sub

 

 

Thanks for helping once again.

TanyaYatskovska
Community Manager

Re: Testing Modal Windows

Hi Kandy1984,

 

You need to make sure that this method belongs to the “w” object you declared. Does it?

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
kandy1984
Contributor

Re: Testing Modal Windows

Hi Tanya,

Thanks for replying. We have figured out how it works now. i have asked my developer to have the button click in a function and i have used the function in the code. This worked perfectly.

 

Thank you.

 

Sudha

View solution in original post

TanyaYatskovska
Community Manager

Re: Testing Modal Windows

Great to hear your solution, Sudha. Thanks for letting us know it.

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: