0

If a JavaScript on a web page return non-decimal value then what will javascriptExecuter.executeScript() will return?

Ccan anyone answer this question?

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
kanbro
  • 13
  • 1
  • 3
  • 3
    You can get that information from here: https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/JavascriptExecutor.html#executeScript-java.lang.String-java.lang.Object...- – Elanochecer Mar 28 '19 at 09:46

1 Answers1

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
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352