【问题标题】:Can I get JavaScript function's information in htmlunit?我可以在 htmlunit 中获取 JavaScript 函数的信息吗?
【发布时间】:2022-01-17 14:25:23
【问题描述】:

我英语不好,所以我用翻译来发帖。文章如有奇怪之处,敬请谅解。我目前正在使用 htmlunit 创建一个更改 JavaScript 并运行它的程序。当执行特定的 JavaScript 时,我想将其更改为不同的 JavaScript 函数,但我没有收到有关该函数的信息。例如如下。

// crawling page
<button onclick="movePage('a', b);">AAA</button>

// in htmlunit (I want this information)
function name : movePage
function parameter : 'a', b
function parameter count : 2
function result : 'new page url'

喜欢这个

我可以得到这些信息吗?

【问题讨论】:

    标签: javascript java htmlunit


    【解决方案1】:

    至少你可以拦截响应(例如传递 js 代码的响应)并用不同的实现替换函数。

    https://htmlunit.sourceforge.io/faq.html#HowToModifyRequestOrResponse

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多