Skip to content

Commit

Permalink
[dotnet] Use ChangeType method to convert any object to boolean in We…
Browse files Browse the repository at this point in the history
…bElement propoerties (SeleniumHQ#11913)

Use ChangeType method to convert any object to boolean

Fixes SeleniumHQ#10757
  • Loading branch information
nvborisenko committed Apr 19, 2023
1 parent 395a926 commit 0ae495c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/WebElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public virtual bool Enabled
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("id", this.elementId);
Response commandResponse = this.Execute(DriverCommand.IsElementEnabled, parameters);
return (bool)commandResponse.Value;
return (bool)Convert.ChangeType(commandResponse.Value, typeof(bool));
}
}

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

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

return (bool)commandResponse.Value;
return (bool)Convert.ChangeType(commandResponse.Value, typeof(bool));
}
}

Expand Down

0 comments on commit 0ae495c

Please sign in to comment.