Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to select the first checkbox
#1
Not Solved
I need to perform a search criteria and it will bring list of deals, I need to select first checkbox and perform an action

This is the code I wrote

Code:
Set  Obj=Description.Create()
Obj("html tag").value="DIV"
Obj("outerhtml").value="<DIV class=x-grid3-check-col></DIV>"
obj("micclass").value="WebElement"
Set Obj= Browser("Revenue Editor").Page("Revenue Editor").Childobjects(Obj)
'Set Obj= Browser("Revenue Editor").Childobjects(Obj)
AllObj=Obj.count
msgbox AllObj

It gave correct number of checkbox, now I need to select the first checkbox, can you please tell me how to select the first checkbox?


I tried this code but it did not work

Code:
For i = 1 to 2
    Obj(i).set "ON"
Next
Reply
#2
Not Solved
Is your criteria only to select the first one? If yes then you dont have to iterate.
You could simply add the object to the repository and then SET it to ON. But if you want to highlight a 5th or 7th or loop through then you can use the below code. The below code will check all the checkboxes it has identified.
Code:
Set  Obj=Description.Create()
Obj("html tag").value="DIV"
Obj("outerhtml").value="<DIV class=x-grid3-check-col></DIV>"
obj("micclass").value="WebElement"
Set ObjChild= Browser("Revenue Editor").Page("Revenue Editor").Childobjects(Obj)
AllObj=ObjChild.count
msgbox AllObj
For i = 1 to AllObj
          ObjChild(i).set "ON"
Next

Does it help?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#3
Not Solved
Code:
Set Obj=Description.Create()
Obj("html tag").value="DIV"
Obj("outerhtml").value="<DIV class=x-grid3-check-col></DIV>"
obj("micclass").value="WebElement"
Set Obj = Browser("Revenue Editor").Page("Revenue Editor").Childobjects(Obj)
Obj(0).Click
you can't use Set method for "WebElement" object Type
Reply
#4
Not Solved
If you need to check only the first checkbox, then you dont have to use the for..next loop as below
Code:
Set  Obj=Description.Create()
Obj("html tag").value="DIV"
Obj("outerhtml").value="<DIV class=x-grid3-check-col></DIV>"
obj("micclass").value="WebElement"
Set ObjChild= Browser("Revenue Editor").Page("Revenue Editor").Childobjects(Obj)
AllObj=ObjChild.count
ObjChild(0).Click 'first element is always a index 0
But if you have to compare the items with a particular deal then see below
Code:
Set  Obj=Description.Create()
Obj("html tag").value="DIV"
Obj("outerhtml").value="<DIV class=x-grid3-check-col></DIV>"
obj("micclass").value="WebElement"
Set ObjChild= Browser("Revenue Editor").Page("Revenue Editor").Childobjects(Obj)
AllObj=ObjChild.count
msgbox AllObj
For i = 0 to AllObj - 1
          if ObjChild(i).GetRoProperty(<property name>) = "<deal string>" then ObjChild(i).click
Next
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with Select checkbox from data table value jayraocourts 0 1,055 11-01-2019, 10:25 PM
Last Post: jayraocourts
Sad Click checkbox using its label name. venkatesh9032 1 3,047 08-10-2015, 10:33 PM
Last Post: kotaramamohana
  Childobject return wrong checkbox count.. VpnQTP 1 2,559 04-09-2015, 09:07 PM
Last Post: babu123
  How to select dynamic checkbox from web dropdown QA_Newbie 2 4,451 07-20-2014, 09:40 PM
Last Post: QA_Newbie
  How To pick up the particular mail in Post Login Gmail page and click on Checkbox akhandesh 0 2,698 12-02-2013, 01:35 PM
Last Post: akhandesh

Forum Jump:


Users browsing this thread: 1 Guest(s)