-4

I'm learning java and I want to create a some kind of bot that will be doing operations on webpages, suchas clicking buttons filling textboxes etc. My question which library use to do it? I found out this bot works well:

https://github.com/DaveDuck321/SmashIt/blob/master/app/src/main/java/tk/smashr/smashit/KahootHandle.java

But I don't know how it's even done, it uses okhttp library, but it just sends http requests, but how author knew which request he need send to server to do stuff? Is it possible to use just reqest to bot any site or it's better to use something like htmlunit?

jinpachi23
  • 27
  • 1
  • 6
  • Why will the bot execute operations? Under what conditions? What will it do? Does it respond/base it's actions off the user input? Add some code, or describe the conditions a little, and we'll be able to help you better. :) – Ethan Moore Mar 14 '18 at 00:12
  • For example how would you make a bot that enters this site (https://stackoverflow.com/questions/49267849/how-to-create-program-that-does-operations-on-a-webpage), log in to your account and post a comment like this you just have – jinpachi23 Mar 14 '18 at 00:23
  • http://htmlunit.sourceforge.net/gettingStarted.html maybe the sample at the bottom is the right starting point for you. – RBRi Mar 14 '18 at 17:36

1 Answers1

-1

I'm learning java and I want to create a some kind of bot that will be doing operations on webpages, suchas clicking buttons filling textboxes etc.

Have a look at Selenium which makes it possible for you to control a web browser through all kinds of programming languages, including Java.

Further reading:

0x01
  • 468
  • 2
  • 9
  • It's really doesn't make me, because you have to keep browser open. Can you please look at this fragment of code: https://github.com/DaveDuck321/SmashIt/blob/master/app/src/main/java/tk/smashr/smashit/KahootHandle.java and tell me how to do it way like author of it did? – jinpachi23 Mar 14 '18 at 22:37
  • He's using the [okhttp3 API](http://square.github.io/okhttp/), you can get it here: https://github.com/square/okhttp – 0x01 Mar 15 '18 at 06:50
  • But how did he knew which requests send to the server? – jinpachi23 Mar 17 '18 at 12:40
  • He reverse engineered / recorded / inspected the request when using the site normally. That's why I recommended Selenium to you: With it, you can do this while using the site normally, with a GUI. You can later translate this knowledge to a GUI-less client. – 0x01 Mar 17 '18 at 15:41