What is the return type of executeScript() method of JavascriptExecutor?

空扰寡人 提交于 2021-01-29 12:06:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!