<commit_before><html>
<head>
<title>WATIR User Guide</title>
<meta name="author" content="<NAME>" />
<meta name="generator" content="By hand, with a text editor." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

</head>
<style type="text/css">
body {
	margin-left:	5%;
	margin-right: 5%;
	padding: 0;
	background:	#fff;
	color: #333;
	font: normal small Geneva, Verdana, Arial, sans-serif;
     }
h1   {
       font-size: 175%; 
     }
h2   {
       font-size: 135%; 
     }
h3   {
       font-size: 100%; 
     }
p    {
       margin-bottom: 10px; 
      }
div.testexample 
     {
       background: #fff;
       margin-left:  10%;
       margin-right: 10%;
       padding: 1em;
       font-family: "Courier New", monospace;
       font-size: 11pt;
       color: green;
       border: 1px solid #000;
       border-width: thin; 
       margin-bottom: 10px;
     }
div.htmlexample 
     {
       background: #ccc;
       margin-left:  10%;
       margin-right: 10%;
       padding: 1em;
       font-family: "Courier New", monospace;
       font-size: 11pt;
       color: blue;
       border: 1px solid #000;
       border-width: thin; 
       margin-bottom: 10px;
     }
</style>
<body>
<h1>WATIR User Guide</h1>
<h2>Introduction</h2>
<p>Watir is a test tool which uses the <a href="http://www.rubycentral.com/">Ruby</a> scripting language to drive the Internet Explorer web browser using 
Microsoft's OLE interface.</p>
<h3>Prerequisites</h3>
<p>To use the tool, users should have a basic understanding of:<ul>
<li>HTML: <a href="http://www.w3.org/MarkUp/Guide/">this</a> is a basic HTML tutorial.</li>
<li>Programming: users should understand programming basics (ie. what a "for" loop is, etc.)
<li>Ruby: users do not need to know how to program in Ruby to use the tool, but it is recommended to learn some Ruby basics if they would like to write more powerful scripts</li>
</ul>
<h1>Getting Started</h1>
<p>Watir currently only runs on Windows machines, and at this point only works with the Internet Explorer web browser. Watir has been developed and tested using Ruby 1.8.1-11 using Windows 2000 and XP.</p>

<h2>Installation</h2>
<h3>Step 1 - Install Ruby</h3>
<p>On Windows, the simplest way to install Ruby is to download the <a href="http://rubyforge.org/projects/rubyinstaller/">One Click Windows Installer</a>. 
If you prefer, you can download and install a Windows version of ruby Ruby from <a href="http://ruby-lang.org">here</a>.

<h3>Step 2 - Install Watir</h3>
<p>Download the Watir tarball from the WTR RubyForge site <a href="http://rubyforge.org/cgi-bin/viewcvs.cgi/watir/?cvsroot=wtr">here</a> (click download tarball).
Unzip the watir tarball to a working directory (ie. C:). You will now have a watir folder containing the source code and unit tests in a unittests folder.</p>
<h3>Step 3 - Run the Watir Unit Tests</h3>
<p>To run the unit tests:
<ol>
<li>Select Start > Run and enter "cmd" in the open field to open a DOS command prompt. Click OK. </li>
<li>Change directories to the unittests directory in your watir install ex. cd C:\watir\unittests if you installed to C:\</li>
<li>To run all the tests, type "all_tests.rb" and hit Enter at the command prompt. The tests should all run and pass.</li>
</ol>

<h1>Developing Test Cases</h1>
<p>The goal of this user guide is to help you get started writing test cases quickly. Each section below describes the methods needed to drive a web
application. Select what is needed for each page of your web application based on what appears on that page.</p>
<p>To start developing a test, open your text editor, and name your test file giving it a ".rb" (Ruby) extension. Using the Watir methods below, enter in what is needed
to open Internet Explorer, go to your test web site, interact with it to exercise your test case, and verify the results.</p>
<p>Open your web browser with the application under test in front of you, and pay close attention to the objects on that page. Plan what you need to get Watir
to do before you begin scripting. What text fields require entries? What buttons need to be pushed? What links need to be clicked on? It sometimes helps to write out
the steps it will take to exercise a test first, and then filling in the Watir scripting code to satisfy each of those steps.</p> 
<p>It is a good idea to view the source of the page (in IE, right click and select View Source) and get an idea of what the attributes of the objects you need to interact with are.
For example, on the Google home page, if you search the source for "Google Search", you will find the tag with the following attributes:
&lt;input type=submit value="Google Search" name=btnG&gt; 
The "type" attribute "submit" tells us that it is a button, the label or value that we see on the button is "Google Search", and the name of the button is "btnG".
Watir can use different attributes of a tag to manipulate that object, so it is important to know what they are.</p>

<h3><i>Note:</i> A Bit About Objects and Messages</h3>
<p>You will notice a global variable "$ie" is used a lot in these scripts. This is the variable for the Internet Explorer browser.
It is a global variable because it needs to be accessed throughout our test script at any time. It tells the Watir controller to exercise test scripts against
an instance of the Internet Explorer web browser.</p>
<p>In Ruby, we can think of programming in terms of objects and messages. If we think of the "$ie" variable as an object, we can then send messages to it.
An object is usually thought of as a noun, which is natural when we start up an Internet Explorer instance. If we send a message to that object, 
it will respond to that message. We can think of the messages as verbs. In Ruby, we send a message to an object by separating the object we are calling
and the message we are sending to it with a dot. ex. "Dog.bark" would tell the object "Dog" that it must "bark".</p>
<p>Watir was written with objects and messages in mind. Since the IE browser contains objects, we access the objects within IE itself by using the
dot notation. ex. "$ie.button" narrows down the type of object that we can send a message to in our tests. "$ie.button(:caption, "Click Me").click"
identifies the object on the page as a button within the instance of Internet Explorer that has the caption "Click Me". We send the message (the verb) "click", which
Watir interprets and tells IE to click for us. </p>

<h2>Create a Test Instance of Internet Explorer</h2>
<p>To create a test instance of Internet Explorer, enter the following in your test script:</p>
<div class = "testexample">$ie = IE.new</div>
<p>This is the command that watir uses to open a new instance of IE.</p>
<h2>Site Navigation</h2>
<p>To direct your test to the web application you are testing, enter the URL in this command:</p>
<div class = "testexample"> $ie.goto(http://mytestsite)</div>
<p>In the example above, enter in your application's URL in place of <i>mytestsite</i>.</p>
<h2>Manipulating Web Page Objects</h2><commit_msg>added more content and formatting<commit_after><html>
<head>
<title>WATIR User Guide</title>
<meta name="author" content="<NAME>" />
<meta name="generator" content="By hand, with a text editor." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

</head>
<style type="text/css">
body {
	margin-left:	5%;
	margin-right: 5%;
	padding: 0;
	background:	#fff;
	color: #333;
	font: normal small Geneva, Verdana, Arial, sans-serif;
     }
h1   {
       font-size: 175%; 
     }
h2   {
       font-size: 135%; 
     }
h3   {
       font-size: 100%; 
     }
p    {
       margin-bottom: 10px; 
      }
div.testexample 
     {
       background: #fff;
       margin-left:  10%;
       margin-right: 10%;
       padding: 1em;
       font-family: "Courier New", monospace;
       font-size: 11pt;
       color: green;
       border: 1px solid #000;
       border-width: thin; 
       margin-bottom: 10px;
     }
div.htmlexample 
     {
       background: #ccc;
       margin-left:  10%;
       margin-right: 10%;
       padding: 1em;
       font-family: "Courier New", monospace;
       font-size: 11pt;
       color: blue;
       border: 1px solid #000;
       border-width: thin; 
       margin-bottom: 10px;
     }
</style>
<body>
<h1>WATIR User Guide</h1>
<h2>Introduction</h2>
<p>Watir is a test tool which uses the <a href="http://www.rubycentral.com/">Ruby</a> scripting language to drive the Internet Explorer web browser using 
Microsoft's OLE interface.</p>
<h3>Prerequisites</h3>
<p>To use the tool, users should have a basic understanding of:<ul>
<li>HTML: <a href="http://www.w3.org/MarkUp/Guide/">this</a> is a basic HTML tutorial.</li>
<li>Programming: users should understand programming basics (ie. what a "for" loop is, etc.)
<li>Ruby: users do not need to know how to program in Ruby to use the tool, but it is recommended to learn some Ruby basics if they would like to write more powerful scripts</li>
</ul>
<h1>Getting Started</h1>
<p>Watir currently only runs on Windows machines, and at this point only works with the Internet Explorer web browser. Watir has been developed and tested using Ruby 1.8.1-11 using Windows 2000 and XP.</p>

<h2>Installation</h2>
<h3>Step 1 - Install Ruby</h3>
<p>On Windows, the simplest way to install Ruby is to download the <a href="http://rubyforge.org/projects/rubyinstaller/">One Click Windows Installer</a>. 
If you prefer, you can download and install a Windows version of Ruby from <a href="http://ruby-lang.org">here</a>.

<h3>Step 2 - Install Watir</h3>
<p>Download the Watir tarball from the WTR RubyForge site <a href="http://rubyforge.org/cgi-bin/viewcvs.cgi/watir/?cvsroot=wtr">here</a> (click download tarball).
Unzip the watir tarball to a working directory (ie. C:). You will now have a watir folder containing the source code and unit tests in a unittests folder.</p>
<h3>Step 3 - Run the Watir Unit Tests</h3>
<p>To run the unit tests:
<ol>
<li>Select Start > Run and enter "cmd" in the open field to open a DOS command prompt. Click OK. </li>
<li>Change directories to the unittests directory in your watir install ex. cd C:\watir\unittests if you installed to C:\</li>
<li>To run all the tests, type "all_tests.rb" and hit Enter at the command prompt. The tests should all run and pass.</li>
</ol>

<h1>Developing Test Cases</h1>
<p>The goal of this user guide is to help you get started writing test cases quickly. Each section below describes the methods needed to drive a web
application. Select what is needed for each page of your web application based on what appears on that page.</p>
<p>To start developing a test, open your text editor, and name your test file giving it a ".rb" (Ruby) extension. Using the Watir methods below, enter in what is needed
to open Internet Explorer, go to your test web site, interact with it to exercise your test case, and verify the results.</p>
<p>Open your web browser with the application under test in front of you, and pay close attention to the objects on that page. Plan what you need to get Watir
to do before you begin scripting. What text fields require entries? What buttons need to be pushed? What links need to be clicked on? It sometimes helps to write out
the steps it will take to exercise a test first, and then filling in the Watir scripting code to satisfy each of those steps.</p> 
<p>It is a good idea to view the source of the page (in IE, right click and select View Source) and get an idea of what the attributes of the objects you need to interact with are.
For example, on the Google home page, if you search the source for "Google Search", you will find the tag with the following attributes:
&lt;input type=submit value="Google Search" name=btnG&gt; 
The "type" attribute "submit" tells us that it is a button, the caption or value that we see on the button is "Google Search", and the name of the button is "btnG".
Watir can use different attributes of a tag to manipulate that object, so it is important to know what they are. In some cases the attributes are not explicit in the tag such as the "text" or "caption" attributes.
</p>

<h3><i>Note:</i> A Bit About Objects and Messages</h3>
<p>You will notice a global variable "$ie" is used a lot in Watir test scripts. This is the variable for the Internet Explorer browser.
It is a global variable because it needs to be accessed throughout our test script at any time. It tells the Watir controller to exercise test scripts against
an instance of the Internet Explorer web browser.</p>
<p>In Ruby, we can think of programming in terms of objects and messages. Watir was also developed with objects and messages in mind. If we think of the "$ie" variable as an object, we can send messages to it.
An object is usually thought of as a noun, which is natural when we start up an Internet Explorer instance - we refer to it as a thing. If we send a message to that object, 
it will respond to that message if it recognizes it. We can think of the messages as verbs. In Ruby, we send a message to an object by separating the object we are calling
and the message we are sending to it with a dot. ex. "Dog.bark" would tell the object "Dog" that it must "bark". This isn't very specific though. What dog should bark?
In the Watir world, we could identify our test area to be our "yard" or by using our global variable notation: "$yard". Like "$ie", we could treat it as an object with attributes containing other objects with attributes. In our yard, we
have two dogs: Heidi and Megabyte. Each of these dog objects have attributes that we can identify them by. They have names, breeds, shapes and sizes and colors. To be more specific, and interacting
with them the Watir way, we could send the message "bark" to the dog Heidi like this: "$yard.dog(:name, "Heidi").bark". This says in Watir syntax, in our yard, identify the dog Heidi by her name attribute, 
and send her the "bark" message. The expected outcome would be Heidi responding to the message by barking.</p>
<p>When we develop test scripts with Watir, we interact with objects on a web page by sending them messages. Like our yard example, the IE browser itself contains objects, we access the objects within IE itself by identifying them by different attributes. 
Just like in the dog example above,  we have to be very specific when we send messages to objects on a web page. We also need to be able to identify objects on a web page by a being able to use a variety of different attributes due to the diversity in how tags are 
declared by different application developers. With Watir, we identify objects and send them messages by using the dot notation. ex. "$ie.button" narrows down the type of object that we can send a message to in our tests. 
"$ie.button(:caption, "Click Me").click" identifies the object on the page as a button within the instance of Internet Explorer that has the caption (or attribute) "Click Me". We send the message (the verb) "click", which
Watir interprets and tells IE to click for us. </p>

<h2>Create a Test Instance of Internet Explorer</h2>
<p>To create a test instance of Internet Explorer, enter the following in your test script:</p>
<div class = "testexample">$ie = IE.new</div>
<p>This is the command that watir uses to open a new instance of IE.</p>
<h2>Site Navigation</h2>
<p>To direct your test to the web application you are testing, enter the URL in this command:</p>
<div class = "testexample"> $ie.goto(http://mytestsite)</div>
<p>In the example above, enter in your application's URL in place of <i>mytestsite</i>.</p>
<h2>Manipulating Web Page Objects</h2>
{'fraction_non_alphanumeric': 0.08781143918529431, 'fraction_numerical': 0.011016460641772882, 'mean_word_length': 3.7778457772337823, 'pattern_counts': {'":': 0, '<': 207, '<?xml version=': 0, '>': 209, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5694305', 'n_tokens_mistral': 4664, 'n_tokens_neox': 4416, 'n_words': 2349}