[wtr-general] Newb question

2013-02-11 Thread Glenn Waters
Perhaps not so much newb, but what I believe should work does not seem 
to... Been trying to debug for hours. Using cucumber/watir I have this:

Feature: Google Search
  In order to find out more about AWTA
  I need to be able to search Google

  Scenario: Google search for AWTA
Given that I am on the Google homepage
When I search for AWTA
Then I should see Austin Workshop on Test Automation

And these steps:
require 'watir-webdriver'

BROWSER = Watir::Browser.new :chrome

Given /^that I am on the Google homepage$/ do
  BROWSER.goto(http://google.com;)
end

When /^I search for AWTA$/ do
  BROWSER.text_field(:name, q).set(AWTA)
  BROWSER.button(:name, btnG).click
end

Then /^I should see (.*)$/ do |query|
  BROWSER.text.include?(query).should == true
  BROWSER.close
end

The problem is that the BROWSER.text.include returns false when the text is 
clearly on the page. Output from the run:
Started ChromeDriver
port=9516
version=26.0.1383.0
log=C:\Development\cuke_demo\chromedriver.log
[4128:4192:0210/181623:ERROR:bluetooth_adapter_win.cc(23)] NOT IMPLEMENTED
Feature: Google Search
  In order to find out more about AWTA
  I need to be able to search Google

  Scenario: Google search for AWTA # 
features\google_search.feature:5
Given that I am on the Google homepage # 
features/step_definitions/google_search
.rb:6
When I search for AWTA # 
features/step_definitions/google_search
.rb:10
Then I should see Austin Workshop on Test Automation # 
features/step_definitions/google_search
.rb:15
  expected: true
   got: false (using ==) 
(RSpec::Expectations::ExpectationNotMetError)
  ./features/step_definitions/google_search.rb:16:in `/^I should see 
(.*)$/'
  features\google_search.feature:8:in `Then I should see Austin 
Workshop on Test Automation'

Failing Scenarios:
cucumber features\google_search.feature:5 # Scenario: Google search for AWTA

1 scenario (1 failed)
3 steps (1 failed, 2 passed)
0m2.737s

Thanks in advance!

-- 
-- 
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/groups/opt_out.




Re: [wtr-general] Newb question

2013-02-11 Thread Željko Filipin
On Mon, Feb 11, 2013 at 12:23 AM, Glenn Waters gwwat...@gmail.com wrote:

 Then /^I should see (.*)$/ do |query|
   BROWSER.text.include?(query).should == true
   BROWSER.close
 end


Change this:

BROWSER.text.include?(query).should == true

to something like this:

BROWSER.text.should match query

It should give you more helpful error message.

Željko
--
https://leanpub.com/watirbook

-- 
-- 
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/groups/opt_out.




Re: [wtr-general] Newb question

2013-02-11 Thread Oscar Rieken
you can even do

BROWSER.text.should include(query)


On Mon, Feb 11, 2013 at 4:49 AM, Željko Filipin zeljko.fili...@gmail.comwrote:

 On Mon, Feb 11, 2013 at 12:23 AM, Glenn Waters gwwat...@gmail.com wrote:

 Then /^I should see (.*)$/ do |query|
   BROWSER.text.include?(query).should == true
   BROWSER.close
 end


 Change this:

 BROWSER.text.include?(query).should == true

 to something like this:

 BROWSER.text.should match query

 It should give you more helpful error message.

 Željko
 --
 https://leanpub.com/watirbook

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.




[wtr-general] How do I get the maxlength for a text_field?

2013-02-11 Thread Phuoc Can Hua
I used to use textField().maxlength in my scripts. Now I've changed it to 
use 'watir-webdriver'. It doesn't like textField and I had to change it to 
text_field instead.
My problem is I can't get text_field().maxlength. It's saying: undefined 
method.
How can I get maxlength of text_field?

Thanks
Phuoc

-- 
-- 
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/groups/opt_out.




Re: [wtr-general] How do I get the maxlength for a text_field?

2013-02-11 Thread Eric Mathiesen
Ask the developers and pm's.  That's a better discussion for your group
than for a tool forum IMHO.  Another way to go is decide what is a
reasonable value.  When boundary testing I typically copy a large text
document and paste it, of course when doing this my primary goal is to
expose SQL data that could be used for injection based attacks and file
bugs accordingly.

My .02c
Eric
On Feb 11, 2013 8:51 PM, Phuoc Can Hua h...@huaonline.com wrote:

 I used to use textField().maxlength in my scripts. Now I've changed it to
 use 'watir-webdriver'. It doesn't like textField and I had to change it to
 text_field instead.
 My problem is I can't get text_field().maxlength. It's saying: undefined
 method.
 How can I get maxlength of text_field?

 Thanks
 Phuoc

 --
 --
 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/groups/opt_out.




-- 
-- 
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/groups/opt_out.