Skip to main content

Posts

Showing posts with the label ruby

Selenium WebDriver Ruby tutorial

This is a list of very short examples which demonstrate the basic usage of Selenium Webdriver for test automation in Ruby language. Each section includes a sample web page code and automated test code, along with the comments for better understanding. Getting started. WebDriver initialization Working with Element Locators Submitting Forms Page Test Testing Image elements on the page Page Test Setting Checkboxes Page Test Setting Radio Buttons Page Test Selecting Select Boxes Page Test Testing HTML Tables Page Test Executing JavaScript code on the page. Handling popup dialogs Page Test Dealing with the Frames Page Test A single Test Unit Include several Test Units in a Test Suite

Watir test automation framework and AJAX

It is more challenging to implement automated tests for websites using dynamic AJAX requests which load data or elements on the fly. With Watir test automation framework there are several different approaches. We can insert some fixed sleeps before the checkpoints. However this is a bad solution in many cases because quite often we don't know the exact time it takes, also fixed sleeps can make our tests very slow, especially when we have a large test automation suite. This is my solution for Watir test automation framework. It retries any operation with the element until success. If it fails for the first time, it retries again in 3 seconds, repeating 5 times until success. We can configure the maximum number of retries and the interval between each retry. Implementation of the method in Ruby Usage examples