1

My RFT code is

table_cell = find(atList(
                atDescendant(".class" , "Html.TD")
                ,atChild(".text" , "normal")
            ),false
        );

and it finds two objects. I was expecting only one because I specified that I want TD with direct child that got text "normal". See the screen shot.

If I then use .getMappableParent() method on both results found I get two tables ( I am after a table) see the picture.

Could anybody explain how come I got two objects?

enter image description here

Some info about atChild and RFT find() method

atChild -- One or more properties that must be matched against the direct child of the starting test object

Radek
  • 13,813
  • 52
  • 161
  • 255

1 Answers1

2

I'm not 100% sure, but I think RFT uses ".text" as an XML-style property of an element. http://www.w3schools.com/dom/prop_element_text.asp

You're finding atList(), this means finding rules are applied one after the other using the preceeding rule result as input, so:

1- search for all TDs that are child of RootTestObject

2- in those TDs, search for every TD that has "normal" as text child

But since ".text" returns ALL the text contained in every child nodes, you find 2 TDs that match this property. Still, I am not sure how the text matching works, I suppose is not exact matching but a kind of Regexp-way or contains.

You can try starting the find from the outer table

table_cell = table_outer().find(atList( atDescendant(".class" , "Html.TD") ,atChild(".text" , "normal") ),false );

or by accessing the correct result in your find

real_table_cell = table_cell[1];

Hope this helps.

Alessandro Da Rugna
  • 4,571
  • 20
  • 40
  • 64