-
- Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Closed
Copy link
Labels
C-dotnet.NET Bindings.NET BindingsI-defectSomething is not working as intendedSomething is not working as intended
Description
What happened?
In Chrome Browser.ExecuteJavaScript<double>("{return performance.timeOrigin ;}");
fails 1 in 10 times because it returns a double truncated to 1 decimal. However when the decimal part is 0 Selenium sees this as a long, which is not IsInstanceOfType
double, so it crashes with WebDriverException("Script returned a value, but the result could not be cast to the desired type");
.
This means that it is in general not possible to use double
for ExecuteJavaScript
, even though it often seems correct.
How can we reproduce the issue?
`Browser.ExecuteJavaScript<double>("{return 123.0;}");`
Relevant log output
OpenQA.Selenium.WebDriverException : Script returned a value, but the result could not be cast to the desired type at OpenQA.Selenium.Support.Extensions.WebDriverExtensions.ExecuteJavaScript[T](IWebDriver driver, String script, Object[] args)
Operating System
Windows 10
Selenium version
.Net 4.8.1
What are the browser(s) and version(s) where you see this issue?
Chrome 111
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 111
Are you using Selenium Grid?
No response
Metadata
Metadata
Assignees
Labels
C-dotnet.NET Bindings.NET BindingsI-defectSomething is not working as intendedSomething is not working as intended