Пример #1
0
 private void handleKnownTestException(Exception e)
 {
     Console.Error.Write("Details: ");
     if (e.Message.Length > 0)
     {
         Console.Error.WriteLine(e.Message);
         if (Regex.IsMatch(e.Message, "ERROR: Element .* not found"))
         {
             Console.Error.WriteLine("Location:" + selenium.GetLocation());
             Console.Error.WriteLine("Page title: " + selenium.GetTitle());
             Console.Error.WriteLine("Fields are:");
             foreach (var field in selenium.GetAllFields())
             {
                 Console.Error.WriteLine(field);
             }
         }
     }
     else if (e is AssertionException)
     {
         Console.Error.WriteLine("Assertion failed. No message provided.");
     }
     else
     {
         Console.Error.WriteLine(
             "No useful exception message. Try to improve exception handling in WebTester once underlying problem is discovered. Main exception ToString: " + e);
     }
 }