Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can we access a table element in Script at runtime without a corr. test object?
#1
Not Solved
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:

Code:
<html>
<body>
<frame>
<table>
....<table> ...
       <TABLE id="myDataTable" ...>
           <TR>
                <TD> Manual Number: &nbsp;</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 helpSmile.
Reply
#2
Not Solved
Hi,

You need to have a corresponding object for the script to run, to whatever heirarchy you are refering to.

If you want to execute without using Object Repository, you have to use descriptive programming... i.e. supplying the object's properties to the script
i.e. Browser("creation time:=0).Page("title:=google").. as such.

Hope this helps,

Cheers
Anil
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Collecting Objects And Object State At Runtime zunebuggy 3 1,734 11-22-2017, 02:37 PM
Last Post: supputuri
  Page element keep changing chong67 4 4,689 11-08-2016, 09:17 PM
Last Post: Paul Rammone
  Choosing element from array marvson 1 1,944 06-29-2016, 02:55 PM
Last Post: Ankesh
  Web Element: Not able to select value from drop down in Web Element. Rajeev 4 5,351 08-04-2015, 06:03 PM
Last Post: kbhargava505
  Calling a function in a Test Script from a function library anupam4j 3 6,180 06-26-2015, 12:31 AM
Last Post: babu123

Forum Jump:


Users browsing this thread: 1 Guest(s)