Re: [wtr-general] Dynamically defining a control

2011-09-30 Thread Željko Filipin
On Thu, Sep 29, 2011 at 7:11 PM, Phil Lewis jplewi...@comcast.net wrote:
 What I also wanted to do was build the function out where I could also
 specifiy the object type, 'text_field' in this case. so that it might
 be something analogous to:
$browser.@ctlObjType(@ctlObjIdentType,
 @ctlObjIdentValLoginField).set(userID)

Object#send is what you need:

http://ruby-doc.org/core/classes/Object.html#M000999

This should work

@ctlObjIdentType = :id
@ctlObjIdentValLoginField = txtloginfield
@ctlObjType = :text_field

$browser.send(@ctlObjType, @ctlObjIdentType =
@ctlObjIdentValLoginField).set(userID)

Željko
--
watir.com - community manager
watir.com/book - author
watirpodcast.com - host

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


Re: [wtr-general] Re: Watir script compartmentalization

2011-09-30 Thread Željko Filipin
On Thu, Sep 29, 2011 at 7:22 PM, George george.sand...@gmail.com wrote:
 I'm not sure if sharing my code would help (or make sense) since I'm
 using my own custom framework.

Let me quote Simon Stewart (The WebDriver guy) :)

Code speaks louder than words.

https://twitter.com/#!/shs96c/status/119559122042617856

 I should probably blog what I'm doing
 and have folks see what they think.  I'm using an XML object
 repository combined with an HTML report class to format the results in
 a way that I like. I can attach a sample of my test report if that
 would help...

You should write a blog post and let us know.

Željko

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


Re: [wtr-general] Re: Need Help with Element not found

2011-09-30 Thread Željko Filipin
On Fri, Sep 30, 2011 at 5:39 AM, Ivan Chung ivanchun...@gmail.com wrote:
 i wanted to click on the link under div
 id=player_buy_10104751

This works for me with the HTML you have provided:

browser.div(:id = player_buy_10104751).link.click

Željko
--
watir.com - community manager
watir.com/book - author
watirpodcast.com - host

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


[wtr-general] Re: How to run watir-webdriver tests on the foreground using TeamCity

2011-09-30 Thread the_zonker
Thanks, Alister.

It works.

On Sep 30, 1:37 am, Alister Scott alister.sc...@gmail.com wrote:
 Run TeamCity as an agent rather than a service?

 http://confluence.jetbrains.net/display/TCD5/Setting+up+and+Running+A...

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


[wtr-general] Re: Handling Choose a digital certificate

2011-09-30 Thread bala
Can some one tell how to how to reference the certificate selection
window which is a list_box with RAutomation?  I tried something like
this, but it returned no items.

require rautomation
require watir-webdriver

b = Watir::Browser.new :ie
b.goto(url)

[...now the choose a digital certificate window opens...]
w = RAutomation::Window.new(:title = /digital certificate/i)

[Now select a certificate by its name. To do that I need to get the
handle of list box first, so that I can refer by items[]. I could not
do it because I dont know what an id is...I tried several things like
this ]

lb = w.list_box(:id = [what do i write here])
lb = w.list_box(:class = /ListBox/i)
lb = w.list_box(:text = /Certificate List/i)

Any help please?

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


[wtr-general] Re: accessing a firefox popup woith watir-webdriver

2011-09-30 Thread Rick
once i click a close button on the popup, does the browser context
goes back to the original window?  Or do i need to do anything to
switch it back?

Thanks.

On Sep 29, 3:34 pm, Alister Scott alister.sc...@gmail.com wrote:
 See:http://watirwebdriver.com/browser-popups/orhttp://watirwebdriver.com/javascript-dialogs/

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


[wtr-general] Re: Safari Watir / Webdriver - reasons for choosing watir or selenium...

2011-09-30 Thread jw
I just found out that with selenium webdriver you can create/increase
the implicit wait.  I think this could significantly reduce the manual
waiting and help me with all my wrapped click/set/etc. methods...

http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/WebDriver.Timeouts.html

On Sep 27, 6:09 pm, jw joshuawal...@gmail.com wrote:
 I have recently switched from a very successful (albeit IE 6-8 only)
 Watir suite to watir-webdriver (WW).  It has been very painful and
 disillusioning but i'm getting close to back where I was 3 weeks
 ago.

 Of course my reason was to be able to test all the browsers under
 (almost) the same code with the expectation that there would be a few
 places like ULing/DLing files that I may have to use some case
 statements on OS or browser flavor.  I had been on ruby 1.8.6 and had
 to install 1.8.7 which involved getting rvm or pik (maybe wasn't
 necessary but seemed the easiest path).  installing WW and getting to
 bring up a window was pretty simple, but what I meant by
 disillusioning was 1-finding out it didn't support Safari, which was
 apparently a bad assumption (clearly I thought it a safe one), and 2-
 having to account for WW's seeming inability to discern when the
 browser was loaded.  This was one of my favorite things about Watir
 was it's (in my experience) reliable reliance on IE to determine that
 the page was fully loaded.  No more wait statements!  Well, with WW
 you're going to have to wrap your calls with wait methods, and if you
 wrote a lot of bare click/set/select statments you'll be doing a lot
 of wrapping (or overriding of lib methods to include wrapping in wait
 stmts).  I don't regret moving to WW, but it did suck, and it does
 frustrate me about the wait, and it's way, WAY slower than watir
 (hopefully some refactoring will help this).

 On Aug 4, 12:40 pm, qalady lau...@protopc.com wrote:

  Thank you very much for the feedback.

  So, to summarize what I think I am hearing:

  1. Webdriver does not support Safari
  2. Webdriver does support mobile browser testing - but just barely
  (as .click is not even working well at this point)
  3. WatirSafari works but has been out of development for at least a
  year. It's not really clear on where
  or how it will start to break down.

  I did look up web browser statistics on W3C site: 
  (http://www.w3schools.com/browsers/browsers_stats.asp)
  and it looks like Safari is only around 3% of all browser users which
  is just slightly above Opera. I was surprised the usage stats were so
  low.

  So...now what...? I've spent the last few days thinking that as much
  as I didn't want to switch to Selenium, that switching just might be
  the responsible thing to do for my company. I've been reading/
  researching more about Selenium and how to get started. I have some
  useful resources now...but I am worried about the ramp up time. I am
  only considering Selenium RC (not the ide).  With Watir, I can
  continue writing scripts today. With Selenium, it will be slow going
  to set up the environment, and learning how to structure the test data
  (page objects), read all the preliminary material and then sheepishly
  start to write my first test scripts (I would work in Java). It seems
  painful, but if in the end, it's going to be a better investment,
  better go ahead and jump in now, right?

  Can anyone tell me something that would stop me from pursuing Selenium
  and keep me feeling confident about having chosen Watir? (Please!) Is
  there anything that Watir can do that Selenium can't? At this point,
  even though I'm a personal fan of Watir and adore (and depend) on the
  community that comes with it...I'm feeling like Watir is starting to
  fall behind and Selenium is starting to become the more dominant tool
  choice. As much as I personally want to select Watir as the tool of
  choice for my company...it seems to not hold up against Selenium when
  I discuss this with management. (Most other groups within the company
  are using some combination of tools that include Selenium)

  Hoping to hear a reason to stay with Watir for my work project,
  Lauren



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


Re: [wtr-general] Re: cucumber - undefined method goto error.

2011-09-30 Thread weimar
thanks.

On Fri, Sep 30, 2011 at 4:43 PM, LizLeong elc.le...@gmail.com wrote:

 Try this:
 1. Save the following cucumber file under C:\somenewplace\features
 \hillary.feature

 Feature: Cucumber Question
   Scenario: Google Search for delicious
 Given I am on Google Search Home Page
 When I search for delicious
 Then I should find delicious

  Scenario: Google Search for Facebook
Given I am on Google Search Home Page
When I search for Facebook
Then I should find Facebook

 2. Run cucumber on the feature file above to generate a skeletal file
 that you can use in your steps file.
 (ie. from C:\somenewplace,  cucumber features\hillary.feature)
 You'll get some generated code that you can use later.

 Save my solution below under  C:\somenewplace\features\step_definitions
 \hillary_steps.rb
 If you compare it to what you generated from step 1, you can see that
 I don't hard code the search terms so that I can reuse the code to
 match other words.

 require 'watir-webdriver'

 Given /^I am on Google Search Home Page$/ do
  @browser = Watir::Browser.new :firefox
  @browser.goto http://google.com;
 end

 When /^I search for ([^*]*)$/ do |arg1|
  @browser.text_field(:name, q).set(arg1)
   @browser.button(:name,btnG).click
 end

 Then /^I should find ([^]*)$/ do |arg1|
  @browser.text.include?(arg1)
  @browser.quit
 end

 3. Now run cucumber again from C:\somenewplace
 E:\CucumberExamplescucumber features\hillary.feature
 Feature: Cucumber Question

  Scenario: Google Search for delicious   # features\hillary.feature:2
Given I am on Google Search Home Page # features/step_definitions/
 hillary_st
 eps.rb:3
When I search for delicious # features/step_definitions/
 hillary_st
 eps.rb:8
Then I should find delicious# features/step_definitions/
 hillary_st
 eps.rb:13

  Scenario: Google Search for Facebook# features\hillary.feature:7
Given I am on Google Search Home Page # features/step_definitions/
 hillary_st
 eps.rb:3
When I search for Facebook  # features/step_definitions/
 hillary_st
 eps.rb:8
Then I should find Facebook # features/step_definitions/
 hillary_st
 eps.rb:13

 2 scenarios (2 passed)
 6 steps (6 passed)
 1m14.453s

 On Sep 29, 5:39 pm, hillary weimar1...@gmail.com wrote:
  i fixed this error by moving the @browser = to the given I'm on the
 Google
  search home page step.
 
  Now my tests are running, but it's failing on the last step. I'm getting
 an
  argument error:
 
  My code
 
  Then /^I should see Delicious$/ do |results|
@browser.text.should include Delicious
  end
 
  Feature: Google Search
In order to find out more about the delicious relaunch failure
I need to be able to search google
 
Scenario:  #
  features\google_search.feature:
  5
  Google Search for delicious relaunch failure
  Given I am on the Google Search Home Page#
  features/step_definitions/googl
  e_search.rb:6
  When I search for delicious relaunch failure #
  features/step_definitions/googl
  e_search.rb:11
  Then I should see Delicious#
  features/step_definitions/googl
  e_search.rb:16
Your block takes 1 argument, but the Regexp matched 0 arguments.
  (Cucumber::
  ArityMismatchError)
features/step_definitions/google_search.rb:16:in `/^I should see
  Delicious
  $/'
features\google_search.feature:9:in `Then I should see Delicious'
 
  Failing Scenarios:
  cucumber features\google_search.feature:5 # Scenario:
  Google Search for delicious relaunch failure
 
  1 scenario (1 failed)
  3 steps (1 failed, 2 passed)
  0m7.930s

 --
 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.comhttp://groups.google.com/group/watir-general%0awatir-general+unsubscr...@googlegroups.com


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