Forum Discussion
gk1970
15 years agoOccasional Contributor
Thanks David ! You are right,I indeed did that earlier. As I said earlier we have screens which have paginated records and we need to test whether it performs some operation(it could be clicking on a rdb/link or even status check),so I am trying to create a function which will loop thro' the rows and cells based on inputs ; they are parent object(i used the higher level object),text to search and possibly the type of object. As a sample I tried to use i/p params as object and matchtext.Surprisingly innerText is not able to match and function returns false,I also tried Title. Reason is I think is evident from attached issue7.jpg.SO which property should I use to match ?
---------------------------------------------------------------------------------
sub PO35
Dim iexplore
Dim page
Dim table
Dim passwordBox
Dim cell
Dim panel
Call TestedApps.iexplore.Run(1, True)
Set iexplore = Sys.Process("iexplore")
Call iexplore.ToURL("http:/XXXX.org:8006/")
Set page = iexplore.Page("http://XXXX.org:8006/")
page.Wait
Set table = page.Form("DefaultFormName").Panel(0).Panel(2).Table("LoginRN").Cell(1, 1).Table("region144").Cell(1, 1).Table("region14")
table.Cell(0, 2).Table("usernameField_xc_").Cell(0, 2).Textbox("usernameField").Text = "test"
Set passwordBox = table.Cell(1, 2).Table("passwordField_xc_").Cell(0, 2).PasswordBox("passwordField")
passwordBox.Text = "oracle"
Call passwordBox.Keys("[Enter]")
Call aqUtils.Delay(2000,"Login")
page.Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table("topTableLayoutContainer").Cell(0, 0).Table("leftLayoutRN").Cell(1, 0).Table("region1").Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(1).Table(0).Cell(0, 0).Table(0).Cell(1, 3).Link("AppsNavLink").Click
page.Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table("topTableLayoutContainer").Cell(0, 0).Table("leftLayoutRN").Cell(1, 0).Table("region1").Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(1).Table(0).Cell(0, 1).Table(0).Cell(2, 2).Link("N61").Click
Call aqUtils.Delay(5000,"Login")
Set cell = page.Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table(1).Cell(1, 0).Panel(0).Table(0).Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(1).Table("customizationsPoplist_xc_").Cell(0, 2)
Call cell.Select("customizationsPoplist").ClickItem("My Open Orders")
cell.Button(0).Click
Set panel = page.Form("DefaultFormName").Panel(0)
PropArray = Array("ObjectType", "Title")
ValuesArray = Array("Link", "100187")
if Sys.Process("iexplore").Page("*").Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table(1).Cell(1, 0).Panel(0).Table(0).Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(3).Table(0).Cell(1, 0).Table(0).RowCount>1 Then
set o=Sys.Process("iexplore").Page("*").Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table(1).Cell(1, 0).Panel(0).Table(0).Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(3).Table(0).Find(PropArray,ValuesArray, 20000)
Log.Message(o.ObjectType) ' I 'm able to identify the type
set pg=GetPage()
pg.Wait
'Get table
set tbl=pg.Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table(1).Cell(1, 0).Panel(0).Table(0).Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(3).Table(0).Cell(1, 0).Table(0)
check= LoopCells(tbl,"100187") ' Function
Log.Message(check)
end if
end sub
Function GetPage()
Set p = Sys.Process("iexplore")
Set GetPage =p.Page("*")
End Function
Function LoopCells(tableobj,matchtext)
if tableobj.exists Then
Log.Message("tableobj exists ")
'log.Message(tableobj.Cell(1, 2).innerText)
Else
exit function
end if
For i = 1 To tableobj.RowCount-1
For j = 0 To tableobj.ColumnCount(i)-1
Set Cell = tableobj.Cell(i, j)
'Log.Message(Cell.ObjectType) 'Returns Null .
if j=2 then
'Log.Message ("Cell " & j & ": " & Cell.innerText & " row :" & i)
Log.Message(Cell.ObjectType)
Log.Message ("Cell " & j & ": " & Cell.innerText & " row :" & i)
end if
if (Cell.innerText=matchtext) Then
Result = CBool(1 + 1 = 2)
LoopCells=Result
exit function
else
Result = CBool(1 + 1 = 5)
LoopCells=Result
end if
Next
Next
End Function
---------------------------------------------------------------------------------
sub PO35
Dim iexplore
Dim page
Dim table
Dim passwordBox
Dim cell
Dim panel
Call TestedApps.iexplore.Run(1, True)
Set iexplore = Sys.Process("iexplore")
Call iexplore.ToURL("http:/XXXX.org:8006/")
Set page = iexplore.Page("http://XXXX.org:8006/")
page.Wait
Set table = page.Form("DefaultFormName").Panel(0).Panel(2).Table("LoginRN").Cell(1, 1).Table("region144").Cell(1, 1).Table("region14")
table.Cell(0, 2).Table("usernameField_xc_").Cell(0, 2).Textbox("usernameField").Text = "test"
Set passwordBox = table.Cell(1, 2).Table("passwordField_xc_").Cell(0, 2).PasswordBox("passwordField")
passwordBox.Text = "oracle"
Call passwordBox.Keys("[Enter]")
Call aqUtils.Delay(2000,"Login")
page.Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table("topTableLayoutContainer").Cell(0, 0).Table("leftLayoutRN").Cell(1, 0).Table("region1").Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(1).Table(0).Cell(0, 0).Table(0).Cell(1, 3).Link("AppsNavLink").Click
page.Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table("topTableLayoutContainer").Cell(0, 0).Table("leftLayoutRN").Cell(1, 0).Table("region1").Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(1).Table(0).Cell(0, 1).Table(0).Cell(2, 2).Link("N61").Click
Call aqUtils.Delay(5000,"Login")
Set cell = page.Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table(1).Cell(1, 0).Panel(0).Table(0).Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(1).Table("customizationsPoplist_xc_").Cell(0, 2)
Call cell.Select("customizationsPoplist").ClickItem("My Open Orders")
cell.Button(0).Click
Set panel = page.Form("DefaultFormName").Panel(0)
PropArray = Array("ObjectType", "Title")
ValuesArray = Array("Link", "100187")
if Sys.Process("iexplore").Page("*").Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table(1).Cell(1, 0).Panel(0).Table(0).Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(3).Table(0).Cell(1, 0).Table(0).RowCount>1 Then
set o=Sys.Process("iexplore").Page("*").Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table(1).Cell(1, 0).Panel(0).Table(0).Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(3).Table(0).Find(PropArray,ValuesArray, 20000)
Log.Message(o.ObjectType) ' I 'm able to identify the type
set pg=GetPage()
pg.Wait
'Get table
set tbl=pg.Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table(1).Cell(1, 0).Panel(0).Table(0).Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(3).Table(0).Cell(1, 0).Table(0)
check= LoopCells(tbl,"100187") ' Function
Log.Message(check)
end if
end sub
Function GetPage()
Set p = Sys.Process("iexplore")
Set GetPage =p.Page("*")
End Function
Function LoopCells(tableobj,matchtext)
if tableobj.exists Then
Log.Message("tableobj exists ")
'log.Message(tableobj.Cell(1, 2).innerText)
Else
exit function
end if
For i = 1 To tableobj.RowCount-1
For j = 0 To tableobj.ColumnCount(i)-1
Set Cell = tableobj.Cell(i, j)
'Log.Message(Cell.ObjectType) 'Returns Null .
if j=2 then
'Log.Message ("Cell " & j & ": " & Cell.innerText & " row :" & i)
Log.Message(Cell.ObjectType)
Log.Message ("Cell " & j & ": " & Cell.innerText & " row :" & i)
end if
if (Cell.innerText=matchtext) Then
Result = CBool(1 + 1 = 2)
LoopCells=Result
exit function
else
Result = CBool(1 + 1 = 5)
LoopCells=Result
end if
Next
Next
End Function
Related Content
- 2 years ago
- 5 years ago
- 8 months ago
Recent Discussions
- 2 days ago
- 2 days ago
- 5 days ago