Multi-Shoring

Subscribe via Email

Subscribe to RSS feed

Categories

JSSH – the driver of Firefox

This article will reveal you the secret of Watir/Watin.

Background

As popular as Selenium, Watir/Watin is another open source tool which can be used to conduct automated testing on different browsers. To support multiple browsers, drivers of different browsers have been developed by Watir & Watin. And for firefox, JSSH is employed to fulfill the purpose of manipulating the browser.

What is JSSH?
JSSH (JavaScript SHell) is a firefox extension written in C++. Through it, you can run javascript on the remote firefox, which makes it possiblel to manipulate Firefox through methods defined in DOM.

The source code of JSSH is available at http://code.google.com/p/firewatir/source/browse/trunk/?r=131#trunk/Installation

 

An “Hello JSSH” example – Google.com

 

  • You need to install the JSSH extension first. Click here for detail.
  • Start the firefox with JSSH support.
  • firefox -jssh

  • Telnet to the JSSH. The default port is 9997.

telnet localhost 9997

  • In the terminal, enter following javascript line by line.

var w0 = getWindows()[0];
var browser = w0.getBrowser();
browser.loadURI(“http://www.google.com“);
var doc = browser.contentDocument;
var input = doc.getElementsByName(“q”)[0];
var button = doc.getElementsByName(“btnG”)[0];
input.value = “hello JSSH”;
button.click();

Tags: , , , , , ,

Leave a Reply