03-27-2009, 08:03 PM
There is a table in the page (which is inside 1 to 4 hierarchy of nested tables). We can say, following is the structure in my page:
In a test action (that runs after this page is loaded/arrived in the run), I would like to read the manual number from this table cell and pass it onto the next/subsequent action in my test.
Following is the code that I am doing for this action "FindManualNumber"
Does the action have to have respective test-objects always associated to it (in the repository) to have the (Expert) script access them during run-time?. In other words, suppose our script accesses a table cell in a page, do we need to have this object in our repository?
Initially, I did not have any (test) objects associated to this action. Upon running the above-mentioned action script, Test-run complained saying "Could not find Browser...Page... element etc". So I added the Frame object into the action's local repository. Now test run is not able to find the specific table of my description.
I assumed, using the (Expert) script, we can access any object on the page at runtime without a corresponding test object associated/learned in the test/action repository.
As my assumption does not sound quite right!!!
Let me suppose it does (i.e. test always needs a test object even if we access it at run time completely using the script),
Can I not just have the test learn only (until) the (Browser->Page->)Frame object and access the table elements (which is a nested child of this learned Frame object) this way (as the code above)?
Your answer will clear one of my few critical doubts.
Thanks for your help.
Code:
<html>
<body>
<frame>
<table>
....<table> ...
<TABLE id="myDataTable" ...>
<TR>
<TD> Manual Number: </TD>
<TD>1234</TD>
</TR>
<TR>...</TR>
....
</TABLE>
</table>
</table>
</frame>
</body>
</html>
In a test action (that runs after this page is loaded/arrived in the run), I would like to read the manual number from this table cell and pass it onto the next/subsequent action in my test.
Following is the code that I am doing for this action "FindManualNumber"
Code:
Set DataPanelDesc = Description.Create()
DataPanelDesc("html tag").value="TABLE"
DataPanelDesc("html id").value="myDataPanel"
If Not Browser("Browser").Page("Page").Frame("Frame").WebTable(DataPanelDesc).Exist(0) Then
Reporter.ReportEvent micFail, TestActionName(), "Unable to find Datapanel"
ExitTestIteration
End If
Set dataPanel = Browser("Browser").Page("Page").Frame("Frame").WebTable(DataPanelDesc)
row=dataPanel.GetRowWithCellText("Manual Number:")
manualNumber=CStr(dataPanel.GetCellData(row,2))
...
ExitAction(manualNumber)
Does the action have to have respective test-objects always associated to it (in the repository) to have the (Expert) script access them during run-time?. In other words, suppose our script accesses a table cell in a page, do we need to have this object in our repository?
Initially, I did not have any (test) objects associated to this action. Upon running the above-mentioned action script, Test-run complained saying "Could not find Browser...Page... element etc". So I added the Frame object into the action's local repository. Now test run is not able to find the specific table of my description.
I assumed, using the (Expert) script, we can access any object on the page at runtime without a corresponding test object associated/learned in the test/action repository.
As my assumption does not sound quite right!!!
Let me suppose it does (i.e. test always needs a test object even if we access it at run time completely using the script),
Can I not just have the test learn only (until) the (Browser->Page->)Frame object and access the table elements (which is a nested child of this learned Frame object) this way (as the code above)?
Your answer will clear one of my few critical doubts.
Thanks for your help.