Today morning, when I was going through the 'built-in' scripts, like watir.rb, 
watir_simple.rb etc. just to have a look at the source code, I happened to note 
that we can modify the source code of various functions to suit our need and 
also how to use the functions present in the 'Simple' class.  

Given below is a very simple script that uses three functions of the 'Simple' 
class (The 'Simple' class, it seems, was developed with an intention of 
reducing the complexity involved in coding, by making the commands look like 
normal, day-to-day 'English' statements like 'Enter so and so text in so and so 
field', 'check whether so and so image is present on the screen' etc., rather 
than like commands of a 'programming language'):

require 'watir'
include Watir
require 'watir/watir_simple'
include Simple
new_browser_at('www.google.com')  # will open a new browser and will go to 
'www.google.com'
enter_text_into_field_with_name('q', 'Software Testing') # will enter the text 
'Software Testing' in the 'search' text field
click_button_with_name('btnG') # will click the 'Google Search' button

Hope, I have not wasted anybody's time.

Thanks,
Maloy.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6165&messageID=17346#17346
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to