Skip to content
This repository was archived by the owner on Nov 29, 2018. It is now read-only.
This repository was archived by the owner on Nov 29, 2018. It is now read-only.

JavascriptExecutor.executeScript implementation on InternetExplorerDriver is inconsistent in marshalling Double/Long numbers from JavaScript to Java #4036

@lukeis

Description

@lukeis

Originally reported on Google Code with ID 4036

What steps will reproduce the problem?
ExecuteScript method in JavascriptExecutor has the capability to marshall JavaScript
numbers as Long or Double depending on the value. But this behavior is not consistent
in InternetExplorerDriver on Windows 7 vs Windows XP.

The following line:
((JavascriptExecutor) driver).executeScript("return parseFloat('2016');");
returns Long (2016L) on Windows XP and Double (2016.0d) on Windows 7 when tested using
InternetExplorerDriver. 


What is the expected output? What do you see instead?

The following code snippet:

<snip>
    Object ret = ((JavascriptExecutor) driver).executeScript("return parseFloat('2016');");
    System.out.println(ret);
    System.out.println(ret.getClass());
</snip>

> returns 2016L on InternetExplorerDriver (IE8) on *Windows XP*.

> returns 2016.0d when using InternetExplorerDriver (IE8/IE9) on *Windows 7*.

No such behavioral difference is noticed when tested on ChromeDriver (18) and FirefoxDriver
(5/9/11) on Windows XP and 7 (always returns Long).

-------------------------------------------------------
Selenium version: 2.20.0
OS: Windows XP and Windows 7
Browser: Internet Explorer
Browser version: IE 8 and 9


Reported by AshwinPrabhuB on 2012-06-06 07:48:45


- _Attachment: [TestJavascriptExecutor.java](https://storage.googleapis.com/google-code-attachments/selenium/issue-4036/comment-0/TestJavascriptExecutor.java)_

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions