Why TC skips the direct parent when I use the Parent method?
I was trying to use the parent method to get the direct parent of an object, which should be the Link(0) in my screenshot below, but it skipped it and returned me the object one level up. Why is that? Is there a way I can get the Link(0) as the direct parent?
Solved! Go to Solution.
Because contentText may include a variety of objects with the same text. It's the text version of the content of the HTML tag and all it's children. So, when you "find" using the content text, it will return the first one found... which is probably the Link itself and not the child panel.
Also, you are using "Find" twice... basically, telling the code to search for the object... and then search for it again. A better way would be doing the Find and then assigning the result of the find to a variable and using that for your reference. Something like
myObject = Sys.Process('myapp').Find(blah, blah, yada)
if (myObject.Exists) then
One better... woud be to map your objects using NameMapping and then you wouldn't need to code for the "find".
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
The className you are seeing is the NOT the Object className, it is the CSS Class Name associated with the object in the browser.
I know it is a bit confusing, the property should be called "CssClassName" instead of "ClassName"