问题
If a JavaScript on a web page return non-decimal value then what will javascriptExecuter.executeScript()
will return?
Ccan anyone answer this question?
回答1:
executeScript()
executeScript() executes a JavaScript in the context of the currently selected frame or window. The script fragment provided will be executed as the body of an anonymous function.
If the script has a return value (i.e. if the script contains a return statement), then the following type of objects are returned:
- For an HTML element, this method returns a WebElement
- For a decimal, a Double is returned
- For a non-decimal number, a Long is returned
- For a boolean, a Boolean is returned
- For all other cases, a String is returned.
- For an array, a List is returned with each object following the rules above. Nested lists are also supported.
- For a map, a Map is returned with values following the rules above.
- If the value is null or there is no return value, null is returned
来源:https://stackoverflow.com/questions/55394478/what-is-the-return-type-of-executescript-method-of-javascriptexecutor