' C:\Perl\html\index.html
Dim frame(2)
frame(1) = "PerlDoc"
frame(0) = "TOC"
On Error Resume Next
For i=0 to ubound(frame)-1
'msgbox frame(i)
If Browser("ActivePerl User Guide").Page("ActivePerl User Guide").Frame(frame(i)).Link("ASPN Perl").Exist Then
msgbox frame(i)
msgbox "yes"
If Err.Number <= 0 Then
Browser("ActivePerl User Guide").Page("ActivePerl User Guide").Frame(frame(i)).Link("ASPN Perl").Click
Else
msgbox frame(i)
End If
End If
Next
'Browser("ActivePerl User Guide").Page("ActivePerl User Guide").Frame("PerlDoc").Link("ASPN Perl").Click
Browser("ActivePerl User Guide").Page("ActivePerl User Guide").Frame("PerlDoc").Link("ASPN Perl")
'Browser("Internet Explorer cannot").Page("Internet Explorer cannot").Sync
'Browser("Internet Explorer cannot").CloseAllTabs
Sunday, November 21, 2010
ChildObjects - Frames,Dynamic Array
'http://localhost/sqlitemanager/
'Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("phpinfo( )").Click @@ hightlight id_;_Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("phpinfo( )")_;_script infofile_;_ZIP::ssf7.xml_;_
'Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("SQLitemanager 1.2.0").Click @@ hightlight id_;_Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("SQLitemanager 1.2.0")_;_script infofile_;_ZIP::ssf8.xml_;_
'Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB").Set "ON" @@ hightlight id_;_Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB")_;_script infofile_;_ZIP::ssf9.xml_;_
'Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB").Set "OFF" @@ hightlight id_;_Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB")_;_script infofile_;_ZIP::ssf10.xml_;_
'Dynamic Arrays
Dim dynamicArray()
Set oDesc = Description.Create
oDesc("micclass").Value = "Frame"
set cObj = Browser("WAMP5 Homepage").Page("SQLiteManager").ChildObjects(oDesc)
'msgbox cObj.Count
ReDim dynamicArray(cObj.Count)
' below for loop will convert as below :
' from = [ welcome ] link
' to = welcome
For i=0 to cObj.Count -1
childObjVal = cObj.item(i).ToString() ' msgbox childObjVal
startPos = Instr(1,childObjVal,"[")
newVal = mid(childObjVal,startPos+1,len(childObjVal))
endPos = instr(1,newVal,"]")
endVal = mid(newVal,1,endPos-1)
dynamicArray(i) = trim(endVal) ' msgbox dynamicArray(i)
Next
'msgbox ubound(dynamicArray)
' below for loop is used click left side frames specific link
For j=0 to ubound(dynamicArray)-1
strArray = dynamicArray(j)
If strArray = "left" Then
Set oDes = Description.Create
oDes("micclass").Value = "Link"
set childLinks = Browser("WAMP5 Homepage").Page("SQLiteManager").Frame(strArray).ChildObjects(oDes) ' Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("left").Link("Test").Click @@ hightlight id_;_Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB")_;_script infofile_;_ZIP::ssf9.xml_;_
For k=0 to childLinks.Count -1
childLinksVal = childLinks.item(k).ToString() ' msgbox childLinksVal
startPos = Instr(1,childLinksVal,"[")
newVal = mid(childLinksVal,startPos+1,len(childLinksVal))
endPos = instr(1,newVal,"]")
endVal = mid(newVal,1,endPos-1) 'dynamicArray(i) = trim(endVal)
endVal = trim(endVal)
msgbox trim(endVal)
If endVal = "Test" Then
Browser("WAMP5 Homepage").Page("SQLiteManager").Frame(strArray).Link(endVal).Click
msgbox "Test is clicked"
End If
Next
End If
Next
' How to find co-ordinates of any text in the application
'l = 0
't = 0
'r = 0
'b = 0
'result = Window("Mozilla Firefox").WinObject("MozillaWindowClass").GetTextLocation("test123",l,t,r,b) @@ hightlight id_;_2164128_;_script infofile_;_ZIP::ssf1.xml_;_
'If result Then @@ hightlight id_;_460284_;_script infofile_;_ZIP::ssf2.xml_;_
' MsgBox "Text found. Coordinates:" & l & "," & t & "," & r & "," & b
'End If
' GetTOProperties example
'set objPro = Window("Mozilla Firefox").WinObject("MozillaWindowClass").GetTOProperties
'msgbox objPro.Count
'For i=0 to objPro.count-1
' 'msgbox objPro(i).Name
'If objPro(i).Name = "text" Then
' msgbox objPro(i).Name ' property name
'End If
'Next
'Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("phpinfo( )").Click @@ hightlight id_;_Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("phpinfo( )")_;_script infofile_;_ZIP::ssf7.xml_;_
'Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("SQLitemanager 1.2.0").Click @@ hightlight id_;_Browser("WAMP5 Homepage").Page("WAMP5 Homepage").Link("SQLitemanager 1.2.0")_;_script infofile_;_ZIP::ssf8.xml_;_
'Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB").Set "ON" @@ hightlight id_;_Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB")_;_script infofile_;_ZIP::ssf9.xml_;_
'Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB").Set "OFF" @@ hightlight id_;_Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB")_;_script infofile_;_ZIP::ssf10.xml_;_
'Dynamic Arrays
Dim dynamicArray()
Set oDesc = Description.Create
oDesc("micclass").Value = "Frame"
set cObj = Browser("WAMP5 Homepage").Page("SQLiteManager").ChildObjects(oDesc)
'msgbox cObj.Count
ReDim dynamicArray(cObj.Count)
' below for loop will convert as below :
' from = [ welcome ] link
' to = welcome
For i=0 to cObj.Count -1
childObjVal = cObj.item(i).ToString() ' msgbox childObjVal
startPos = Instr(1,childObjVal,"[")
newVal = mid(childObjVal,startPos+1,len(childObjVal))
endPos = instr(1,newVal,"]")
endVal = mid(newVal,1,endPos-1)
dynamicArray(i) = trim(endVal) ' msgbox dynamicArray(i)
Next
'msgbox ubound(dynamicArray)
' below for loop is used click left side frames specific link
For j=0 to ubound(dynamicArray)-1
strArray = dynamicArray(j)
If strArray = "left" Then
Set oDes = Description.Create
oDes("micclass").Value = "Link"
set childLinks = Browser("WAMP5 Homepage").Page("SQLiteManager").Frame(strArray).ChildObjects(oDes) ' Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("left").Link("Test").Click @@ hightlight id_;_Browser("WAMP5 Homepage").Page("SQLiteManager").Frame("main").WebCheckBox("uploadDB")_;_script infofile_;_ZIP::ssf9.xml_;_
For k=0 to childLinks.Count -1
childLinksVal = childLinks.item(k).ToString() ' msgbox childLinksVal
startPos = Instr(1,childLinksVal,"[")
newVal = mid(childLinksVal,startPos+1,len(childLinksVal))
endPos = instr(1,newVal,"]")
endVal = mid(newVal,1,endPos-1) 'dynamicArray(i) = trim(endVal)
endVal = trim(endVal)
msgbox trim(endVal)
If endVal = "Test" Then
Browser("WAMP5 Homepage").Page("SQLiteManager").Frame(strArray).Link(endVal).Click
msgbox "Test is clicked"
End If
Next
End If
Next
' How to find co-ordinates of any text in the application
'l = 0
't = 0
'r = 0
'b = 0
'result = Window("Mozilla Firefox").WinObject("MozillaWindowClass").GetTextLocation("test123",l,t,r,b) @@ hightlight id_;_2164128_;_script infofile_;_ZIP::ssf1.xml_;_
'If result Then @@ hightlight id_;_460284_;_script infofile_;_ZIP::ssf2.xml_;_
' MsgBox "Text found. Coordinates:" & l & "," & t & "," & r & "," & b
'End If
' GetTOProperties example
'set objPro = Window("Mozilla Firefox").WinObject("MozillaWindowClass").GetTOProperties
'msgbox objPro.Count
'For i=0 to objPro.count-1
' 'msgbox objPro(i).Name
'If objPro(i).Name = "text" Then
' msgbox objPro(i).Name ' property name
'End If
'Next
ChildObjects - Click desired link
' Browser("iTKO LISA Functional Testing").Page("iTKO LISA Functional Testing").Link("Key Features").Click
Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
'oDesc("Class Name").Value = "Link"
'Set Lists = Browser("iTKO LISA Functional Testing").Page("iTKO LISA Functional Testing").ChildObjects(oDesc)
Set Lists = Browser("iTKO LISA Functional Testing").Page("WAMP5 Homepage").ChildObjects(oDesc)
'Set Lists = Browser("iTKO LISA Functional Testing").Page("Internet Explorer cannot").ChildObjects(oDesc)
NumberOfLists = Lists.Count()
'msgbox NumberOfLists
bVal = ""
For i = 0 To NumberOfLists - 1
sVal = Lists.item(i).ToString()
'msgbox sVal ' return value like - [ xyz ] link
startPos = Instr(1,sVal,"[")
newVal = mid(sVal,startPos+1,len(sVal))
endPos = instr(1,newVal,"]")
endVal = mid(newVal,1,endPos-1)
msgbox endVal
Next
'Browser("iTKO LISA Functional Testing").Page("Internet Explorer cannot").Link("More information").Click
'If endVal="test123" Then
' msgbox endVal
' Reporter.ReportEvent micPass,"Match Found","Success - Found the match"
' Else
' 'Reporter.ReportEvent micFail,"Match Not Found","Fail - Match not found"
' End If
Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
'oDesc("Class Name").Value = "Link"
'Set Lists = Browser("iTKO LISA Functional Testing").Page("iTKO LISA Functional Testing").ChildObjects(oDesc)
Set Lists = Browser("iTKO LISA Functional Testing").Page("WAMP5 Homepage").ChildObjects(oDesc)
'Set Lists = Browser("iTKO LISA Functional Testing").Page("Internet Explorer cannot").ChildObjects(oDesc)
NumberOfLists = Lists.Count()
'msgbox NumberOfLists
bVal = ""
For i = 0 To NumberOfLists - 1
sVal = Lists.item(i).ToString()
'msgbox sVal ' return value like - [ xyz ] link
startPos = Instr(1,sVal,"[")
newVal = mid(sVal,startPos+1,len(sVal))
endPos = instr(1,newVal,"]")
endVal = mid(newVal,1,endPos-1)
msgbox endVal
Next
'Browser("iTKO LISA Functional Testing").Page("Internet Explorer cannot").Link("More information").Click
'If endVal="test123" Then
' msgbox endVal
' Reporter.ReportEvent micPass,"Match Found","Success - Found the match"
' Else
' 'Reporter.ReportEvent micFail,"Match Not Found","Fail - Match not found"
' End If
Subscribe to:
Posts (Atom)