Sunday, 17 February 2013

Scroll down using send_keys :space




After working on Watir ( Web Application Testing in Ruby) & Watir-webdriver using Ruby language for some time I thought sharing my experience in a blog would be helpful for some of the people.


Today's learning.


Scroll down a page using the following command in Ruby & Watir-webdriver.

Create an instance of browser.
$browser = Watir::Browser.new:ff 
(note: ff for Firefox, chrome for Chrome & ie for Internet Explorer)

Then use the following command to scroll down once.
$browser.send_keys :space


Using this multiple times or using this inside a loop would scroll the page further down.This would be helpful when the page loads as we scroll down to the end of the page.Example twitter - older tweets appears as we scroll down.