Basic Interaction with Web Pages

Written by Aidy.

NOTE: The following tutorial uses Chrome for the examples.

Let's have a look at how to use Watir and Ruby to take control of the most commonly used web elements that you'll find on most websites such as text fields, links and buttons. To interact with any of these is very simple and requires pretty much just one line of code per element interaction. I've mocked up a little webpage with a load of different elements on it that we'll use in the following examples, check it out here:

http://www.lazyautomation.co.uk/lazy1.html

Ruby IDEs

Written by Aidy.

You don't necessarily need to install an IDE to write your Ruby scripts, you could actually run everything from the IRB (Interactive Ruby Shell) or just write them in notepad but after a while that'd get pretty tedious. So let's look at some options. I've used three extensively in my time Scite, Netbeans and Rubymine.

NetBeans
Not sure why I chucked this into the mix because it no longer supports Ruby. It was pretty good back in the day though, memories!

Scite
This is a very basic but free IDE. There's no intelli-sense or debugging options but it does the job. 

Download it here:
http://www.scintilla.org/SciTEDownload.html

Rubymine
This my all-time favourite IDE, it does everything you'll ever need to do with Ruby and it's a joy to use. However it's not free but you can download it on a 30 day trial after which it's something like £50 for a personal license and £150 for a business license.

Download it here:
http://www.jetbrains.com/ruby/

Installing Watir & Ruby

Written by Aidy.

Please Note: The following tutorial is applicable for Windows 7, XP and Vista. 

Step 1 - Install Ruby (Version 1.9.3-p448)

First things first, let's download and install Ruby, the king of programming languages!

You can download it here, make sure you get version 1.9.3-p448:
http://rubyinstaller.org/download 

Hello World

Written by Aidy.

puts 'Hello World!'