以下代码......
splash:evaljs('document.querySelectorAll("iframe.iframe-container.js-oddset-game-iframe")[0].contentDocument.querySelectorAll("td.leftText a.eventLink").length')
...返回8 - 即阵列中有8个节点。
但是,当我尝试直接返回nodeList(数组)时,结果为nil?显然应该返回一个表,因为从javascript代码返回一个数组。
这是Splash中的错误吗?无法通过Splash处理对iframe中元素的访问权限?我也有--js-cross-domain-access
选项。
这不是一个bug。 iframe只有在render.json
端点与iframes=1
参数一起使用时才可用。使用它时,无法运行自定义Lua脚本。
请参阅文档:https://splash.readthedocs.io/en/stable/api.html#render-json