Java web automation

Discuss how to write good code, break bad code, your current pet projects, or the best way to approach novel problems

Java web automation

Post by MarkT on Tue Mar 12, 2013 8:47 pm
([msg=74483]see Java web automation[/msg])

Hey, I thought for my first post on HTS that I'd figure out where I can use my knowledge of java (I'd say I'm just a novice in it, nothing super amazing) to try and do some tasks online using java. I've already begun learning the library HtmlUnit and it gives some great features, I am mainly looking for things like automated web searching, or logging in. The only problem that I have found with HtmlUnit so far is that it has 0 compatibility with websites that use flash, which is a problem. Any suggestions for what my next steps should be? I'm willing to learn different things within java, but am nearly incapable of learning any other languages :cry: . I thank you for any responses I get!
MarkT
New User
New User
 
Posts: 2
Joined: Tue Mar 12, 2013 8:38 pm
Blog: View Blog (0)


Re: Java web automation

Post by WallShadow on Wed Mar 13, 2013 6:36 pm
([msg=74514]see Re: Java web automation[/msg])

That's the first time I've heard of HtmlUnit. For web stuff with Java I simply open a socket, open a BufferedReader for reading, PrintWriter for sending stuff. Just send an HTTP request and listen for a response.

As for automation and login, it will require for you to figure out a way to get socket usage down first, then learn the basics of HTTP so that you can send GET requests, POST request and also receive the information the server sends. Sometimes, some really nice people include APIs in their web designs which make it SO much easier to automate requests and interaction with the web server because they are usually sent in a different format than HTML (typically JSON) which is better formatted for reading

Now Flash really is a problem, there is probably nothing you or I can do about that because Flash is a completely different medium and doesn't exactly support automated interfacing as far as I know.

For a really good reference on Sockets and how to use them, go to http://docs.oracle.com/javase/tutorial/ ... index.html After reading and performing all of the exercises in the lesson, it's a very easy step to do web programming with it. If you need help with it, post back here or go on IRC #coffeesh0p, we're always willing to help you there.

<3 WallShadow
User avatar
WallShadow
Contributor
Contributor
 
Posts: 613
Joined: Tue Mar 06, 2012 9:37 pm
Blog: View Blog (0)



Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests