During your journey to the automation of web based application, you have encountered with a situation in which you have to click on a object and when you spy that object, you found that the object is embedded in webtable.
So to click on the object, you have to traverse to the webtable and reach that object and perform the action.
Below are the example to ON the checkbox inside webtable.
Browser("Google").Page("Google").Sync
Browser("Google").Navigate "http://www.nucleation.in/function-check-uncheck-web-checkbox/"
Browser("QTP Function to Check").Page("QTP Function to Check").Sync
Set A= description.Create
A("micclass").value = "WebTable"
A("html tag").value = "TABLE"
A("name").value = "Passenger 1"
Set B = Browser("QTP Function to Check").Page("QTP Function to Check").ChildObjects(A)
MSGBOX b.COUNT
For I = 0 TO B.COUNT-1
'MSGBOX B(I).ROWCOUNT
For J= 1 TO B(I).ROWCOUNT
'MSGBOX B(I).COLUMNCOUNT(J)
For K = 1 TO B(I).COLUMNCOUNT(J)
x=B(I).GETCELLDATA(J,K)
' MSGBOX x
If UCASE(x)="PASSENGER 2" Then
msgbox j
msgbox k
set c = B(i).childitem (j,3,"WebCheckBox",0)
c.set "ON"
End If
Next
Next
Next
So to click on the object, you have to traverse to the webtable and reach that object and perform the action.
Below are the example to ON the checkbox inside webtable.
Browser("Google").Page("Google").Sync
Browser("Google").Navigate "http://www.nucleation.in/function-check-uncheck-web-checkbox/"
Browser("QTP Function to Check").Page("QTP Function to Check").Sync
Set A= description.Create
A("micclass").value = "WebTable"
A("html tag").value = "TABLE"
A("name").value = "Passenger 1"
Set B = Browser("QTP Function to Check").Page("QTP Function to Check").ChildObjects(A)
MSGBOX b.COUNT
For I = 0 TO B.COUNT-1
'MSGBOX B(I).ROWCOUNT
For J= 1 TO B(I).ROWCOUNT
'MSGBOX B(I).COLUMNCOUNT(J)
For K = 1 TO B(I).COLUMNCOUNT(J)
x=B(I).GETCELLDATA(J,K)
' MSGBOX x
If UCASE(x)="PASSENGER 2" Then
msgbox j
msgbox k
set c = B(i).childitem (j,3,"WebCheckBox",0)
c.set "ON"
End If
Next
Next
Next
No comments:
Post a Comment