Hi All,

In below code I am trying to iterate 2 loops of data from data sheet one 
positive and one negative scenario and using “logger” to log “PASS” and 
“FAIL”. Problem I am facing are 

1. When I run the script with negative “say invalid password” the script 
stops at line marked in Red bold *“if @browser.text.include?("Signed 
in!").should then” *




*Login with Data file Login with DatafileFailure/Error: if 
@browser.text.include?("Signed in!").should == true thenexpected: truegot: 
false (using ==)*


I don’t want the script to stop, it should log as “FAIL” and continue with 
next iteration with positive condition. What is that I am doing wrong here 
also is there better way to handle this? Below is the code I am using

2.       Is there a way to get the row count of active spread sheet instead 
of hardcoding

while @rows <= *2*

It would be of great help if someone can answer to above questions. Thanks 
in advance.


*Code :*
while @rows <= 2

$log.info("** PAGE URL **")

$log.info @browser.url


username=@wrksheet.cells(@rows,"A") ['text']

password=@wrksheet.cells(@rows,"B") ['text']
assesrtion=@wrksheet.cells(@rows,"c") ['text']



@browser.text_field(:id, "username").set(username)

$log.info("** UserName Entered **")
$log.info username


@browser.text_field(:id, "password").set(password)
$log.info("** Password Entered **")
$log.info password


@browser.button(:value,"Sign in").click


*if @browser.text.include?("Signed in!").should == true then*

*$log.info "PASS"*

*else*

*$log.info "FAIL"*

*end*

 

@rows=@rows+1


end

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to