简体   繁体   English

JavascriptExecutor的executeScript()方法的返回类型是什么?

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

If a JavaScript on a web page return non-decimal value then what will javascriptExecuter.executeScript() will return? 如果网页上的JavaScript返回非十进制值,那么javascriptExecuter.executeScript()将返回什么?

Ccan anyone answer this question? 有人可以回答这个问题吗?

executeScript() executeScript()

executeScript() executes a JavaScript in the context of the currently selected frame or window. executeScript()在当前选定的框架或窗口的上下文中执行JavaScript The script fragment provided will be executed as the body of an anonymous function. 提供的脚本片段将作为匿名函数的主体执行。

If the script has a return value (ie if the script contains a return statement), then the following type of objects are returned: 如果脚本具有返回值(即,如果脚本包含return语句),则返回以下类型的对象:

  • For an HTML element, this method returns a WebElement 对于HTML元素,此方法返回一个WebElement
  • For a decimal, a Double is returned 对于小数,返回一个Double
  • For a non-decimal number, a Long is returned 对于非十进制数字,将返回Long
  • 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. 对于数组,将遵循上述规则,为每个对象返回一个List Nested lists are also supported. 还支持嵌套列表
  • For a map, a Map is returned with values following the rules above. 对于地图,将返回一个Map ,其中包含遵循上述规则的值。
  • If the value is null or there is no return value, null is returned 如果该值为null或没有返回值,则返回null

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从 Java 中的 JavascriptExecutor.executeScript() 方法返回值 - How to return value from JavascriptExecutor.executeScript() method in java 我收到错误消息“JavascriptExecutor 类型中的方法 executeScript(String, Object[]) 不适用于参数 (String)” - I am getting error as “The method executeScript(String, Object[]) in the type JavascriptExecutor is not applicable for the arguments (String)” 当通过 Selenium WebDriver 使用来自 JavascriptExecutor 接口的 executeScript 方法时,arguments[0] 和 arguments[1] 是什么意思? - What does arguments[0] and arguments[1] mean when using executeScript method from JavascriptExecutor interface through Selenium WebDriver? Selenium 中的 JavaScriptExecutor 是什么? - What is JavaScriptExecutor in Selenium? Selenium JavascriptExecutor 没有返回任何东西 - Selenium JavascriptExecutor doesnt return anything 响应的json方法的返回类型是什么? - What is the return type of the json method of a response? 参数[0]在JavascriptExecutor中是什么意思? - What does the argument[0] means in JavascriptExecutor? 如何从Java中的JavascriptExecutor返回字符串 - how to return a string from JavascriptExecutor in java 为什么 chrome.tabs.executeScript 方法的回调结果总是返回一个空的 object? - Why the callback result of the chrome.tabs.executeScript method return always an empty object? 实现javascriptexecutor时“ arguments [0]”有什么用? - What is the use of “arguments[0]” when implementing javascriptexecutor?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM