Micro Focus QTP (UFT) Forums
Check if exist not selected radiobutton - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Check if exist not selected radiobutton (/Thread-Check-if-exist-not-selected-radiobutton)



Check if exist not selected radiobutton - sedin - 09-05-2012

Hi,
Im facing this kind of problem. Have in one radiobuttons group list of four radiobuttons.
A, B, C, D. Problem is that any of this product not every time exist (due setting of clients before). Every time when I get to this page with radiobuttons first one is selected.

Problem: I need check if eg. C exist and then select him and continue wizard. THis will continue until all available wizard will be finished. (hope this is clear)

What I have now is
Code:
If Browser("Some").Page("ONE").WebRadioGroup("productType").GetROProperty("value")="A"  Then
Browser("Some").Page("ONE").WebRadioGroup("productType").Select "A"
End if

But if you need check eg if exist B, you will have result false, becouse A is selected so results is A

Eny help, thanks a lot


RE: Check if exist not selected radiobutton - sshukla12 - 09-05-2012

Hi,

Use Descriptive Programing and check which radio button is available and proceed accordingly.

Regards,
Sankalp


RE: Check if exist not selected radiobutton - sedin - 09-05-2012

Oh, thanks, dont even have any idea that exist. Can you give me little example how should i start with code thx


RE: Check if exist not selected radiobutton - sshukla12 - 09-05-2012

Hi,

USe below code:


Code:
Function createDescription(vs_micClass,vs_Text)

  
   'Variable Declaration:
   Dim vo_ResDesc
  

  

   'Code:
   Set vo_ResDesc=Description.Create()
   vo_ResDesc("micclass").value=vs_micClass
   vo_ResDesc("text").Value=vs_Text
   vo_ResDesc("text").regularexpression=False
   Set createDescription=vo_ResDesc
  

  
End Function

Set vo_ResDesc=createDescription("Link",<name>)

Set vo_ResLink=Browser("").Page("").ChildObjects(vo_ResDesc)
If vo_ResLink.Count<>0 Then
    Reporter.ReportEvent micDone ,"Existence of XX","YY"
    vo_ResLink(0).Click
    else
    Reporter.ReportEvent micFail ,"Existence of responsibilty","YY"
    ExitTest
End If


Use the above code for refrence and modify it as per your need.

Regards,
Sankalp


RE: Check if exist not selected radiobutton - sedin - 09-05-2012

Thanks a lot, I copy paste and after function definition have sintax error:
Code:
Set vo_ResDesc=createDescription("Link",<name>)
should i change in here something?

thanks a lot


RE: Check if exist not selected radiobutton - sshukla12 - 09-05-2012

Yes, Instead of link pass the class name for radio button and under name pass the name of radio button u want to identify.

Regards,
Sankalp


RE: Check if exist not selected radiobutton - sedin - 09-12-2012

Hi again,
I debug script but as a result have all the time 0, dont know whats wrong. Can you please add comment to the code (each line) what is it doing? Maybe if I will understand that code what you create, will be able do more.
cheers