Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can I use html id as an unique identifier for all the components in a web page
#1
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi,
I am facing a problem here. We are automating a web portal and we use key word driven framework. We have some libraries and we call the functions through an excel with the properties of components(button,checkbox,Link etc) as parameter.
So when I say properties, I am parameterizing any one of the property of combinations of two.

For Eg:
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").Exist Then

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

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

                            If  setting_value = "ON" Then

                                    If checked = 0 Then
                                            Browser("Browser").Page("Page").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").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

In this function for checkbox I am using html id . So my doubt is that can we use html id for all the components in a portal. Will QTP identifies an object only with the help of only html id.
Please help me in this
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi,
It's not always true that html id will give u a unique description to identify the objects in ur application.It will be better if u come up with such combinations of properties that uniquely identifies ur object.

Regards,
Sankalp
Reply
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
So my doubt is that can we use html id for all the components in a portal.

NO

Will QTP identifies an object only with the help of only html id.
Please help me in this

NO

QTP may not be able to identify all the objects based on ONLY html



Reply
#4
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi,

U can use html id to identify the objects but make sure that it succeeds in identify the objects uniquely.

Regards,
Sankalp
Reply
#5
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi Swathy,
So we will have to use some other properties to identify is it??

Thanks
qtplearner88
Reply
#6
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi,

for some objects html id will be sufficient however, if we are trying to automate objects which are grouped, html id only will not be sufficient to uniquely identify the object. need to use some more object properties



Reply
#7
Solved: 11 Years, 4 Months, 3 Weeks ago
Thank u very much... So for ungrouped elements html id would be enough??that also depends rit??
Regards
qtplearner
Reply
#8
Solved: 11 Years, 4 Months, 3 Weeks ago
for ungrouped most of the time html id would be enough, eventhough we need to cross check, qtp is able to identify the object base on html id

Reply
#9
Solved: 11 Years, 4 Months, 3 Weeks ago
it is always best to have a set of properties to uniquely identify an object... using just one property for all... doesn't seem an appropriate way... each object should have properties unique to it in the application.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Can QTP handle slick grid table in a web page qtplearner88 2 4,562 10-01-2019, 10:44 AM
Last Post: shilpi952
  How to identify dynamic webtable as unique in QTP? sudheendramurthy 4 18,644 02-23-2016, 06:16 PM
Last Post: vinod123
  DP Web Browser/Page issues rstimers 1 2,492 08-14-2015, 12:37 PM
Last Post: venkatesh9032
  Dynamic obj rep - get text in the class (html) marcio cravo moreira 0 2,146 05-26-2015, 06:58 PM
Last Post: marcio cravo moreira
  regular expression in html sujaravi123 0 2,315 12-31-2013, 03:00 PM
Last Post: sujaravi123

Forum Jump:


Users browsing this thread: 1 Guest(s)