Skip to content

Commit 22905e6

Browse files
authored
Handle PropertyNotSupportedException
1 parent 70eec6b commit 22905e6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/FlaUI.WebDriver/Controllers/SourceController.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@@ -0,0 +1,162 @@
21
using FlaUI.WebDriver.Models;
32
using Microsoft.AspNetCore.Mvc;
43
using FlaUI.Core.AutomationElements;
@@ -53,7 +52,15 @@ private string ConvertElementToXml(AutomationElement element, System.Drawing.Rec
5352

5453
private void WriteElementToXml(XmlWriter writer, AutomationElement element, System.Drawing.Rectangle rootBounds)
5554
{
56-
var controlType = element.ControlType.ToString();
55+
string controlType;
56+
try
57+
{
58+
controlType = element.ControlType.ToString();
59+
}
60+
catch (FlaUI.Core.Exceptions.PropertyNotSupportedException)
61+
{
62+
controlType = "Unknown";
63+
}
5764
writer.WriteStartElement(controlType);
5865

5966
WritePropertyAttribute(writer, "AcceleratorKey", element.Properties.AcceleratorKey);

0 commit comments

Comments
 (0)