On 8/11/05, Shubha R <[EMAIL PROTECTED]> wrote:
Have you tried the WET addon? I have just start to use it andit seems to do a very good job in handling all popups.Ok guys help me out..
I am trying to set up a login script to learn to use Watir as i plan on switching from SAMIE/Perl to Watir/Ruby. Here i have simple script made just to test how it would react and work with simple login to any site.
Expected:
The script should emulate user and login to the mentioned site. After successful login, it should either detect and log whether it was on correct URl or not. Also, it should check for string "today!" in the text on that URL. But according to this script, it always fails.
1) It doesn't take care of SSL popup. Should it be working, if so, what do i need to add/remove/edit in following script to make it work?
2) How can i set it to check whether it is on expected URL or not? I have assert ie.url in my script but that didn't seem to work and always gave a fail.
require 'watir'
include Watir
re! quire 'test/unit'
require 'test/unit/ui/console/testrunner'
#logger includes
require 'example_logger1'
class TC_SSO_example < Test::Unit::TestCase
def start
#open the IE browser
$ie = IE.new
filePrefix = "test_logger1"
#create a logger
$logger = LoggerFactory.start_xml_logger(filePrefix)
$ie.set_logger($logger)
end
def test_Login
start
test_site = 'http://www.SeattleSymphony.com'
test_success_URL = ' http://www.seattlesymphony.org/symphony/index.aspx?month=9&year=2005&tries=1'
$logger.log("")
#i! e = IE.new
$ie.goto(test_site)
$ie.link(:text, "Login").click
$ie.text_field(:name, "template:tx_LoginName").set("mytestlogin")
$ie.text_field(:name, "template:tx_Password").set("mytestlogin")
$ie.button(:name, "template:btn_Login").click
#wc = WinClicker.new
#wc.clearSecurityAlertBox() <---- on enabling this and above, it starts dumping lots of irrelavent stuff.
#clearSecurityAlertBox() <---- obviously doesn't work as it.
begin
assert($ie.contains_text("today!"))
assert($ie.url(test_success_URL))
$logger.log("Passed. User has sucessfully logged in")
$logger.log_results("test_Login", "mytestlogin", "test_URL", "TEST PASSED.")
res! cue => e
$logger.log("*FAILED*." + e.message + "\n" + e.backtrace.join("\n"))
$logger.log_results("test_Login", "mytestlogin", "test_URL", "TEST FAILED.") #logs to both the XML file and corelogger
end
$logger.log '## End of test Login'
$logger.end_log #close XML log file
end
end
--
What is written without effort is in general read without pleasure.
- Samuel Johnson
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
--
What is written without effort is in general read without pleasure.
- Samuel Johnson
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
