Hi Johnssn,

Thanks for the reply i did resolve the issue. took me bit of time as m new 
to Ruby.

for the first issue i used  :

*if @browser.text.include?(assesrtion) then - now the script does not stop *

for the second issue i used :

*until @wrksheet.cells(@rows, 1).Value == nil do*


Thanks again for the time.

Regards,
M.K.Mohan






On Thursday, 18 December 2014 21:35:03 UTC+5:30, johnssn wrote:
>
> Think you need this
>
> *if @browser.text.include?("Signed in!") == true*
> *  # Something...*
> *else*
> *end*
>
> *Think there's more than one spreadsheet library but you should be able to 
> query the spreadsheet object for the number of of rows that it has (take a 
> look at the rdocs for it.) Then you could do something like *
>
>
> *spreadsheet.rows.each do*
> *  # Something ...*
> *end*
>
> *And there should be a way of omitting the header row or you could do 
> something like spreadsheet.rows.to_a[1..-1] to get a collection of rows 
> without the header (don't know if to_a would be necessary)*
>   ------------------------------
>  *From:* Mohan MK <mohan...@gmail.com <javascript:>>
> *To:* watir-...@googlegroups.com <javascript:> 
> *Sent:* Thursday, December 18, 2014 4:17 AM
> *Subject:* [wtr-general] Problem with Logger and condition if/else Watir 
> | Testwise
>  
> 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 <http://log.info> "PASS"*
>
> *else*
>
> *$log.info <http://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-...@googlegroups.com <javascript:>
> http://groups.google.com/group/watir-general
> watir-genera...@googlegroups.com <javascript:>
>
> --- 
> 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-genera...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
> 

-- 
-- 
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