Forum Discussion

sarya's avatar
sarya
Frequent Contributor
14 years ago

How to retreive the child's property for a single row using parent.findchild

  page.NativeWebObject.Find("innerHTML","ApproverRules4","A").Click();

  report =  page.NativeWebObject.Find("innerText","ABC3 ","A");

  status = report.parent.FindChild("title","rejected");

  if (!(status.Exists))

     Log.Message("The report stays in the action items with rejected status","",pmNormal,Attr); //Verify the rejected status

  else

    Log.Error("There is some error","",pmNormal,Attr);


In the screenshot,two reports are there.ABC3 with approved status(the symbol in red circle) and PQ3 with rejected status(the symbol in green circle). I need to verify if ABC3 report's status is not rejected but when I use the above code using parent.findchild,it looks in all the reports.How can I made to look only for the children in first row having report ABC3 ?

I am looking to verify the status for the report ABC3 that it is not "Rejected" but it sees the rejected status for the other report "PQ3" and returns the result as if the ABC3 's status is rejected.

When I use the code below,it looks in all the reports for the status but I just want it to look on the status of the report ABC3 which is not rejected.

status = report.parent.FindChild("title","rejected");



Thanks,

Sumedha

3 Replies

  • sarya's avatar
    sarya
    Frequent Contributor
    Hey Jared,





    I read the post.The problem is that I cannot use Hybrid model as it makes the scripts too bulky and difficult to understand.I want to keep the model as DOM as the scripts are shorter and easier to understand. Can we not identify the object in a particular row of the web-table in DOM model . Can we not take the properties of one object in a row and the use its parent to navigate to other objects in the same row ?



    Thanks,

    Sumedha
  • Hi,



    You can identify objects by row and column in a table. To do this, you need to parse this table and check which cell contains an object which meets recognition criteria. See the "Parsing HTML Tables" help topic.



    As for Hybrid model, your scripts will work since Hybrid allows you to use the same syntax you use with DOM. I recommended enabling it to be able to use the Tree syntax for one task only - to find the needed object in the table since this is easier than parsing the table in DOM where there's no parent-child relations between containers and items located inside them.