Exists property is not working...?

Jul 10, 2013 at 6:22 AM
Hi,

I want to perform an action based on the inner text and so I designed the code as below:

If(pageObject.Get<CUITe_HtmlHyperlink>("InnerText~" + folderName).Exists)
{
Perform Tasks...
}

else
{
Perform Tasks2...
}

But when I execute, if the object is present, then it works fine. But if it doesn't it throws an error value cannot be null. I am expecting that it will result the boolean value (either true or false) and perform tasks accordingly.

Can I get any alternative for this or why its not working.


Thanks,
Rohit
Jul 10, 2013 at 7:29 AM
Even I tried to use a method such as below, but no use:

public bool isPageObjectExists(string text)
    {
        return (pg.Get<CUITe_HtmlHyperlink>("InnerText~" + text).UnWrap().Exists );
    }
Coordinator
Jul 16, 2013 at 7:12 AM
Hi rohithmishra,

Please try setting the SmartMatchOptions to None as follows before your coded ui test:
Playback.PlaybackSettings.SmartMatchOptions = SmartMatchOptions.None;
You can see the sample unit\integration test called HtmlControl_NonExistent_DoesNotExist in .\Sample_CUITeTestProject\HtmlControlTests.cs.

Thank you.
Jul 17, 2013 at 12:01 PM
Thank you, I will try and let you know!!! :)