This is the method where the code is getting stopped now,
but earlier it was working fine with the same below code but from 2-3 day it has stopped.
have also highlighted the code line where i am getting the error.
public static void AssertMessage(string ExpectedValue, string Classinfo)
{
try
{
Playback.PlaybackSettings.AlwaysSearchControls = true;
BrowserWindow br = new BrowserWindow();
if (BrowserWindow.CurrentBrowser.ToLower().Trim() == "ie")
{
br.SearchProperties[UITestControl.PropertyNames.ClassName] = "IEFrame";
}
else
{
br.SearchProperties[
UITestControl.PropertyNames.Name] = WinTitle;
}
HtmlSpan control = new HtmlSpan(br);
control.SearchProperties.Add(HtmlSpan.PropertyNames.ClassName, "HtmlPane");
control.SearchProperties.Add(HtmlSpan.PropertyNames.Class, Classinfo);
UITestControlCollection utcc = control.FindMatchingControls(); -> Here on this line i am getting this error string _content = "";
Boolean flag = false;
foreach (UITestControl utc in utcc)
{
_content = utc.GetProperty(HtmlSpan.PropertyNames.InnerText).ToString();
if (_content.Trim().ToLower().Replace("\r\n", "") == ExpectedValue.Trim().ToLower().Replace("\r\n", ""))
{
flag = true;
utc.DrawHighlight();
System.Console.WriteLine("Expected message is \"" + ExpectedValue + "\" Actual Found \"" + _content + "\" ");
break;
}
}
if (!flag)
{
string error = "Expected message is \"" + ExpectedValue + " not found. \" Actual Found \"" + _content + "\" ";
WriteLogs("Failed", error);
CreateDefect(error);
Assert.Fail(error);
}
try
{
Playback.Wait(5000);
WinTitle = br.Title.Replace(" - Google Chrome", "").Replace(" - Internet Explorer", "").Replace(" - Mozilla Firefox", "");
}
catch
{ }
}
catch (PlaybackFailureException e)
{
Assert.Fail(e.Message);
WriteLogs("Failed", e.BasicMessage);
}
}
And the code execution stops here itself.