How to generate multiple impressions on a hyperlink through HtmlUnit in Java?
I am using the headless browser 开发者_如何学JAVAprovide 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?
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
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. :)
精彩评论