Forum Discussion
Hi Shankar
I am using Mailinator, I double checked the structure of the page has not changed as far as I can tell. Besides, the only property I am using is "contentText", in Object Spy once I target the subject line, click the "Highlight" button, it does highlight.
Take a look here: https://www.mailinator.com/inbox2.jsp?public_to=testing#/#public_maildirdiv
and here is what I have in this example:
page = https://www.mailinator.com page.FndChild("contentText", "How to Turn a Stopover in Qatar into a Bonus Vacation", 20).Click();
Thanks
Could please share the page properties in Name mapping? I'm thinking identifying page object has the issue
- tristaanogre9 years agoEsteemed Contributor
If FindChild returns an empty object the behavior's you're seeing would be happening. So, for some reason, you're not finding the object you're looking for.
Something to try... separate the line for finding the child from the one where you're clicking... basically, run the findChild and assign the result to another variable which you'll then use to execute the click. Drop a breakpoint on that second line and bring up your Object Browser and so on to make sure that, at the time you're doing what you want to do, that the information is available. Make sure that your FindChild also returns a non-empty object at that breakpoint.
Keep in mind that "contentText" is the content not just of the object you are looking for but all it's child objects as well... the entire contents of the web object in a single field. So, you're searching STRICTLY for a specific string... it could be that there are other characters (hidden formatting characters, carriage returns, spaces, etc) that may be present in the actual string that you need to account for.
- royd9 years agoRegular Contributor
Hi Robert
I tried as you suggested, but did not work. But I noticed that it is a "panel", although methods tab says Find and FindChild is available! Wondering if that may be something causing the trouble?
var page = "https://www.mailinator.com"; var message = FindChild("contentText", "Important Information from THC - Facility", 50); page.message.Click();
Here is what you asked for;
'panel' propertyexample: red rectagle is the 'panel'object spy
- tristaanogre9 years agoEsteemed Contributor
More correct code would be
var page = "https://www.mailinator.com"; var message = page.FindChild("contentText", "Important Information from THC - Facility", 50); message.Click();
The problem you're experiencing is not with the FindChild but with the "Click"... if FindChild returns an empty object, "Click" is not a property or method on the object.
Something to try:
var page = "https://www.mailinator.com"; var message = page.FindChild("contentText", "Important Information from THC*", 50); message.Click();
Notice the astrisk I added in. See if, for some reason or another, there are extra characters and/or spaces after the THC that contentText is returning that you need to account for.
BTW, if it's mapped as you have it indicated in the screenshots, you shouldn't even need to use "FindChild". Your code could simply be
Aliases.browser.pageMalinator.emailMsg.Click()
But in your screenshots, the "MappedName" is blank so, again, there's something not quite matching up. Try the wildcard that I noted above and see if that fixes it.
You might also, since again you have stuff mapped, try
message = Aliases.browser.pageMalinator.FindChild("contentText", "Important Information from THC - Facility*", 50); message.Click();