[wtr-general] Problem with Logger and condition if/else Watir | Testwise

2014-12-18 Thread Mohan MK
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.


Re: [wtr-general] Problem with Logger and condition if/else Watir | Testwise

2014-12-18 Thread 'John Fitisoff' via Watir General
Think you need this

if @browser.text.include?(Signed in!) == true
  # Something...elseend
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.2...@gmail.com
 To: watir-general@googlegroups.com 
 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 Datafile
Failure/Error: if @browser.text.include?(Signed in!).should == true then
expected: true
got: 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 spreadsheet instead of 
hardcoding while @rows = 2 It would be of great help if someone can answer to 
abovequestions. 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.


  

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


[wtr-general] Fwd: Bazaar 2015

2014-12-18 Thread Željko Filipin
Hi,

I am forwarding this announcement because I think members of the group
could be interested in attending the conference.

Željko Filipin

-- Forwarded message --
From: Bret Pettichord b...@pettichord.com
Date: Fri, Dec 12, 2014 at 7:01 PM
Subject: Bazaar 2015
To: test-automation-baz...@googlegroups.com 
test-automation-baz...@googlegroups.com

I recently posted this announcement.

I am pleased to announce that the Test Automation Bazaar will be held in
Austin, Texas on  January 16-17, 2015 (Fri – Sat). I am convening this
event with Zeljko Filipin https://twitter.com/zeljkofilipin and the
Austin Homebrew Testers, and we are pleased that the event will be
sponsored by the Open Information Foundation
http://www.openinformationfoundation.org/, a non-profit which we have
recently joined and which also sponsors the Citcon http://citconf.com/
 conferences.


http://testingwithvision.wordpress.com/2014/12/10/announcing-test-automation-bazaar-jan-16-17-in-austin/

I have been communicating with several volunteers offline, but am not
asking them to join this list going forward. Please expect to see more
updates about this event here.

Bret

-- 
You received this message because you are subscribed to the Google Groups
Test Automation Bazaar group.
To unsubscribe from this group and stop receiving emails from it, send an
email to test-automation-bazaar+unsubscr...@googlegroups.com.
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.


[wtr-general] Re: Can not clear selected options in a multi select list whilst driving the browser in headless mode using watir webdriver

2014-12-18 Thread Costa Antzoulatos
Managed to solve the issue thanks to some help from a reply I got here -  
http://stackoverflow.com/questions/27495966/can-not-clear-selected-options-in-a-multi-select-list-whilst-driving-the-browser
Looks like I was using a very old version of the selenium-server-standalone 
jar. I upgraded the *selenium-server-standalone-2.0b1.jar* to the latest 
version *selenium-server-standalone-2.44.0.jar* and now getting the right 
output as below without exception being raised.

 

*Is the combo list visible?

true

is the list a multi-select list?

true

Has the ADD option been selected?

false

Has the CHG option been selected?

false

[]
1 scenario (1 passed)
6 steps (6 passed)
0m33.203s

Process finished with exit code 0*


On Wednesday, 17 December 2014 10:03:47 UTC+11, Costa Antzoulatos wrote:

 Hi 

 I am using Cucumber and watir-webdriver to write automated tests for my 
 application. My objective is to clear the default selected ADD and CHG 
 options in the following multi select list and then re-select the ADD 
 option.

 *select name=actions_arr id=actions_arr style=width: 190px; height: 
 110px; multiple=multiple 
  option value=Any
  option value=CHG
  option value=ADD
 input name=_actions_arr type=hidden value=1/*

 I have written the following ruby function (including some diagnostic 
 debug print commands) to clear the select list. In this case the 
 variable *action_type* = ADD. Issue is that when I run the 
 browser in headless mode I cannot clear the selected options and I get a
  watir exception saying that the list is not a multi select list even 
 htouhg it really is. However if I drive the app using a local instance 
 of the IE8 browser, the select list is recognised as a multi select list
  and I can clear the options getting the expected results. 



 *def set_action_type(action_type)
  s = @browser.div(:id = 'tabs').frame(:id = 'container').div(:id = 
 'sidebar').select_list(:id = 'actions_arr')
  puts Is the combo list visible?
  puts s.visible?
  puts is the list a multi-select list?
  puts s.multiple?
  s.clear
  puts Has the ADD option been selected?
  puts s.selected?action_type
  puts Has the CHG option been selected?
  puts s.selected? 'CHG'
  puts s.selected_options
 end*1) When driving the application using a headless browser I get the 
 following output:

 *Is** the combo list visible?

 true

 is the list a multi-select list?

 false

 Watir::Exception::Error: you can only clear multi-selects
 ./features/step_definitions/atom_steps.rb:43:in `set_action_type'
 ./features/step_definitions/atom_steps.rb:169:in `/^I select the (.*?) 
 action type$/'
 E:\ATOM_TEST\AcceptanceTest\atom\features\filtering.feature:10:in `And I 
 select the ADD action type'
 1 scenario (1 failed)
 5 steps (1 failed, 4 passed)
 0m32.188s

 Process finished with exit code 1 *

 2) When driving a local instance of the IE8 browser I get the following 
 output which is correct (ignoring the scenario fail message as all test 
 steps actually pass):



 *Is the combo list visible?

 true

 is the list a multi-select list?

 true

 Has the ADD option been selected?

 false

 Has the CHG option been selected?

 false

 []
 1 scenario (1 failed)
 5 steps (5 passed)
 2m1.766s

 Process finished with exit code 1*

 The question I have is

1. How can I get the above multi-select list test to pass when running 
in headless browser mode so that I can clear the options in the 
 select_list 
using *s.clear* ?
2. Is there any other workarounds ? 

 In regards to 1) I have also tried creating a simple HTML page containing 
 only a multiselect list and launching this page in my browser however 
 *s.multiple?* still returns *false*

 In regards to 2) I'm experimenting with trying to send CONTROL and mouse 
 click select commands using the actionbuilder class in selenium webdriver 
 to simulate clearing the selected options as a user would do through the UI.

 Please note the below code I use that launches the browser in headless 
 mode:

 *require 'watir-webdriver'
 require 'selenium/server'
 include Selenium 


 Before do
  @server = Selenium::Server.new(selenium-server-standalone-2.0b1.jar, 
 :background = true)
  @server.start # run your tests
  capabilities = WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled 
 = true)
  @browser = Watir::Browser.new(:remote, :url = 'http://127.0.0.1:/wd/hub 
 http://127.0.0.1:/wd/hub', :desired_capabilities = capabilities)
  #Uncomment the below line and comment out the above lines if you don't want 
 to run in headless mode
  #@browser = Watir::Browser.new :ie
 end
 After do
  @browser.link(:text = 'Logout').click
  @browser.close
  @server.stop
 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