Computer Science Canada

Web Automation

Author:  Nathan4102 [ Mon Oct 21, 2013 7:47 pm ]
Post subject:  Web Automation

Is there an easy way to set up web automation in a minimized or background browser? Basically I'm looking to automate a certain process which I already do, its just a bit tedious to keep doing. It wouldn't need to interact with any applets or fancy things, just straight up HTML/CSS. Ideally, I would need to be able to scan the screen to see what our current state is, because I might need to do different things at different screens. I know Pascal and C# fairly well, so if it's possible with one of those two languages, that would be ideal, I kinda don't want to learn another language right now.

And P.S., I have looked at the T.O.S. of the site in question, and I didn't see anything against automation. :p

Author:  BigBear [ Tue Oct 22, 2013 3:14 pm ]
Post subject:  RE:Web Automation

It depends what you are trying to do.

You might want to try using JavaScript commands in your browser's console (F12 on Chrome and Ctrl+Shift+J on Firefox)

Author:  Nathan4102 [ Tue Oct 22, 2013 3:47 pm ]
Post subject:  RE:Web Automation

Ideally it would be a program which I could input some text or arguments, and every x minutes, my program does something on the website based on my arguments. Can I do this with JavaScript commands?

Author:  BigBear [ Tue Oct 22, 2013 7:47 pm ]
Post subject:  RE:Web Automation

What is the something on the website?

Clicking?

Typing?

For example let's say I'm on your website
www.gamesworld.ca

In Chrome I press F12 and click on console.

Lets say I want to click the first link on your page.

I can type JQuery [1] commands

To get all of the links

links = $('a');
links[0].click()

1: JavaScript library that makes getting elements easier

Author:  Nathan4102 [ Tue Oct 22, 2013 8:41 pm ]
Post subject:  RE:Web Automation

Hmm, it might be possible. It would involve both clicking and typing. Basically just navigate to www.something.com, click some button, type in some textboxes, and click a few buttons. I don't really want to learn a language right now, but if its simple enough, I might attempt it.

Author:  2goto1 [ Wed Oct 23, 2013 7:48 am ]
Post subject:  RE:Web Automation

You can use JavaScript server side with frameworks like http://nodejs.org/

Author:  BigBear [ Wed Oct 23, 2013 4:20 pm ]
Post subject:  RE:Web Automation

To type in JavaScript you would just change the value of the element.

So find the input tag by its id or where it is on the page and then change the value property of the tag.

input_tag.value = "what you want to type"

Author:  Nathan4102 [ Wed Oct 23, 2013 7:46 pm ]
Post subject:  RE:Web Automation

I ended up doing it really roughly in Pascal. It doesn't run in the background, but it's not a huge deal, I can find something else to do while it runs for 2 minutes. Thanks guys!


: