如何在Java中通过HtmlUnit在超链接上生成多次展示?

发布于 2024-08-19 12:56:33 字数 256 浏览 6 评论 0原文

我正在使用 HtmlUnit 提供的无头浏览器

我已在 webClient 中加载了一个网页。现在,我想在超链接(在加载的网页上)上生成多次展示,就像我们将鼠标光标多次悬停在真实网络浏览器中网页链接上的链接上一样。

我怎样才能通过 HtmlUnit 做到这一点?

I am using the headless browser provide by HtmlUnit

I have loaded a webpage in a webClient. Now I want to generate mulitple impressions on a hyperlink (on the loaded webpage) just like we hover our mouse cursor on a link various times on a link in a webpage in a real web browser.

How can I do that through HtmlUnit?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苍景流年 2024-08-26 12:56:34

将鼠标光标悬停在超链接上不会产生印象。

  • 单击它会在其引导的页面上产生印象。
  • 加载链接会为其产生印象(如果它是广告链接)

因此,分别:

  • 使用 HtmlUnit 单击链接并多次重新加载目标页面
  • 多次重新加载当前页面

Hovering the mouse cursor on a hyperlink does not generate an impression.

  • Clicking it generates an impression on the page to which it leads.
  • Loading the link generates an impression for it (if it is an advertisement-link)

So, respectively:

  • click the link with HtmlUnit and reload the target page multiple times
  • reload the current page multiple times
热血少△年 2024-08-26 12:56:34

您可以尝试使用 HTMLUnit 的 TestPlan 前端,这使得此类事情变得非常简单。

例如:

while is true
  GotoURL http://somepage.com/
  Click link:Buy Me!
end

然后让它运行,直到有足够的点击次数。 :)

You can try using the TestPlan frontend for HTMLUnit which makes this type of thing quite easy.

For example:

while is true
  GotoURL http://somepage.com/
  Click link:Buy Me!
end

Then just let it run until you have enough clicks. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文