Skip to content

Commit 0ae495c

Browse files
authored
[dotnet] Use ChangeType method to convert any object to boolean in WebElement propoerties (#11913)
Use ChangeType method to convert any object to boolean Fixes #10757
1 parent 395a926 commit 0ae495c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dotnet/src/webdriver/WebElement.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public virtual bool Enabled
107107
Dictionary<string, object> parameters = new Dictionary<string, object>();
108108
parameters.Add("id", this.elementId);
109109
Response commandResponse = this.Execute(DriverCommand.IsElementEnabled, parameters);
110-
return (bool)commandResponse.Value;
110+
return (bool)Convert.ChangeType(commandResponse.Value, typeof(bool));
111111
}
112112
}
113113

@@ -124,7 +124,7 @@ public virtual bool Selected
124124
Dictionary<string, object> parameters = new Dictionary<string, object>();
125125
parameters.Add("id", this.elementId);
126126
Response commandResponse = this.Execute(DriverCommand.IsElementSelected, parameters);
127-
return (bool)commandResponse.Value;
127+
return (bool)Convert.ChangeType(commandResponse.Value, typeof(bool));
128128
}
129129
}
130130

@@ -185,7 +185,7 @@ public virtual bool Displayed
185185
parameters.Add("args", new object[] { this.ToElementReference().ToDictionary() });
186186
commandResponse = this.Execute(DriverCommand.ExecuteScript, parameters);
187187

188-
return (bool)commandResponse.Value;
188+
return (bool)Convert.ChangeType(commandResponse.Value, typeof(bool));
189189
}
190190
}
191191

0 commit comments

Comments
 (0)