开发者

Building a Bot in java [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reas开发者_高级运维onably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I simply want to create an Bot that can run (preferably) on a web-server, and simply 'clicks' on an object of a web page using java.

please refer me to some tutorials that can be of help to me


HtmlUnit is a programmable web browser (in Java). See http://htmlunit.sourceforge.net/gettingStarted.html.


I think you can start from Apache Droids project. They have module for web crawling


Since a "click" is basically just a machine requesting a resource, you could do something as simple as:

clickURL = new BufferedReader(new InputStreamReader(new URL(URLOrFilename).openStream()));

This will open the stream. I don't know if you have to actually read anything (e.g. BufferedReader.readLine()), or if you can immediately close the stream, but that'll do it. Wrap it in a main() method, and you're done.

You'll need to import the appropriate I/O Java libraries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜