Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use Ordinal Identifiers(Index,Value) using VB script
#1
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]
Reply
#2
Please help me out from this problem...!!
Reply
#3
hi,

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

~cheers,
Sachin.
Reply
#4
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
Reply
#5
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unable to click on the WebButton with specified Index srach84 2 4,952 03-31-2015, 04:36 AM
Last Post: srach84
  QTP is not identifying table with column names property but its identifing with index Anuradha B 1 3,542 02-12-2015, 04:00 PM
Last Post: Kirill
  Can we set ordinal identifier at runtime qtplearner88 1 4,200 07-31-2013, 12:33 AM
Last Post: Ankur
  QTP recognizing every JavaEdit as "VTextField" having different index values. K Gaurav Varshney 1 2,810 10-29-2012, 11:51 AM
Last Post: krr
  How to increment the Index number of table. branjitk 0 2,571 07-06-2012, 03:04 PM
Last Post: branjitk

Forum Jump:


Users browsing this thread: 1 Guest(s)