简体   繁体   English

我可以在 htmlunit 中获取 JavaScript 函数的信息吗?

[英]Can I get JavaScript function's information in htmlunit?

I'm not good at English, so I use a translator to post.我英语不好,所以我用翻译来发帖。 Please understand if there are any strange parts of the article.文章如有奇怪之处,敬请谅解。 I am currently using htmlunit to create a program that changes JavaScript and runs it.我目前正在使用 htmlunit 创建一个更改 JavaScript 并运行它的程序。 When a specific JavaScript is executed, I want to change it to a different JavaScript function, but I have not received information on the function. When a specific JavaScript is executed, I want to change it to a different JavaScript function, but I have not received information on the function. For example, it is as follows.例如,如下。

// 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'

like this像这样

Can I get this information?我能得到这些信息吗?

At least you can intercept the response (eg the one delivering the js code) and replace the function by a different implementation.至少您可以拦截响应(例如,传递 js 代码的响应)并用不同的实现替换 function。

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

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM