如何用console.log编写js_of_ocaml?print_endline可能会转到控制台,但我想要访问跟踪、错误等。我可以将console定义为外部对象吗?
这对我不起作用:
let console = Js.Unsafe.global##console
在以下方面失败:
TypeError: N.console不是函数test.js:255:30
如果出现同样的错误,则会失败:
class type console = object
method log : Js.js_string Js.t -> unit Js.meth
end
let _ =
let co
node s3_listbuckets.js
Error TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Authorization"]
at ClientRequest.setHeader (_http_outgoing.js:470:3)
at new ClientRequest (_http_client.js:219:14)
at Object.request (https.js:305:10)
at features.constructor.hand
我需要在页面上执行javascript函数,方法是传递一个字符串数组。我想避免打电话给browser.execute_script次数。
list_of_strings = ['a','b','c']
#js code runs through all the strings
result = browser.execute_script("function findTexts(textList){//code here}", list_of_strings)