Micro Focus QTP (UFT) Forums
How to use Ordinal Identifiers(Index,Value) using VB script - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to use Ordinal Identifiers(Index,Value) using VB script (/Thread-How-to-use-Ordinal-Identifiers-Index-Value-using-VB-script)



How to use Ordinal Identifiers(Index,Value) using VB script - qtplearner88 - 03-06-2012

Hi All,

Please help me with this problem.
I have so many check boxes inside a webpage. And the properties of the checkbox is entirely different from the check boxes available in other webpages in the same portal.
Let me show the code I have written for checkbox.

Code:
Function SetWebCB(setting_name,setting_value)
Browser("Browser").Page("Page").WebCheckBox("WebCheckBox").SetTOProperty "html id",setting_name
If Browser("Browser").Page("Page").WebCheckBox("WebCheckBox").WebCheckBox("WebCheckBox").Exist Then

          If Browser("Browser").Page("Page").WebCheckBox("WebCheckBox").WebCheckBox("WebCheckBox").GetROProperty("disabled") = 0 Then

                         checked = Browser("Browser").Page("Page").WebCheckBox("WebCheckBox").WebCheckBox("WebCheckBox").GetROProperty("checked")

                            If  setting_value = "ON" Then

                                    If checked = 0 Then
                                            Browser("Browser").Page("Page").WebCheckBox("WebCheckBox").WebCheckBox("WebCheckBox").Set setting_value
                                            SetWebCB = 1
                                    Else
                                            SetWebCB = 0
                                            Call write_result(1,  "Object "&setting_name&" is already checked","Comments")
                                    End If

                            ElseIf setting_value = "OFF" Then

                                    If checked=1 Then
                                            Browser("Browser").Page("Page").WebCheckBox("WebCheckBox").WebCheckBox("WebCheckBox").Set setting_value
                                            SetWebCB = 1
                                    Else
                                            SetWebCB = 0
                                            Call write_result(1,  "Object "&setting_name&" is already unchecked","Comments")
                                    End If

                            Else
                                          SetWebCB = 0
                                         Call write_result(1,  "The Parameter should be either ON/OFF","Comments")
                              
                            End if

             Else
                    SetWebCB = 0
                    Call write_result(1,  "Object "&setting_name&" is disabled","Comments")
            End If
    
Else
       SetWebCB = 0
     Call write_result(1, "Object "&setting_name&" does not exist","Comments")
End If
    
End Function

Here I am using html id as the input parameter which is given from an excel. But now what I am facing is the check boxes in the new window does'nt have html id at all. so I have to depend on ordinal identifier.

So can anyone of you can help me out here on how to use ordinal identifer?? Please help!![/align]


RE: How to use Ordinal Identifiers(Index,Value) using VB script - qtplearner88 - 03-07-2012

Please help me out from this problem...!!


RE: How to use Ordinal Identifiers(Index,Value) using VB script - Saajo87 - 03-07-2012

hi,

Instead of using index for all you can set visual relation identified for the same. it is very easy to use.

~cheers,
Sachin.


RE: How to use Ordinal Identifiers(Index,Value) using VB script - qtplearner88 - 03-07-2012

Is it feasible to use visual identification. I am asking because I have around 15 check boxes. And they will get added/removed frequently.
Hi Sachin,

Can you please tell me how to use visual relation through script?
Thanks
Vivek


RE: How to use Ordinal Identifiers(Index,Value) using VB script - Saajo87 - 03-07-2012

Refer this for more info,,

http://social.msdn.microsoft.com/Forums/en-US/vstsprerelease/thread/bc0921bf-2765-4374-8e17-117decdda913
Smile

Please get me back for further Queries..