Re: [wtr-general] Re: watir-webdriver 0.5.2

2012-02-01 Thread Jari Bakken
On Wed, Feb 1, 2012 at 3:53 PM, Abe Heward ahew...@rsmart.com wrote:

 NoMethodError: undefined method `now' for Watir::Time:Class



The HTML spec recently (re-)-introduced the time element, so there's now
a Watir::Time class. Since you're inside the Watir module in your monkey
patch, that's what you're referencing when you do Time.now. To access the
top-level constant, instead do ::Time.now.

watir-webdriver already has a helper for waiting, so you could instead do:

  Watir::Wait.until { execute_script(return jQuery.active) == 0 }

-- 
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: [Wtr-development] watir-webdriver 0.5.2

2012-02-01 Thread Jari Bakken
There's still the issue Jarmo pointed out - no longer returns Array, but
Array - e.g. the part about String and Option got lost. Feel free to
rephrase that if it's hard to understand (the collection type syntax is
stolen from Yard w/roots in C++/Java).

On Thu, Feb 2, 2012 at 12:25 AM, Željko Filipin zeljko.fili...@gmail.comwrote:

 On Wed, Feb 1, 2012 at 5:17 PM, Jari Bakken jari.bak...@gmail.com wrote:
  You also link to jarib/watir-webdriver (on both GitHub and Travis),
 which is now changed to watir/watir-webdriver.

 Ops. :) I have copy/pasted text from the previous release. Fixed.
 Please let me know if you notice anything else.

 Ž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


-- 
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: Differences between watir and watir-webdriver

2012-01-31 Thread Jari Bakken
Here's how I would do this:

  https://gist.github.com/1711291

-- 
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] Removing reference to an element

2012-01-31 Thread Jari Bakken
On Tue, Jan 31, 2012 at 4:55 PM, Rahul Sharma rahulsharma@gmail.comwrote:


 browser.select_list(:how, :what).enabled? I still get false as it
 still holds the reference to the old element and since the page hasn't
 refreshed it doesn't know its been now enabled by the javascript.


Element references in watir-webdriver are live - if the underlying element
changes, so will the return value of #disabled?
In any case, calling browserselect_list twice will always relocate the
element, so you're not holding on to any reference at all.

Without seeing the code (HTML/CSS/JS/Ruby) in question, it's hard to tell
why you're running into trouble, but some possible cases:

1. The .select_list call is not finding the element you think it is.
2. The disabled state is changing asynchronously, and you have a race
condition.

-- 
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] Differences between watir and watir-webdriver

2012-01-27 Thread Jari Bakken
Den 26. jan. 2012 kl. 23:13 skrev Bob Jones robertwjo...@verizon.net:

  such as the attach is suppported
 in watir and not in watir-webdriver (BTW, this appears to be a deal
 breaker issue),

What are you using attach for, since you consider it a deal breaker?

-- 
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] Connection Refused

2012-01-26 Thread Jari Bakken
The partial stack trace is not helpful, since it only shows stack
frames from Ruby's stdlib. Usually connection refused errors means
the browser process has died.

Den 26. jan. 2012 kl. 23:13 skrev neorubya...@yahoo.com
neorubya...@yahoo.com:

 Folks, I am using watir+cucumber in my tests and for each feature I am
 reusing the instance of the browser, that is I create the instance of
 @@browser = Watir::Browser.new and then reuse this through out my
 tests, I am using watir-webdriver, my tests where running fine till
 now, I just added another scenario and I consistently get the below
 error message:

 Connection refused - connect(2) (Errno::ECONNREFUSED)
  /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
 ruby/1.8/net/http.rb:560:in `initialize'
  /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
 ruby/1.8/net/http.rb:560:in `open'
  /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
 ruby/1.8/net/http.rb:560:in `connect'
  /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
 ruby/1.8/timeout.rb:53:in `timeout'
  /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
 ruby/1.8/timeout.rb:93:in `timeout'
  /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
 ruby/1.8/net/http.rb:560:in `connect'
  /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
 ruby/1.8/net/http.rb:553:in `do_start'
  /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
 ruby/1.8/net/http.rb:542:in `start'
  /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
 ruby/1.8/net/http.rb:1035:in `request'

 I am not using the gird but running this on my local machine, any help
 is much appreciated.

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

-- 
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-webdriver survey for adding items such as: alert_box, scroll_to, and in_viewable_area?

2012-01-06 Thread Jari Bakken
Try upgrading to selenium-webdriver 2.16.

Den 6. jan. 2012 kl. 16:28 skrev Abe Heward abe.hew...@gmail.com:

Could someone provide advice on how to monkey patch watir-webdriver so
that I can avoid the dreaded
*Selenium::WebDriver::Error::MoveTargetOutOfBoundsError:
Element cannot be scrolled into view:[object HTMLButtonElement]* error?

I don't need all the other overhead of the qa_robusta gem, so help here on
writing a scroll_to method (presumably for the Watir::Element class?)
would be greatly appreciated!

I tried to use the qa_robusta method definition as a template, but have so
far failed to get anything to work.

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

-- 
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: Upgrading anxiety

2011-12-31 Thread Jari Bakken
It's still useful for people using 1.X. Perhaps create a new
comparison page for 2.X?

Den 31. des. 2011 kl. 10:18 skrev Jarmo Pertman jarm...@gmail.com:

 On Dec 30, 10:54 am, Željko Filipin zeljko.fili...@wa-research.ch
 wrote:
 https://github.com/jarib/watir-webdriver/wiki/Comparison-with-Watir-1.X

 This list is not up to date anymore - should we just delete the
 statements which aren't true anymore so it would reflect the actual
 state? This list seems to be true when compared with Watir 1.x, but
 not with 2.x.


 Jarmo Pertman
 -
 IT does really matter - http://itreallymatters.net

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

-- 
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] the watir-webdriver scripts not running on firefox8: receiving unable to obtain stable firefox connection in 60 seconds

2011-12-28 Thread Jari Bakken
On Wed, Dec 28, 2011 at 4:21 PM, bryan rasmussen
rasmussen.br...@gmail.comwrote:

  unable to obtain stable firefox connection in 60 seconds
 (127.0.0.1:7056) (Selenium::WebDriver::Error::WebDriverError)

  
 /usr/share/ruby-rvm/gems/jruby-1.6.5/gems/selenium-webdriver-2.5.0/lib/selenium/webdriver/firefox/launcher.rb:77:in
 `connect_until_stable'


This stacktrace indicates you're running selenium-webdriver 2.5.0. Support
for Firefox 8 was added in 2.12.0:

  http://selenium.googlecode.com/svn/trunk/rb/CHANGES

Jari

-- 
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 Webdriver Performance Error

2011-12-08 Thread Jari Bakken
On Thu, Dec 8, 2011 at 3:36 AM, @90kts tim.ko...@gmail.com wrote:

 Well it appears from the OP error that the return object
 of Browser#execute_script is a WebDriver::Element.. hence my code is
 failing as it expects a hash.

 I'm not sure why this is doing it on Win2K8 R2 with IE9, as I don't have
 that development platform... but it was tested on Win2K3 with IE9 as Chuck
 mentioned.

 I could just raise an error like Jari suggested, but that won't help the
 outcome (getting navigation timings).

 We *could* just monkey patch the execute_script method, but before I do,
 Jari, is there a more elegant solution?

 module Watir
  class Browser
   def execute_script(script, *args)
args.map! { |e| e.kind_of?(Watir::Element) ? e.wd : e }
obj = @driver.execute_script(script, *args)
obj.each { |k,v| obj[k] = wrap_elements_in(v) }
obj
   end
  end
 end



Well, execute_script should already wrap instances of
Selenium::WebDriver::Element in Watir::Element, so I'm not sure how that is
happening.


https://github.com/jarib/watir-webdriver/blob/master/lib/watir-webdriver/browser.rb#L122

I don't really see how the monkey patch would help (e.g. it would break any
script that doesn't return a Hash). Someone needs to get their hands on a
Windows box in order to solve this I think :)



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


-- 
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] Can't set visible text_field in firefox8 (watir-webdriver)

2011-12-07 Thread Jari Bakken
Try updating selenium-webdriver to the latest version (2.14.0). Firefox 8
support was added in 2.12.

On Thu, Dec 8, 2011 at 12:10 AM, spb matio...@gmail.com wrote:

 ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
 watir-webdriver v0.3.5

 The following code works fine for :ie and :chrome (click login button
 after setting username and password):
 But it raises error for firefox 8.0.1
  text_field(:id = 'txtPassword') element is not currently visible and so
 may not be interacted with...

 But text_field(:id = 'txtPassword').visible? returns 'true' just
 before calling text_field(:id = 'txtPassword').value = (txt). And
 it is strange for me that :ie and :chrome can set this text_field
 but :firefox can't

 If I set at first txtPassword then txtUserName = error will be raised
 for text_field(:id = 'txtUserName')

 Any idea how to avoid this error would be appreciated.

 #--
 #Login to site
 #--
 require 'watir-webdriver'

 def test()
  txt = 123;
  url = http://www.bet365.com/instantbet/default.asp;
  browser = Watir::Browser.new :ff
  browser.goto url
  #set username
  browser.text_field(:id = 'txtUserName1').fire_event(onfocus)
  p ['txtUserName', browser.text_field(:id = 'txtPassword').visible?]
  browser.text_field(:id = 'txtUserName').value =(txt)
  #password
  browser.text_field(:id = 'txtPassword1').fire_event(onfocus)
  p ['txtPassword', browser.text_field(:id = 'txtPassword').visible?]
  browser.text_field(:id = 'txtPassword').value = (txt)
  browser.a(:id = 'aLGI').click
  sleep(5)
  browser.close
 end

 test()
 #--


 P.S.
 [remote server] resource://fxdriver/modules/atoms.js:9505:in
 `unknown': Element is not currently visible and so may not be
 interacted with (Selenium::WebDriver::Error::ElementNotDisplayedError)
from [remote server]

 file:///C:/DOCUME~1/K/LOCALS~1/Temp/webdriver-profile20111208-2196-1tennqj/extensions/
 fxdri...@googlecode.com/components/nsCommandProcessor.js:256:in
 `unknown'
from [remote server]

 file:///C:/DOCUME~1/K/LOCALS~1/Temp/webdriver-profile20111208-2196-1tennqj/extensions/
 fxdri...@googlecode.com/components/nsCommandProcessor.js:305:in
 `unknown'
from [remote server]

 file:///C:/DOCUME~1/K/LOCALS~1/Temp/webdriver-profile20111208-2196-1tennqj/extensions/
 fxdri...@googlecode.com/components/nsCommandProcessor.js:320:in
 `unknown'
from [remote server]

 file:///C:/DOCUME~1/K/LOCALS~1/Temp/webdriver-profile20111208-2196-1tennqj/extensions/
 fxdri...@googlecode.com/components/nsCommandProcessor.js:197:in
 `unknown'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-
 webdriver-2.10.0/lib/selenium/webdriver/remote/response.rb:50:in
 `assert_ok'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-
 webdriver-2.10.0/lib/selenium/webdriver/remote/response.rb:15:in
 `initialize'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-
 webdriver-2.10.0/lib/selenium/webdriver/remote/http/common.rb:54:in
 `new'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-
 webdriver-2.10.0/lib/selenium/webdriver/remote/http/common.rb:54:in
 `create_response'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-
 webdriver-2.10.0/lib/selenium/webdriver/remote/http/default.rb:64:in
 `request'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-
 webdriver-2.10.0/lib/selenium/webdriver/remote/http/common.rb:35:in
 `call'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-
 webdriver-2.10.0/lib/selenium/webdriver/remote/bridge.rb:426:in
 `raw_execute'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-
 webdriver-2.10.0/lib/selenium/webdriver/remote/bridge.rb:404:in
 `execute'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-
 webdriver-2.10.0/lib/selenium/webdriver/remote/bridge.rb:316:in
 `sendKeysToElement'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-
 webdriver-2.10.0/lib/selenium/webdriver/common/element.rb:102:in
 `send_keys'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.3.5/
 lib/watir-webdriver/elements/text_field.rb:17:in `set'
from D:/NetBeansProjects/HorseBetting/lib/horsemain.rb:227:in
 `test1'
from D:/NetBeansProjects/HorseBetting/lib/horsemain.rb:233:in
 `main'

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


-- 
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: FireFox 8 and mouseover and/or clicking

2011-12-07 Thread Jari Bakken
On Wed, Dec 7, 2011 at 11:29 PM, Chuck van der Linden sqa...@gmail.comwrote:


 if anyone can find a good way to automate this in Watir or Watir-
 Webdriver for IE and FF8  I'd love to see code.


 If you're on a platform that supports WebDriver's native events, you can
do this by using the ActionBuilder API from WebDriver:

  https://gist.github.com/1445418

Native events are currently only supported on Windows and Linux, and is
only enabled by default on Windows. The code above shows how to explicitly
enable it on Linux.

I should probably add Element#hover to watir-webdriver - feel free to open
an issue for that.

-- 
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 Webdriver Performance Error

2011-12-06 Thread Jari Bakken
It sounds like the execute_script call in IE9 is returning a DOM
element instead of null or an object. Probably the gem should be
stricter about type checking the returned value and raise an error if
it's not what it expects.

Den 6. des. 2011 kl. 22:50 skrev Chuck van der Linden sqa...@gmail.com:

 I get the same error on Win7 running IE9, protected mode off, from an
 admin level command prompt

 even went so far as to use a local page, set to be a trusted site,
 with my security  settings for trusted sites set to low.

 Not sure what else I could lower security wise in order to let that
 sucker run, so it may be some other error caused by newer version of
 webdriver or something else.  (it could still be security, but if so,
 what more could you relax to let it work?)

 I can access the window.performance method from the developer tools
 console on IE, so I know at least that much is present.
 window.msPerformance  doesn't seem to do anything however some things
 I am seeing seem to imply that perhaps that was an early prototype api
 the MS was messing with and it might all have been just rolled into
 window.performance now.

 Using the same code against current Chrome and Firefox works fine,
 it's only the IE9 that seems busted.

 Taking either browser to http://webtimingdemo.appspot.com/ works just
 fine, and as far as I know, it uses the same performance API stuff
 that the gem s trying to use.

 The nature of the error (and that we are not seeing a warning that the
 browser does not support performance metrics) would seem to indicate
 that it's getting a null object back when it tries to get the
 performance data (and then that fails in munge because the null object
 doesn't have any methods defined, much less one for each_key) so it's
 as if the code is making the call but just not getting anything back
 which is a bit strange.

 This might be a question that has to be addressed to someone at MS or
 maybe the gem author to troubleshoot and figure out what is going
 wrong.

 The fact that you and I are both seeing it, under both Server2008 and
 Win7 makes me wonder if there was perhaps some recent change in
 webdriver that might be at fault?   I think this is going to take
 someone with more knowledge in this area like TimK to chime in.

 On Dec 6, 10:28 am, bis bis...@gmail.com wrote:
 well basically what you are trying to do with the gem is this
 driver.execute_script(return window.performance ||
 window.webkitPerformance || window.mozPerformance || window.msPerformance;)
 and some formatting to give you the methods...

 and what it looks like is that the browser is not allowing you to perform
 that. I would check the security settings. you get this same errror when
 you run it against a browser that doesn't support webtimings. and since you
 are running on windows server its probably permission settings.

 2011/12/6 Jason Shelton jas.shel...@hotmail.com







  I apologize, I did not realize the screenshot of the error was
 insufficient. Below is the the text of the error:

  
 C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-performance-0.1.3.1/lib/watir-webdriver-performance.rb:15:in
 'munge': undefined method 'each_key' for
 #Selenium::WebDriver::Element:0x292fcc8 NoMethodError

 from  
 C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-performance-0.1.3.1/lib/watir-webdriver-performance.rb:90:in
 'performance'

 Here is the code:

 require 'watir-webdriver'
 require 'watir-webdriver-performance'

 b = Watir::Browser.new :ie
 b.goto 'http://watir.com'
 puts Load Time: #{b.performance.summary[:response_time]/1000} seconds.

 As I mentioned before, this error only occurs when I use IE 9 as the 
 browser. I am using a Win Server 2008 R2 box. Thanks in advance for any 
 assistance with this issue.

 - Shelton

 --
 From: zeljko.fili...@wa-research.ch
 Date: Tue, 6 Dec 2011 10:47:19 +0100
 Subject: Re: [wtr-general] Watir Webdriver Performance Error
 To: watir-general@googlegroups.com

 On Tue, Dec 6, 2011 at 7:22 AM, Jason Shelton jas.shel...@hotmail.com
 wrote:
 I am getting the attached error

 1) Please copy/paste the text of the error. Let me know if you do not know
 how to do that.
 2) Please provide the code that caused the error.

 Željko
 --
 watir.com/book - author

 --
 Before posting, please readhttp://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

 --
 Before posting, please readhttp://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

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

-- 
Before posting, 

Re: [wtr-general] Re: Can you run Watir on an Ipad?

2011-11-21 Thread Jari Bakken
watir-webdriver won't run on the iPad/iPhone (either emulator or device)
until this bug is fixed:

  http://code.google.com/p/selenium/issues/detail?id=1371


On Mon, Nov 21, 2011 at 8:56 PM, bis bis...@gmail.com wrote:

 I was going to www.etsy.com

 On Mon, Nov 21, 2011 at 12:50 PM, Chuck van der Linden sqa...@gmail.com
 wrote:
  No worries for the hijack..
 
  I was responding to I guess I'm wondering if you can
  install Ruby and the watir-webdriver gems on an Ipad. 
 
  which I didn't take to mean using an emulator.  (although I agree for
  testing purposes, the emulator approach is most likely best. )
 
  It would be interesting to figure out why the iphonedriver doesn't
  work with watir-webdriver once it gets to the webpage.  (what webpage
  is it going to?)
 
  On Nov 21, 10:55 am, bis bis...@gmail.com wrote:
  I think he meant running them against an iphone/ipad either device or
  simulator this can be done with iphonedriver. we actually messed
  around with trying to actually get watir-webdriver and the
  iphonedriver to work together but it seems that watir-webdriver can
  launch the browser and go to the webpage but it cant interact with any
  of the elements.
 
  sorry for the hijack
 
  On Mon, Nov 21, 2011 at 11:48 AM, Chuck van der Linden 
 sqa...@gmail.com wrote:
 
 
 
 
 
 
 
   Well firstly you would need Ruby for the iPad, and I don't know if
   such a beast exists, and if it does how good it is. ( Not owning an
   iPad, I'm not interested enough to research this.. google is your
   friend, have fun ;-) let us know if you find anything promising)
 
   After that you'd likely need to run SafariWatir but I don't know if
   the iPad safari is close enough to the Mac version to work with it.
   as far as I know, nobody has tried this yet.
 
   Watir would not work of course because it drives IE, and it will be a
   pretty cold day in hell before apple  MS conspire to create an IE
   browser for the iPad.
 
   You Might (again depending on how good the ruby environment for the
   iPad is) be able to use something like Watir-webdriver and run it
   against Opera or Firefox, both of which I believe had iPad versions,
   but I'm not sure how well that would work or if the webdriver drivers
   for those browsers would work on the iPad.
 
   (personally, given what a security sieve Safari is, if I had an iPad,
   I think I'd take a hard look at Firefox or Opera as a browser on that
   device anyway, so looking into at least part of that might be good for
   you in terms of finding a good safe browser to surf with.)
 
   Even presuming all that worked, I'm not sure the iPad's multitasking
   capabilities (or lack thereof) are up to running all that stuff at the
   same time.
 
   As far as I understand it, people developing stuff to run on iPads
   often use emulators to simulate the ipad, and most of their test tools
   run on the host OS in parallel with the emulator software, I suspect
   in large part due to multitasking restrictions on the iPad itself (at
   least the initial generation)
 
   On Nov 21, 6:07 am, Patrick patrick.rawli...@gmail.com wrote:
   Is it possible to take existing Watir scripts that run on a
 webbrowser
   and have them run on an Ipad?  I guess I'm wondering if you can
   install Ruby and the watir-webdriver gems on an Ipad.
 
   If anyone has successfully done this I'd love to hear about it.
 
   Thanks,
 
   Patrick
 
   --
   Before posting, please readhttp://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
 
  --
  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
 

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


-- 
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] making old watir scripts compatiable with new watir webdriver

2011-11-10 Thread Jari Bakken
watir-webdriver doesn't support .attach, but we do support switching
between windows (which is the 95% use case) through the browser.window{,s}
API:

  https://github.com/jarib/watirspec/blob/watir2/window_switching_spec.rb

As for other API changes, there's no quick solution - you'll have to change
your code to work with watir-webdriver.


On Thu, Nov 10, 2011 at 5:06 PM, sumanth anansumanthku...@gmail.com wrote:

 Hi All,

We have pretty big framework written with watir 1.6.5 and as you
 know watir is not supporting ff4.0 or greater versions.
   only solution seems to migrate to watir-webdriver. But It looks
 lots of methods are not supported in webdriver which are supported in
 watir [like attaching a active browser]. Do we have any solutions to
 overcome this problem?

I am just wondering how to migrate this huge library to use watir-
 webdriver. any news for jssh plugins for ff4.0 or greater versions?

 Thanks in advance

 Sumanth

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


-- 
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] the watir-webdriver scripts not running on firefox8: receiving unable to obtain stable firefox connection in 60 seconds

2011-11-09 Thread Jari Bakken
Hi,

a. Your selenium-webdriver gem is 3 versions old (latest release is 2.10).
If you update your browser and something is not working, making sure you
have the latest selenium-webdriver gem is always a good first step.

b. The next version of the selenium-webdriver gem (2.12.0 since the Ruby
bindings skipped the 2.11 release) will support Firefox 8. Should be
released either today or tomorrow.


On Wed, Nov 9, 2011 at 7:07 PM, Cristina Dumitrescu 
cristina.watir.toro...@gmail.com wrote:


 Hi,

 I've update the firefox to the latest version ff8.

 And I cannot run the scripts because I am receiving
 Selenium::WebDriver::Error::WebDriverError: unable to obtain stable
 firefox connection in 60 seconds (127.0.0.1:7055)

 irb(main):002:0 browser = Watir::Browser.new:ff
 Selenium::WebDriver::Error::WebDriverError: unable to obtain stable
 firefox connection in 60 seconds (127.0.0.1:7055)
 from
 C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/firefox/launcher.rb:77:in
 `conn
 ect_until_stable'
 from
 C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/firefox/launcher.rb:37:in
 `bloc
 k in launch'
 from
 C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/firefox/socket_lock.rb:20:in
 `l
 ocked'
 from
 C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/firefox/launcher.rb:32:in
 `laun
 ch'
 from
 C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/firefox/bridge.rb:19:in
 `initia
 lize'
 from
 C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/common/driver.rb:29:in
 `new'
 from
 C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/common/driver.rb:29:in
 `for'
 from
 C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver.rb:81:in
 `for'
 from
 C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.3.8/lib/watir-webdriver/browser.rb:35:in
 `initialize'
 from (irb):2:in `new'
 from (irb):2
 from C:/Ruby192/bin/irb:12:in `main'


 Does anyone know how to fix that?

 Best regards,
 Cristina

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


-- 
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] I need to retrieve multiple span class=discussion-title

2011-11-07 Thread Jari Bakken
On Mon, Nov 7, 2011 at 3:41 PM, Joe Fleck joeflec...@gmail.com wrote:

 Okay, I just the answer that works in getting the class name.

 .attribute_value('*class*')



.class_name would work as well.

-- 
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] require 'watir-webdiver' failing with 'can't activate ffi'

2011-11-02 Thread Jari Bakken
It's a problem when childprocess has a looser dependency on the ffi gem
than selenium-webdriver. ffi 1.0.10 was released without proper Windows
support at first, so I made the dependency stricter (= 1.0.9) for
selenium-webdriver to avoid problems for Windows users, and forgot to make
the same change in childprocess.

As a temporary workaround, either (a) uninstall ffi-1.0.10 or (b) use
bundler [1] to manage your dependencies.
As a more permanent fix, the next release of selenium-webdriver (due
tomorrow) should have the dependency in sync with childprocess.

Jari

[1] http://gembundler.com/

On Wed, Nov 2, 2011 at 11:01 PM, Rick bellc...@yahoo.com wrote:

 Any idea  what i am doing wrong?  Overview.rb line 3 has - require
 watir-webdriver.

 Thanks in advance

 $ ./Overview.rb
 /usr/lib/ruby/1.9.1/rubygems.rb:238:in `activate': can't activate ffi
 (= 1.0.9, runtime) for [selenium-webdriver-2.10.0, watir-
 webdriver-0.3.5], already activated ffi-1.0.10 for
 [childprocess-0.2.2, selenium-webdriver-2.10.0, watir-
 webdriver-0.3.5] (Gem::LoadError)
from /usr/lib/ruby/1.9.1/rubygems.rb:254:in `block in activate'
from /usr/lib/ruby/1.9.1/rubygems.rb:253:in `each'
from /usr/lib/ruby/1.9.1/rubygems.rb:253:in `activate'
from /usr/lib/ruby/1.9.1/rubygems.rb:254:in `block in activate'
from /usr/lib/ruby/1.9.1/rubygems.rb:253:in `each'
from /usr/lib/ruby/1.9.1/rubygems.rb:253:in `activate'
from /usr/lib/ruby/1.9.1/rubygems.rb:1119:in `try_activate'
from internal:gem_prelude:218:in `try_activate'
from internal:lib/rubygems/custom_require:32:in `rescue in
 require'
from internal:lib/rubygems/custom_require:29:in `require'
from ./Overview.rb:3:in `main'

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


-- 
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 web-driver hwnd

2011-11-02 Thread Jari Bakken
On Wed, Nov 2, 2011 at 10:07 PM, Chuck van der Linden sqa...@gmail.comwrote:



  Current FF also seems to no longer like this little trick, although
 you can find blog postings saying it works (but they are all from like
 2008).  I just tried this in FF7 and even with javascript enabled, and
 things set to allow it to move the browser entering
 javascript:window.resizeTo(800,600) into the URL bar had zero effect.



Yeah, most modern browsers now don't allow this unless the page owns the
window (i.e. a popup window) - so you can't resize or move the main window.
That's why we want to add a window handling API to WebDriver.

-- 
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] watir web-driver hwnd

2011-11-01 Thread Jari Bakken
What are you trying to accomplish, high-level?

On Tue, Nov 1, 2011 at 4:06 PM, Dan dfra...@gmail.com wrote:

 I've done a fair amount of searching for the method to get hwnd of a
 browser with the watir webdriver and I'm coming up empty handed.  It's very
 easy in Watir: browser.hwnd.

 Thanks!
 Dan

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


-- 
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] watir web-driver hwnd

2011-11-01 Thread Jari Bakken
I see. Feel free to star this issue in the Selenium tracker, which deals
with adding a cross-platform API to resize and move windows in WebDriver
(which would allow us to expose it in watir-webdriver as well):

  http://code.google.com/p/selenium/issues/detail?id=174



On Tue, Nov 1, 2011 at 6:27 PM, Dan dfra...@gmail.com wrote:

 I wanted to use Win32API to do some window manipulation.  I ended up
 finding another way to do it.  Basically I have a number of browsers I'm
 opening and I want to be able to position them in different places on the
 screen.  Not really a functional test or requirement, but it'll make it
 easier for me to monitor the tests when running and nice for demos.

 I decided to change the title of the browser and then I can uniquely
 identify them if I need to be able to before calling the Win32API functions
 I need to.

 Something like this:

 browser.execute_script(document.title = 'UniqueBrowser #{x}')
 hWnd = FindWindow.call(nil, UniqueBrowser #{x} - Google Chrome)
 ret = MoveWindow.call(hWnd, 0, 0, 640, 512, true)

 Knowing full well that after I goto any other page that this title I've
 set will be gone.  I just really need it for the initial set-up.

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


-- 
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] watir-webdriver unable to detect firefox

2011-10-18 Thread Jari Bakken
On Tue, Oct 18, 2011 at 7:52 AM, tester pavan247...@gmail.com wrote:

 hi

 i am using ruby 1.8.6
 and gems
  watir (1.6.7, 1.5.6)
 watir-webdriver (0.1.7)


Make sure you have the latest version of these gems: watir-webdriver,
childprocess, selenium-webdriver.

Also, you should update your Ruby installation - 1.8.6 is not officially
supported by WebDriver (i.e. if it works, it's just by luck).

-- 
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: Handling a MAC Pro book File Upload window.

2011-10-18 Thread Jari Bakken
Some file upload solutions lets the user click a link, which then creates a
hidden file field and opens the upload dialog. The only way to deal with
these types of uploads is to make the file field visible, usually by
modifying its style through Browser#execute_script. This may be what you're
seeing, though unless you show us a page that will reproduce the problem,
it's a wild guess.

Jari

On Tue, Oct 18, 2011 at 4:19 PM, Joe Fleck joeflec...@gmail.com wrote:

 Hi,

 Thank you all for helping. I really appreciate it.

 I believe the file path is correct now because the error message I am now
 getting has changed.

 Code:
 #Attach file
   @browser.file_field(:id,
 the_file).set(/Users/josephfleck/Documents/DownloadDocs/DataFile.xls)

 It doesn't object name i am giving it.  Do I need to use something else
 like the actual object name of the text field?


 /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.4/lib/watir-webdriver/elements/element.rb:248:in
 `assert_exists': unable to locate element, using {:type=file,
 :tag_name=input, :id=the_file}
 (Watir::Exception::UnknownObjectException)
 from
 /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.4/lib/watir-webdriver/elements/file_field.rb:23:in
 `value='
 from
 /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.4/lib/watir-webdriver/elements/file_field.rb:14:in
 `set'
  from ./common/helper_methods.rb:182:in `share_documents'
 from
 /Users/josephfleck/Sites/within3/qa_automation/discussion/add_multiple_discussion.rb:159
 from
 /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:696:in
 `each'
 from
 /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:696:in
 `each'
 from
 /Users/josephfleck/Sites/within3/qa_automation/discussion/add_multiple_discussion.rb:38

 On Tue, Oct 18, 2011 at 9:28 AM, Joe DiMauro joe...@comcast.net wrote:

 Another thing I noticed. Due to the path ending with
 \criptDataFile.xls

 It appers that the backslash followed by the two characters cr
 is being interpeted as a Carridge Return.  You can see this
 in the error message:

 No such file or directory - Users/josephfleck/Documents/Download
 Docs/ iptDataFile.xls (Errno::ENOENT)
  ^
 Notice the space instead of the characterscr indicating
 that \cr was interpreted as a Carriage Return, not the first
 two characters in the file name criptDataFile.xls


 So try all these:
 1. Use a full pathname, not a relative path (as previously mentioned)
 Unless Ruby is running with the Root level of your Mac as it
 working
directory, (which I'm pretty sure its not), then the Users
 directory will not be a valid relative path.)

 2. Remove the backslashes. They are not necessary on Mac/Linus OS,
(as previously mentioned), and may cause issues (e.g. \cr)

 3. Always a good idea (as previously mentioned), to upgrade to the
latest version of the gems, (and Ruby if possible)

If you are also running safariWatir you may not be able to upgrade
to Ruby 1.9.x.  I don't recall if safariWatir supports 1.9.x yet.

 4. The space in the directory name should not be an issue, since the
full path is quoted,  but whenever possible using directory
   and file names without spaces is always safer.


 Joe DiMauro


 On Oct 17, 4:42 pm, Chuck van der Linden sqa...@gmail.com wrote:
  or escape the space with a backslash? same as you are doing for the
  slashes?  (but Michael's solution of using double-quotes might be even
  easier)
 
  On Oct 17, 1:50 pm, Željko Filipin zeljko.fili...@wa-research.ch
  wrote:
 
   On Mon, Oct 17, 2011 at 10:01 PM, Joe Fleck joeflec...@gmail.com
 wrote:
 No such file or directory - Users/josephfleck/Documents/Download
 Docs/
 
   iptDataFile.xls
 
   Try putting the file in a folder that has no spaces, something
   like Users/josephfleck
 
   Ž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.comhttp://groups.google.com/group/watir-generalwatir-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


-- 
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] watir-webdriver survey for adding items such as: alert_box, scroll_to, and in_viewable_area?

2011-10-11 Thread Jari Bakken
On Tue, Oct 11, 2011 at 6:07 PM, Cliff Cyphers cliff.cyph...@gmail.comwrote:

 Hello Watir users

 I wanted to write the watir-general community and inquire about how
 much pain you feel around what appears to be some common items that
 might need to be added to watir-webdriver.

 1.  The underlying selenium-webdriver can not perform an action on an
 element if it isn't in the viewable area on the browser.  Actions such
 as click, text, html, etc on such elements will fail under this
 condition.
 2.  The code for handling alert boxes seams to be very flaky on
 certain OS/browser combinations.
 3.  fire_event('mouseover') doesn't work on all OS/browser combinations

 All of these aspects can easily be updated to make your life easier.
 Updates to handle each of these aspects are included in qa_robusta,
 which has previously been mentioned on the list.  If you feel that
 these features are valuable, there's a better chance they will get
 incorporated into the main release of watir-webdriver if you voice
 your opinion.

 See
 https://github.com/ccyphers/qa_robusta/blob/master/qa_observer/lib/watir.rb
 for a current implementation to handle these points.  Note, personally
 I think it might be best to make a slight update to this
 implementation, for the element not in the viewable area.  All method
 calls to Watir::Element which require the element to be in view, could
 first:

 Watir::Element#scroll_to unless unless Watir::Element#in_viewable_area?



This is the intended default behaviour in WebDriver when you try to click an
element. If you can provide an example of a case where this is failing,
please open a bug in the Selenium tracker:

  http://code.google.com/p/selenium/issues/entry



 Dealing with alert boxes you would now be able to do something like:
 some_element.alert_box.text
 some_element.alert_box.dismiss


Yes, we should replace the alert extension with an API that wraps
WebDriver's alert handling. I don't think it makes sense to add the API to
Element though, was that a typo?



 For mouseovering an element, you no longer would need to call
 fire_event, which is unreliable.  You could simply:
 some_element.mouseover

 Thank you for your comments
 Cliff.

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


-- 
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: Strangeness with watir and IE or I may be missing something.

2011-10-10 Thread Jari Bakken
You may be interested in Alister's Etsy code at
https://github.com/alisterscott/EtsyWatirWebDriver/

On Mon, Oct 10, 2011 at 6:56 PM, bis bis...@gmail.com wrote:

 No I do not work for Etsy in any way, Also the automated tests using watir,
 taza, rspec, and cucumber do not violate the terms of use for the site or
 api as far as i understand them.

 But in your concern I have fired off a letter to Etsy about this and the
 ToS. Also if this is in fact the case then I will also send an email to
 everyone else that has written a tutorial or testing examples using the Etsy
 site as well

 this is my blog post about the tests I wrote against etsy
 http://thechort.com/blog/?p=105
 and the code
 https://github.com/hammernight/etsy_cucumber_taza_tutorial/




 On Mon, Oct 10, 2011 at 1:10 PM, Chuck van der Linden sqa...@gmail.comwrote:

 Before we go any further assisting you with this, can you offer some
 assurance that you are either working for Etsy or have specific
 written permission to interface with their site in this way?

 Otherwise what you are doing violates their terms of service (see
 below) and while I cannot speak for others, I for one refuse to be a
 party to any such activity.

 From Etsy's terms of service:

 11. Access and Interference

 Etsy may contain robot exclusion headers which contain internal rules
 for software usage. Much of the information on Etsy is updated on a
 real-time basis and is proprietary or is licensed to Etsy by Etsy's
 users or third-parties. You agree that you will not use any robot,
 spider, scraper or other automated means to access Etsy for any
 purpose whatsoever, except to the extent expressly permitted by and in
 compliance with Etsy's API Terms of Use or otherwise without Etsy's
 prior express written permission. Additionally, you agree that you
 will not:

Take any action that imposes, or may impose, in Etsy's sole
 discretion, an unreasonable or disproportionately large load on Etsy's
 infrastructure
Copy, reproduce, modify, create derivative works from, distribute
 or publicly display any user Content (except for your Content) or
 other allowed uses as set out in The DOs  DON'Ts of Etsy from the
 Site except to the extent expressly permitted by and in compliance
 with Etsy's API Terms of Use or otherwise without the prior express
 written permission of Etsy and the appropriate third party, as
 applicable
Interfere or attempt to interfere with the proper working of the
 Site or any activities conducted on the Site
Bypass Etsy's robot exclusion headers or other measures Etsy may
 use to prevent or restrict access to Etsy
 

 On Oct 3, 10:27 am, bis bis...@gmail.com wrote:
  Ok, So I came across a strange issue clicking on this drop down in
 watir.
  but I don't get the same thing using watir-webdriver.
 
  I can click the button and it should open the drop down(list) and I
 should
  be able to click on one of the items in that list. but when watir fires
 the
  click i see it clicking but it does not open the drop down(list)
  watir-webdriver fires the click opens the dropdown and allows me to
 select
  the item in the list i want. any suggestions?
 
  So here is the code on the page http://www.etsy.com/.
 
  form action=http://www.etsy.com/search.php; id=search-bar class=
  div class= style=-moz-user-select: none; cursor:
  default; id=search-facet tabindex=0 aria-haspopup=true
  label for=search-queryHandmade/label
  iframe style=display: none; width: 178px;
  height: 170px; src=javascript:false; id=search-facet-shim
  tabindex=-1 longdesc=Decorative title= frameborder=0/iframe
  ul id=search-facet-list class=closed
 tabindex=0
  li class=handmade
  selectedHandmade/li
  li
 class=vintageVintage/li
  li
 class=suppliesSupplies/li
  li class=allAll
 Items/li
  li
 class=peoplePeople/li
  li class=shopsShops/li
  /ul
  /div
  div class=input-group
  input autocomplete=off value=
  name=search_query id=search-query class=text tabindex=0
  type=textdiv style=top: 42px; left: 0px; width: 369px; display:
  none; id=search-suggestions/div
  button id=search_submit name=search_submit
  type=submit
  Search
  /button
  /div
  input value=handmade name=search_type
  id=search-type type=hidden
  /form
 
  now you would think that a simple.
 
  b.label(:for = 'search-query').click
  b.li(:text = 'Supplies').click
 
  but it doesn't at least not with watir, watir-webdriver on the other
 hand
  works just fine
 
  #chrome:
  irb
  

Re: [wtr-general] Switching To Frames in Watir-WebDriver

2011-10-06 Thread Jari Bakken
Watir has its own API for dealing with frames:

  @browser.frame(:id = ModalDialogContent).button.click

If you reach into the WebDriver API and switch manually, watir-webdriver
will get confused.

Jari

On Thu, Oct 6, 2011 at 3:17 PM, Jeff Nyman jeffny...@gmail.com wrote:

 I just wanted to check if it's a known issue that switchTo.frame does
 not appear to work with Watir-WebDriver. This does appear to work with
 Selenium-WebDriver.

 Here's the command I try in Selenium that does work:

  @browser.switch_to.frame(ModalDialogContent)

 I try a slightly modified verison of the command for Watir:

  @browser.driver.switch_to.frame(ModalDialogContent)

 This does not seem to work at all.

 Here ModalDialogContent is the name of a frame within the browser
 window when my application starts up. I'm early enough in framework
 design that I can switch to Selenium if need be but I wanted to make
 sure I was doing this correctly in Watir before I did so.

 Any thoughts or suggetsions are most welcome.

 - Jeff

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


-- 
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: waiting using implicit_wait with watir-webdriver

2011-10-05 Thread Jari Bakken
I usually prefer waiting explicitly (especially since watir-webdriver makes
it so easy) and never use implicit waits. Implicit waits hide information
about app behaviour from test developers that I think is often quite
relevant, and slows down your tests when (a) you want to check that an
element is missing or (b) the missing element is an application bug and
should fail immediately.

It'd be useful if the waiting page on the web site could separate a bit
between the two approaches. Combining them is not always pleasant, see e.g.
https://groups.google.com/forum/#!topic/selenium-developers/91vSZHxAnCg

Jari


On Wed, Oct 5, 2011 at 1:27 PM, Alister Scott alister.sc...@gmail.comwrote:

 I am glad you found it useful. I have put it on the watirwebdriver.comsite:
 http://watirwebdriver.com/waiting/

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


-- 
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] waiting using implicit_wait with watir-webdriver

2011-10-05 Thread Jari Bakken
On Wed, Oct 5, 2011 at 4:08 PM, Rahul Sharma rahulsharma@gmail.comwrote:

 Hi Jari,

 We have been using explicit waits for a long time and one drawback that we
 have encountered is when the tests fail. The timeout I believe with
 Watir::Wait.until is 30 secs. If the test was going to fail it will still
 try to locate the element(correct me if I am wrong!). Should this be cut
 down to less seconds?



I'm not sure how that's worse than implicit waits. With explicit waits, it
will at least only happen when you explicitly tell it to, not for *every*
element lookup. You can also pass your preferred timeout as the first
argument to all the wait methods.

-- 
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] Test::Unit Assert throws error instead of sending false for existence of page element

2011-10-05 Thread Jari Bakken
Yes, it should. Can you provide a reduced example where that's not the case?

Den 5. okt. 2011 kl. 21:50 skrev Abe Heward ahew...@rsmart.com:

Hey guys,

I'm using watir-webdriver (0.3.3) and Test::Unit.

In my code I'm trying to validate that an object is NOT present on the
page...

assert_equal(false, @browser.button(:id=post).exist?)

...However, instead of getting the false result for the .exist?,
apparently it's throwing this selenium error:

Selenium::WebDriver::Error::ObsoleteElementError: Element not found in the
cache

I suppose I can validate the non-existence of page elements in some other
way, but shouldn't I just get a false returned for that *.exist? *method?

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

-- 
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] Watir-WebDriver and JavaScript Alerts

2011-10-01 Thread Jari Bakken
There are two options to handle alerts with watir-webdriver:

# use the alert helper to override the alert function:

  require watir-webdriver/extensions/alerts

  browser.alert do
browser.button.click # action that triggers the alert
  end

# reach into the WebDriver alert API

  browser.button.click # action that triggers the alert
  browser.driver.switch_to.alert.dismiss

The first API was made before WebDriver had any alert support, and is
subject to be removed in the future. I'd recommend you stick to the latter
for now.





On Sat, Oct 1, 2011 at 7:26 PM, Jeff Nyman jeffny...@gmail.com wrote:

 Hey all.

 I've tried searching for this on my own but looking for specific
 solutions in Watir or Watir-WebDriver is often a needle in a haystack
 venture. In this case, I have an application that has a JavaScript
 alert that pops up when an OK button is clicked. I need to get the
 message in the alert box and then click OK to get rid of it.

 I can do this easily in Selenium (most notably using the alertAssert)
 but I'm having trouble seeing how to do it in Watir.

 I saw this page: http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups.
 It mentions this line:

 $ie.javascript_dialog.button('OK').click

 That does nothing for me but I'm using watir-webdriver as opposed to
 just watir so that might be why that is.

 Some of the blog posts (like
 http://watir.com/2011/01/14/testing-webpages-with-javascript-popups-correctly/
 )
 I've found indicate more how you can just ignore the JavaScript alert
 -- but that's not a good way to do things if your application requires
 the alert to be present and show text. I have to test for that. I
 would be okay with dismissing the alert if there was some equivalent
 of Selenium's assertAlert so that I could at least get the message
 returned.

 Any thoughts? Not being able to handle JavaScript dialogs -- annoying
 as they are -- is definitely a deal breaker so I'm open to any
 suggestions.

 - Jeff


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


-- 
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] Does watir support svg

2011-09-15 Thread Jari Bakken
On Wed, Sep 14, 2011 at 5:41 PM, al3kc aleks.kiev...@gmail.com wrote:

 Hi,

 I have the following svg element in the page

 table
   div
 svg
   rect
   rect

 I want to access rect elements. I use element_by_xpath but i can only
 access //table/div element. When I use  //table/div/svg I get
 error that elemt does not exists. Thought when I do
 element_by_xpath( //table/div).html I can see svg and rect elements
 in output. Does watir support svg at all? Any ideas how to access svg
 in other way?


Even though the SVG elements aren't part of the API, you can still access
them as generic elements (at least in watir-webdriver):

  https://gist.github.com/1218879

Jari

-- 
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] Watir-Webdriver IE issue (UnexpectedJavascriptError: Unable to find element with xpath)

2011-09-12 Thread Jari Bakken
Do you have the latest version the selenium-webdriver and
watir-webdriver gems? Can you provide an HTML page where the lookup
fails?

Den 12. sep. 2011 kl. 21:16 skrev Mike michaelszor...@gmail.com:

 Hello,

 I've searched this issue over and over and can't seem to find any
 answers.
 I'm trying to use watir-webdriver for IE8 and cannot access/manipulate
 a number of page elements.. namely select lists.

 When triggering select on a list like so:

 d = b.select_list :name = 'state'
 d.select 'Ohio'

 I get the following error:

 Selenium::WebDriver::Error::UnexpectedJavascriptError: Unable to find
 element with xpath == .//select[@name='state']
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-
 webdriver-2.5.0/lib/selenium/webdriver/remote/response.rb:45:in
 `assert_ok'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-
 webdriver-2.5.0/lib/selenium/webdriver/remote/response.rb:15:in
 `initialize'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-
 webdriver-2.5.0/lib/selenium/webdriver/remote/http/common.rb:53:in
 `new'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-
 webdriver-2.5.0/lib/selenium/webdriver/remote/http/common.rb:53:in
 `create_response'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-
 webdriver-2.5.0/lib/selenium/webdriver/remote/http/default.rb:56:in
 `request'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-
 webdriver-2.5.0/lib/selenium/webdriver/remote/http/common.rb:34:in
 `call'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-
 webdriver-2.5.0/lib/selenium/webdriver/remote/bridge.rb:410:in
 `raw_execute'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-
 webdriver-2.5.0/lib/selenium/webdriver/remote/bridge.rb:388:in
 `execute'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-
 webdriver-2.5.0/lib/selenium/webdriver/remote/bridge.rb:356:in
 `find_element_by'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-
 webdriver-2.5.0/lib/selenium/webdriver/common/search_context.rb:41:in
 `find_element'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.3/
 lib/watir-webdriver/locators/element_locator.rb:86:in
 `find_first_by_multiple'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.3/
 lib/watir-webdriver/locators/element_locator.rb:33:in `locate'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.3/
 lib/watir-webdriver/elements/element.rb:263:in `locate'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.3/
 lib/watir-webdriver/elements/element.rb:245:in `assert_exists'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.3/
 lib/watir-webdriver/elements/select.rb:125:in `select_by'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.3/
 lib/watir-webdriver/elements/select.rb:64:in `select'

 This same syntax works beautifully in Firefox.
 Any suggestions?

 Thanks!
 -Mike

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

-- 
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: Object no longer attached to the DOM error on doing a exists call

2011-08-24 Thread Jari Bakken
Some people are reporting quite significant performance issues after this
change:

  https://github.com/jarib/watir-webdriver/issues/92

Jari

-- 
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] watir-webriver won't create a Watir::Browser for Firefox 6.0

2011-08-17 Thread Jari Bakken
On Wed, Aug 17, 2011 at 9:39 PM, Tony Zanella tony.zane...@gmail.comwrote:


 Any suggestions, short of downgrading Firefox?


Upgrade selenium-webdriver to 2.4.0.

-- 
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] [Watir-Webdriver] Carriage Returns

2011-08-16 Thread Jari Bakken
On Tue, Aug 16, 2011 at 2:11 AM, hillary weimar1...@gmail.com wrote:


 But when i tried this in web-driver it doesn't anymore. It enters text but
 the values are no longer separated by a carriage return.

 I've tried everything in this 
 posthttps://groups.google.com/d/topic/watir-general/SONhM3BnJD4/discussion.
 And I can't use send_keys because the text area doesn't allow the user to
 use up, down, or enter/return.



What sort of text area is this (since it prevents up/down/enter/return? E.g.
this works for me:

  https://gist.github.com/1148796

-- 
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] [Watir-Webdriver] Carriage Returns

2011-08-16 Thread Jari Bakken
On Tue, Aug 16, 2011 at 7:02 PM, hillary weimar1...@gmail.com wrote:

 I tried your solution and it didn't work.


Does this mean you ran the code from my link and it did not work?




 I'm not sure why it prevents up/down/return. It could be just an expanded
 text field, would that make a difference? Do you know why watir-webdriver
 would be different than watir? It seems like webdriver is ignoring the
 carriage returns in my set string but watir didn't.

 It's hard to guess about why you're seeing a problem. If you're able to
modify the code from my example to make it fail, or provide a public URL + a
script that reproduces the problem, it would make it easier to help you.

-- 
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: Object no longer attached to the DOM error on doing a exists call

2011-08-14 Thread Jari Bakken
It is enabled by default.

Den 14. aug. 2011 kl. 10:44 skrev Jarmo Pertman jarm...@gmail.com:i

 I'd even vote this to be enabled by default :)

 Jarmo

 On Aug 14, 7:45 am, Alister Scott alister.sc...@gmail.com wrote:
 This has been released. Thanks to Jari.
 See an article about how to use it 
 here:http://watirmelon.com/2011/08/14/telling-watir-webdriver-to-always-lo...

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

-- 
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] Finding Text on a Page, Using Regular Expressions

2011-08-13 Thread Jari Bakken
Den 13. aug. 2011 kl. 11:42 skrev Jeff Nyman jeffny...@gmail.com:

browser.text.should include(my text)


  browser.text.should match(/my text/)

or

  browser.text.should =~ /my text/

-- 
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] Is possible to instance a new firefox session with timeout to open the browser?

2011-08-11 Thread Jari Bakken
Usually this should time out in 60 seconds. Try running the script with
$DEBUG = true (or pass -d to ruby on the command line) and paste the full
output here.

2011/8/10 Fabrício Ferrari de Campos ffc.fabri...@gmail.com

 Hi,

 I'm using 'watir-webdriver' and sometimes when I open a new firefox
 session (Watir::Browser.new(:firefox, :profile = default)), the
 firefox is started, but remains with the blank page (http://cl.ly/
 3Z020Y143N1D1X221D00).

 And only when I kill the process or close the firefox manually, the
 unable to obtain stable firefox connection in 60 seconds
 (127.0.0.1:7055) exception occurs. Is there someway I can pass a
 timeout when I initialize de browser?

 Regards,

 Fabrício Ferrari de Campos

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


-- 
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] It is possible to have watir-webdriver and selenium-webdriver (ruby bindings) in the same script ?

2011-08-10 Thread Jari Bakken
Den 10. aug. 2011 kl. 08:36 skrev Dan Claudiu Pop danclaudiu...@gmail.com:

 Hey,

 It is possible to run watir-webdriver and selenium-webdriver (ruby
 bindings) in the same script ? I need to manipulate the cookies and
 watir-webdriver has only one method (clear_cookies which works great)
 where selenium has a bunch of them, which are very useful for me. If
 possible, i would like watir-webdriver to open my browser instance and
 use selenium just to gain access to those methods. An example would be
 great.

browser = Watir::Browser.new
browser.driver #= #Selenium::WebDriver::Driver

We're planning to expand the cookie API in watir-webdriver itself soon.



 Regards,
 Dan

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

-- 
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: Inconsistent Frame behavior

2011-08-08 Thread Jari Bakken
On Sat, Aug 6, 2011 at 12:11 AM, Stephen Lee stephen.ryan@gmail.com wrote:

 Env:
 Cuke 1.0.0
 Firewatir 1.8.0
 watir-webdriver 0.2.0
 Ruby 1.8.7
 Firefox 3.6.19
 JSSh 0.9


Are you using firewatir or watir-webdriver? If you're using
watir-webdriver, try updating to the latest version and report back
what you find.

-- 
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] watir-webdriver: Validating the Color of an element

2011-08-08 Thread Jari Bakken
WebDriver doesn't give direct access

Den 8. aug. 2011 kl. 20:34 skrev hillary weimar1...@gmail.com:

When there's an error, the application i'm testing changes the color of the
element, a text_field, changes to red. Currently I validate that the
text_field is red like this:
b.text_field(:id, text_field).document.currentstyle.color.should ==
'#444'

I also will did to validate the color of a div message that tells the user
that changes have been saved. i use the document.currentstyle.color for this
also.

Thanks.

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

-- 
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] watir-webdriver: Validating the Color of an element

2011-08-08 Thread Jari Bakken
WebDriver doesn't give direct access to the underlying DOM object like other
implementations. Instead you can use b.text_field(:id,
text_field).style(color).

Den 8. aug. 2011 kl. 20:34 skrev hillary weimar1...@gmail.com:

When there's an error, the application i'm testing changes the color of the
element, a text_field, changes to red. Currently I validate that the
text_field is red like this:
b.text_field(:id, text_field).document.currentstyle.color.should ==
'#444'

I also will did to validate the color of a div message that tells the user
that changes have been saved. i use the document.currentstyle.color for this
also.

Thanks.

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

-- 
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] Right click and element

2011-08-08 Thread Jari Bakken
Right clicking isn't yet well supported (though it does work somewhat in
Chrome), but it's being worked on. I suggest you find another way of
achieving what you want for the time being.

On Mon, Aug 8, 2011 at 9:09 PM, Litha K litha...@googlemail.com wrote:

 Hi all,

 I am using watir-webdriver with ruby 1.9.2 on mac OSX. In one of my
 test scenarios, I want to right click and element and select from the
 menu.

 Please could someone let me know how we do this- is there a way to
 send keys like shift+F10? or may be a better solution.

 Many thanks in advance.

 Regards,
 Kay

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


-- 
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] watir-webdriver: Validating the Color of an element

2011-08-08 Thread Jari Bakken
No, .style returns the value of the given CSS property. So
.style(color).should == #444.

Den 8. aug. 2011 kl. 21:38 skrev hillary weimar1...@gmail.com:

Thanks.

Just to confirm, the color would be it's html value (#444), so it'd be
.style(#444)?

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

-- 
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: Object no longer attached to the DOM error on doing a exists call

2011-08-03 Thread Jari Bakken
On Tue, Aug 2, 2011 at 9:44 PM, Jari Bakken jari.bak...@gmail.com wrote:


 But, I understand the performance hit. Are we talking much slower execution
 times?

I've changed the behaviour on the no-element-cache branch:

  https://github.com/jarib/watir-webdriver/tree/no-element-cache

Please try it out and let me know what you find. Taking into account
the comments about using watirspec as a benchmark in my last email,
the change appears to add about 10 seconds to the test run (from 145
seconds to 155 seconds) on my machine.

Jari

-- 
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] Chrome is getting closed even I do not use browser.close() method.

2011-08-02 Thread Jari Bakken
Den 2. aug. 2011 kl. 10:43 skrev Amit Bobade amit.sr...@gmail.com:

 Dear Željko,

 I am still facing this problem. Any updates?

You can follow this issue:

http://code.google.com/p/chromium/issues/detail?id=87676

-- 
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: Object no longer attached to the DOM error on doing a exists call

2011-08-02 Thread Jari Bakken
Den 2. aug. 2011 kl. 14:19 skrev Alister Scott alister.sc...@gmail.com:


But, I understand the performance hit. Are we talking much slower execution
times?


I don't think locating elements is the major bottleneck in browser tests in
general, but it certainly can be in some cases. This is especially true with
WebDriver, where every call to the API is also an RPC. We won't know until
we try, I guess - I can create a branch where we can experiment.

The problem is finding good benchmarks. The easiest choice would be to just
run watirspec, but it almost never re-uses Element objects, so the
performance hit will likely be lower than in a real world test suite. It's
also rare for the specs to do nested finds (e.g. browser.div.text_field),
which would also be affected negatively.

Jari

-- 
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] Object no longer attached to the DOM error on doing a exists call

2011-08-01 Thread Jari Bakken
This usually happens when the element has been removed from the DOM
after the element was located, and is usually an indication that
you're not waiting for the page to be in the expected state before
using the element. Relocating the element would also solve this
problem, e.g.:

https://gist.github.com/1118078

 On Sun, Jul 31, 2011 at 12:58 PM, Alister Scott
alister.sc...@gmail.com wrote:
 I'm getting the same error quite frequently when using watir-webdriver.
 It is happening near where I used execute_script to execute some javascript
 on a div, like onclick

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


-- 
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] watir-webdriver headless browser setup

2011-08-01 Thread Jari Bakken
On Mon, Aug 1, 2011 at 5:30 PM, Dan Claudiu Pop danclaudiu...@gmail.com wrote:

 ... when i run my tests with Headless profile i receive the following
 error:


The stack trace looks very much like a bug in HtmlUnit. Celerity's
version of HtmlUnit may be newer than WebDriver's. However, it would
be useful to see some code that will trigger this error in order to
help further.

Another option is sticking with a real browser and use a headless X
display like Xvfb (e.g. using https://rubygems.org/gems/headless).

Jari

-- 
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: Object no longer attached to the DOM error on doing a exists call

2011-08-01 Thread Jari Bakken
On Mon, Aug 1, 2011 at 5:41 PM, Jarmo Pertman jarm...@gmail.com wrote:
 In Watir the locating of the element will be done automatically - why
 not use the same approach in Watir-WebDriver? Is there any good reason
 to do that?

 It just sucks that i can't write code similar to this in watir-
 webdriver:
 container = browser.div
 # do something, which obsoletes the element, but makes it exist again
 container.do_something # this should work

 As i understand from your gist then #do_something won't work unless i
 specifically tell again that container = browser.div. Why?


That code will work just fine, since the div isn't located until you
use container. However, you'll need to re-locate if the element was
used once (and thus located and the reference saved), then removed
from the page and then used again, like in my example.

That behaviour is up for debate, but personally I've always considered
the current behaviour more helpful than not: it tells me very
specifically where my expectations are wrong and where there are
potential race conditions. Automatically re-locating gives me less
information about the interaction between the test and the app than
the ObsoleteElementErrors do, which helps me write more robust tests.
The application's behaviour isn't hidden from the test author, and
that's always a good thing IMO.

Another benefit is the overhead saved by not having to go through the
locate algorithm every time the element is used, which I believe is
what happens in Watir. If you're reusing Element instances heavily,
Watir-WebDriver benefits from caching the element reference.

That being said I do see that this is a break with Watir 1.X and
somewhat inconsistent with Watir's element objects, where you never
really know whether the element is live or not (by re-locating on
every use).  The current behaviour is sort of a compromise between
Watir's Element objects that just stores *how* to find the element,
and what you'll find in WebDriver, where every Element instance
*always* is a pointer to a DOM node.

Any other opinions on this?

-- 
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] Safari Watir / Webdriver - reasons for choosing watir or selenium...

2011-08-01 Thread Jari Bakken
WebDriver does not support Safari at the moment, but it does support
driving the browsers on iPhone and Android, either in the simulator or
on actual devices (though I haven't used either extensively, so not
sure how fast or full-featured they are).

WebDriver also has excellent support for Google Chrome, which like
Safari is based on the WebKit browser engine.

Den 2. aug. 2011 kl. 01:50 skrev qalady lau...@protopc.com:

 Hello Folks,

 I have been tasked to select our functional, web automation tool. I am
 of course biased towards Watir (in fact,  as a long time fan/promoter
 I've already been moving in this direction for a few days) but our
 current project is in Grails/Groovy and there is a Selenium plugin
 that already exists.

 The top browsers we would like to support are: IE, Firefox and Safari.
 There is a big push towards Safari as that is also the default browser
 for mobile applications for the iphone.

 My question is: How robust/functional is Safari Watir these days? Can
 I tell my team/superiors not to worry that our Watir scripts will
 work with Safari via SafariWatir? I'm nervous that this is not the
 case. I know I can probably get some basic scripts working...but where
 will it break down?

 Does Webdriver cover Safari? (Webdriver is new since I've been back to
 watir/ruby scripting).

 Not supporting the Safari browser well could break my ability to
 choose Watir. Please advise.

 Are there any other gotchas that anyone else can see base on my
 scenario?

 Thanks for your help,
 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

-- 
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] Watir webdriver connection timeout

2011-07-29 Thread Jari Bakken
See the section on Internal Timeouts here:

http://code.google.com/p/selenium/wiki/RubyBindings#Timeouts

Den 29. juli 2011 kl. 04:54 skrev Dan dfra...@gmail.com:

Is there a configuration for how long Watir-webdriver waits for a response?
 I'm trying to upload a rather large file and the response takes at least
over a minute and I keep getting a timeout error from watir.  Everything I
search for timeout wise is related to waiting for an element to appear, but
not how long the connection persists.

Thanks!
Dan

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

-- 
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] Watir 2.0.0.rc2 released

2011-07-25 Thread Jari Bakken
On Sun, Jul 24, 2011 at 11:53 PM, Jarmo jarm...@gmail.com wrote:
 Good news everyone!
 I've found some time to play with Watir and managed to release a new version
 - 2.0.0.rc2 (rc1 had buggy dependency, sorry)!
 There are some big changes including 0-based-indexing, which is enabled by
 default and not releasing new versions of FireWatir.
 Also, all collection factory methods accept now (multiple)
 specifiers/locators. A lot of these changes are compatible with
 Watir-WebDriver (see the list of incompatibilities compared with previous
 versions

Nice work!

 * renamed CheckBox class to Checkbox
 * renamed CheckBoxes class to Checkboxes

What's the rationale for this? This adds a new incompatibility with
watir-webdriver and breaks backwards compatibility for anyone relying
on the class name. The change seems rather arbitrary.

Jari

-- 
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: how to select a month/day into that calendar http://calendarview.org/

2011-07-19 Thread Jari Bakken
On Tue, Jul 19, 2011 at 8:28 PM, Cristina Dumitrescu
cristina.watir.toro...@gmail.com wrote:
 c:/ruby187/lib/ruby/gems/gems/1.8/gems/watir-webdriver-0.2.4/lib/watir-webdriver/elements/elements.rb
 292: in method_missing: undefined method 'cell' for #Watir::Div

  Do I have any library missing?


watir-webdriver has a slightly revised table API [1]. We only support
calling #cell on TableRows. If you want to locate table cells from
other elements, use the actual tag name, e.g.:

  $browser.div(:id, mac).div(:class, calendar popup).td(:text,Today).click



[1] https://gist.github.com/565553

-- 
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] OT: How do I determine Ruby/Watir version compatible with Windows Operating Systems

2011-07-14 Thread Jari Bakken
I can only speak for watir-webdriver, which should work well with any
of those OSes on either 1.8.7 or 1.9.2 from rubyinstaller.org.

Den 14. juli 2011 kl. 20:21 skrev Super Kevy kpe...@scholarshipamerica.org:

 Hey Gang,

 I'm having a tough time figuring out which what the windows operating
 systems requirements are valid for Ruby and Watir/Firewatir/Watir-
 Webdriver version

 I have W2K, WinXP, WinVista, Win7 O/Ses.  Is there any document or
 link that tells me what versions of RUBY and WATIR (Watir, FireWatir,
 Watir-Webdriver) are valid for the MS OSes.

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

-- 
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] Object no longer attached to the DOM error on doing a exists call

2011-07-05 Thread Jari Bakken
On Tue, Jul 5, 2011 at 1:21 PM, Alastair Montgomery doodl...@gmail.com wrote:
 Hi,

 I am experiencing an intermittent issue when doing the following call in
 watir-webdriver;
 browser.div(:class = blockUI).exists?
 Sometimes it throws this exception;
 Selenium::WebDriver::Error::ObsoleteElementError: Element is no longer
 attached to the DOM
 Surely instead of throwing this the call should be returning false?


Yes, it shouldn't be throwing. Looking into it.

-- 
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] Running Watir-webdriver script causes DEP shutdown.

2011-06-30 Thread Jari Bakken
On Thu, Jun 30, 2011 at 3:49 PM, Alastair Montgomery doodl...@gmail.com wrote:
 I've been trying to run Watir-webdriver with Firefox 5 on my XP machine, but
 every script I run cause Windows to shutdown Firefox due to Data Execution
 Prevention, even although I've set it not to apply to Firefox.
 Has anyone else seen this issue?
 Ruby version 1.8.7
 selenium-webdriver 0.2.2
 watir-webdriver 0.2.5


That's interesting. Does it work if you turn off native events?

  prof = Selenium::WebDriver::Firefox::Profile.new
  prof.native_events = false

  Watir::Browser.new :firefox, :profile = prof

-- 
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] Watir-Webdriver alters text containing tabs.

2011-06-27 Thread Jari Bakken
On Mon, Jun 27, 2011 at 10:13 PM, Abe Heward abe.hew...@gmail.com wrote:
 It's not an HTML page. It's a .log file, containing straight text, including
 the tabs.


What's the purpose of using Watir for this? Why not just read the file
from Ruby?

-- 
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] Watir-Webdriver alters text containing tabs.

2011-06-27 Thread Jari Bakken
On Mon, Jun 27, 2011 at 11:23 PM, Abe Heward abe.hew...@gmail.com wrote:
 Ah. Okay. Here's why I can't do that:

 Because the file is on a server whose drive is not mapped locally. So,
 File.open(http://69.71.52.209/tmp/fb-pixels.log;, r) results in a The
 system cannot find the file specified. error.


Try this:

  require 'open-uri'
  log = open(http://69.71.52.209/tmp/fb-pixels.log;).read

-- 
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: href in WebDriver no longer available?

2011-06-23 Thread Jari Bakken

 I'd suggest it might be a good idea to perhaps add a bit more
 descriptive text to that error  to make it a bit more friendly?

I'll pass this suggestion along to Jim who maintains the IE driver.

-- 
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] href in WebDriver no longer available?

2011-06-21 Thread Jari Bakken
On Mon, Jun 20, 2011 at 9:10 PM, BillyMobilly billymobi...@gmail.com wrote:
 In Watir I used .href in my scripts to navigate to pages.  When I run
 the same script with Watir WebDriver I get an error, seems to indicate
 that href has been depricated, is that true?


 Selenium::WebDriver::Error::ObsoleteElementError: Element is no longer
 valid

Nope, not related to href. This message means that the element is no
longer present in the DOM. This will happen if the page has been
refreshed or navigated away from, or if the element in question has
been removed by JavaScript.

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

2011-06-16 Thread Jari Bakken
On Thu, Jun 16, 2011 at 4:15 PM, joedio joe...@comcast.net wrote:
 Jari ,

 Does this mean that when using webdriver:

 1) If you start Firefox:
          browser = Watir::Browser.new
     that it runs with all addins disabled.

 2) If you start Firefox:
        browser = Watir::Browser.new(:firefox, :profile = default)
    it runs with your default addin settings

 3) If you start Firefox::
       myprofile = Selenium::WebDriver::Firefox::Profile.new
       myprofile.add_extension(/path/to/addin.xpi)
       browser = Watir::Browser.new(:firefox, :profile = myprofile)
    it runs with only the specified addin enabled

 If so that would be good info to note in the RDoc.


That's right. I'm don't really want to add it to the docs as it would
mean duplicating docs for selenium-webdriver (where this functionality
lives). The watir-webdriver FAQ [1] links to the Selenium wiki page
[2] that explains this (among other things).

[1] https://github.com/jarib/watir-webdriver/wiki/FAQ
[2] http://code.google.com/p/selenium/wiki/RubyBindings

-- 
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] watir-webdriver instead of firewatir- Showing error

2011-06-09 Thread Jari Bakken
It's a dependency issue between childprocess and selenium-webdriver. This
should solve it:

  gem update childprocess

Den 9. juni 2011 kl. 14:28 skrev Amit Bobade amit.sr...@gmail.com:

Dear Željko,

Thanks for your reply. I tried as you suggested but it didn't work for me. I
got following error for the same code.

ERROR:


E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:247:in `to_specs':
Could not find ffi (~ 0.6.3) amongst [abstract-1.0.0, actionmailer-3.0.7,
actionpack-3.0.7, activemodel-3.0.7, activerecord-3.0.7,
activeresource-3.0.7, activesupport-3.0.7, activesupport-2.3.9, arel-2.0.9,
builder-3.0.0, builder-2.1.2, bundler-1.0.13, calendar_date_select-1.16.2,
childprocess-0.1.7, commonwatir-1.9.0.rc4, commonwatir-1.8.1,
commonwatir-1.6.7, erubis-2.6.6, firewatir-1.9.0.rc4, firewatir-1.8.1,
firewatir-1.6.7, hoe-2.8.0, i18n-0.5.0, json_pure-1.5.1, mail-2.2.19,
mime-types-1.16, net-http-digest_auth-1.1.1, nokogiri-1.4.4.1-x86-mingw32,
polyglot-0.3.1, rack-1.2.2, rack-mount-0.6.14, rack-test-0.5.7, rails-3.0.7,
railties-3.0.7, rake-0.8.7, rautomation-0.5.1, rubygems-update-1.8.5,
rubygems-update-1.4.1, rubyzip-0.9.4, s4t-utils-1.0.4,
selenium-client-1.2.18, selenium-webdriver-0.2.1, selenium-webdriver-0.2.0,
selenium-webdriver-0.1.3, sqlite3-1.3.3-x86-mingw32, thor-0.14.6,
treetop-1.4.9, tzinfo-0.3.27, user-choices-1.1.6.1, watir-1.9.0.rc4,
watir-1.8.1, watir-1.6.7, watir-webdriver-0.2.4, watir-webdriver-0.2.3,
win32-api-1.4.7-x86-mingw32, win32-process-0.6.5, windows-api-0.4.0,
windows-pr-1.1.2, xml-simple-1.0.12] (Gem::LoadError)
 from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/specification.rb:759:in
`activate_dependencies'
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/specification.rb:756:in
`each'
 from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/specification.rb:756:in
`activate_dependencies'
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/specification.rb:741:in
`activate'
 from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/specification.rb:762:in
`activate_dependencies'
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/specification.rb:756:in
`each'
 from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/specification.rb:756:in
`activate_dependencies'
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/specification.rb:741:in
`activate'
 from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/specification.rb:762:in
`activate_dependencies'
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/specification.rb:756:in
`each'
 from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/specification.rb:756:in
`activate_dependencies'
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/specification.rb:741:in
`activate'
 from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:211:in `try_activate'
from E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:58:in
`require'
 from profile_album_pub.rb:2



On Thu, Jun 9, 2011 at 5:34 PM, Željko Filipin 
zeljko.fili...@wa-research.ch wrote:

 On Thu, Jun 9, 2011 at 12:04 PM, Amit Bobade amit.sr...@gmail.com wrote:
  E:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:242:in `activate': can't
 activate ffi (= 1.0.7, runtime) for [selenium-webdriver-0.2.1,
 watir-webdriver-0.2.4], already activated ffi-0.6.3-x86-mingw32 for

 This sounds like rubygems problem:


 http://www.google.com/search?q=%22can%27t+activate%22+%22already+activated%22

 Looks like you should uninstall old version of ffi, and maybe update
 rubygems.

 Ž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




-- 
Thanks and Regards,
Amit

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

-- 
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] watir-webdriver

2011-06-06 Thread Jari Bakken
On Mon, Jun 6, 2011 at 6:57 PM, a b cristina.watir.toro...@gmail.com wrote:

 For instance:
 That is a label :
 tdspan class=fontmd floatleft id=macbodypage
     span string=create_user
 class=macstringCreatenbsp;User/span/span/td


This isn't valid HTML, as the error message points out. Since the
parent span is unique, I would in this case start from that and locate
the first span inside it:

  browser.span(:id = macbodypage).span.text

Calling #span without arguments assumes you want the first one. If you
*really* need to locate elements using invalid attributes, you can
always use an XPath:

  browser.span(:xpath = //span[@class='macstring' and
@string='create_user']).text

or iterate through them in Ruby, using Watir::Element#attribute_value
to get to fetch the invalid attribute:

  span = browser.spans(:class = macstring).find { |e|
e.attribute_value(string) == create_user }
  span || raise(couldn't find span)

  span.text

The latest watir-webdriver docs can be found here:

  http://rubydoc.info/gems/watir-webdriver/0.2.4/frames

-- 
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] click on hidden buttons not working anymore on watir-webdriver

2011-06-04 Thread Jari Bakken
Den 3. juni 2011 kl. 21:02 skrev a b cristina.watir.toro...@gmail.com:


On Firefox I have to press Enter Key after I type in some text.

Do you have any example? I couldn't find any example on stackoverflow; watir
google etc.



element.send_keys :enter



Thanks a lot.
Cristina


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

-- 
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: type-ahead select lists

2011-05-26 Thread Jari Bakken
On Thu, May 26, 2011 at 7:10 PM, Željko Filipin
zeljko.fili...@wa-research.ch wrote:
 Watir can work with hidden fields:

 browser.hidden(how, what)

[...]

 (This will not work in watir-webdriver.)


Actually, that code will work, and you can also interact with it to
some degree (e.g. getting attributes). What WebDriver doesn't allow is
calling #set or #value= on fields that aren't visible to the user.

-- 
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] Interaction with Resend confirmation dialog box using Watir-Webdriver

2011-05-25 Thread Jari Bakken
On Wed, May 25, 2011 at 12:20 PM, the_zonker the.zonk...@gmail.com wrote:
 Hi guys,

 First of all my environment:
 watir-webdriver 0.2.3

 A Web application I testing has parameters which are sent to server
 during page load.
 It causes Retry confirmation dialog in IE and Resendin FF when I
 refresh any page of the application.

 Is there any way to handle this pop up which is stopping my scripts?

 I tried to send Enter key directly to Watir::Browser instance but it
 didn't help.
 All webdriver actions are stopped after appearing of them.

 It seems that this modal dialog is on the Browser's top level and
 Webdriver cannot handle it.
 But I hope that there is way to workaround it.

 Please, help.
 I appreciate any effort.

 Regards, Vadim


Are these JavaScript alerts (i.e. using the
window.{alert,confirm,prompt} functions)? If so you can work around it
by using the alerts extension:

  
https://github.com/jarib/watir-webdriver/blob/master/lib/watir-webdriver/extensions/alerts.rb

Jari

-- 
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] IE click button issue on watir-webdriver

2011-05-17 Thread Jari Bakken
On Tue, May 17, 2011 at 2:57 PM, the_zonker the.zonk...@gmail.com wrote:

 Working on automation of Web application I've faced with weird IE
 behavior - in one particular case IE doesn't click on button. Indeed I
 can see that browser moves focus on the button and press it but then
 nothing happens. I can't see that application in any way reacts on
 this pressing.


Have you made sure that Internet Options - Security has the same
Protected Mode setting (on or off, it doesn't matter as long as it is
the same value) for all zones? That's a requirement for the IE driver
functioning correctly.

-- 
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] Watir for Chrome(Shut down issue)

2011-05-17 Thread Jari Bakken
On Tue, May 17, 2011 at 6:00 PM, Ashok Tulachan tulachanas...@gmail.com wrote:
 The weird thing is that it shuts down even after completion while it stays
 in the same page for IE. However when i copy the same code and run in IRB,
 it doesn't shut down.

It's not weird at all, it's intentional behaviour on our side since we
can't currently shut down the server (the chromedriver.exe you
downloaded) without shutting down all Chrome instances.  The IE driver
doesn't have the same problem, as it's able to detach from the IE
process on shutdown.

Until we have fixed this, one option to work around this is by
managing the server process yourself, i.e. keep it running after your
Ruby processes die:

1. Launch chromedriver.exe manually
2. Run scripts using the remote driver:

  Watir::Browser.new(:remote, :url = http://localhost:9515;)

3. Shut down chromedriver.exe manually

I'm surprised if you're able to exit IRB and leave any Chrome
instances running. That sounds like IRB isn't doing proper cleanup
(i.e. not calling at_exit hooks).

-- 
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] watir-webdriver works with Firefox but not with Chrome :Failed to initialize session (Selenium::WebDriver::Error::WebDriverError)

2011-05-06 Thread Jari Bakken
As mentioned on the server download page, you need a newer version of
Chrome, minimum version 12.0.727.0.

Den 6. mai 2011 kl. 17:47 skrev emclaus ernie...@gmail.com:

 I'm trying to use Watir and Chrome (Chromium version 10.0.648.205 on
 Ubuntu) together.  I think I have watir-webdriver installed correctly
 because I can get a firefox window to open without any problems.
 Could it have something to do with using Chromium instead of Chrome?
 In the changes file in the selenium-webdriver folder it states Added
 'chromium' as a possible name for the Chrome binary (#769)

 I have Ruby 1.8.7 and my gem list is:

 builder-3.0.0
 childprocess-0.1.8
 commonwatir-1.8.1
 ffi-1.0.7
 firewatir-1.8.1
 hoe-2.9.4
 json_pure-1.5.1
 rake-0.8.7
 rubyzip-0.9.4
 s4t-utils-1.0.4
 selenium-webdriver-0.2.0
 user-choices-1.1.6.1
 watir-webdriver-0.2.3
 xml-simple-1.0.15

 My program is:
 require 'rubygems'
 require 'watir-webdriver'
 browser=Watir::Browser.new(:chrome)
 #browser=Watir::Browser.new(:firefox)# This works fine!

 My error output is:
 [remote server] (chrome/test/webdriver/commands/create_session.cc):
 36:in `unknown': Failed to initialize session
 (Selenium::WebDriver::Error::WebDriverError)
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.0/lib/
 selenium/webdriver/remote/response.rb:45:in `assert_ok'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.0/lib/
 selenium/webdriver/remote/response.rb:15:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.0/lib/
 selenium/webdriver/remote/http/common.rb:59:in `new'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.0/lib/
 selenium/webdriver/remote/http/common.rb:59:in `create_response'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.0/lib/
 selenium/webdriver/remote/http/default.rb:56:in `request'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.0/lib/
 selenium/webdriver/remote/http/common.rb:40:in `call'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.0/lib/
 selenium/webdriver/remote/bridge.rb:476:in `raw_execute'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.0/lib/
 selenium/webdriver/remote/bridge.rb:88:in `create_session'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.0/lib/
 selenium/webdriver/remote/bridge.rb:68:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.0/lib/
 selenium/webdriver/chrome/bridge.rb:26:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.0/lib/
 selenium/webdriver/common/driver.rb:33:in `new'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.0/lib/
 selenium/webdriver/common/driver.rb:33:in `for'
from /usr/lib/ruby/gems/1.8/gems/selenium-webdriver-0.2.0/lib/
 selenium/webdriver.rb:74:in `for'
from /usr/lib/ruby/gems/1.8/gems/watir-webdriver-0.2.3/lib/watir-
 webdriver/browser.rb:35:in `initialize'
from file.rb:4:in `new'
from file.rb:4

 e. claus

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

-- 
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] How to access cell or row index using watir-webdriver

2011-05-05 Thread Jari Bakken
On Thu, May 5, 2011 at 10:31 AM, Dan Claudiu Pop
danclaudiu...@gmail.com wrote:

 And also i tried with each_with_index but didn't get the expected
 output.


That should work.

-- 
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] Error opening new Firefox window with Watir-Webdriver

2011-04-26 Thread Jari Bakken
On Tue, Apr 26, 2011 at 11:03 AM, Željko Filipin
zeljko.fili...@wa-research.ch wrote:
 On Tue, Apr 26, 2011 at 1:07 AM, Jari Bakken jari.bak...@gmail.com wrote:
 I would recommend upgrading to Ruby 1.9.2.

 Watir-webdriver works on ruby 1.9.2?


Yes.

-- 
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] using drag_and_drop_on with watir-webdriver

2011-04-26 Thread Jari Bakken
Hi,

On Tue, Apr 26, 2011 at 2:42 PM, marc betts marcbe...@gmail.com wrote:

 browser.div(:id=some_div).element.drag_and_drop_on(browser.div(:id=some_other_div).element)


When you call Watir::Element#element to fetch the underlying
Selenium::WebDriver::Element instance, you're using a private API that
was changed in 0.2.1:

 
https://github.com/jarib/watir-webdriver/commit/7cee77a7b81d87df1392c43d402d262f5df9ecac

You can still do this by replacing the #element calls in your code
with #wd, but keep in mind that this API is not public (it's marked as
private in the documentation).

We should probably add Watir::Element#drag_and_drop_on directly - feel
free to file that to the tracker:

  https://github.com/jarib/watir-webdriver/issues

-- 
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] Error opening new Firefox window with Watir-Webdriver

2011-04-25 Thread Jari Bakken
On Tue, Apr 26, 2011 at 12:55 AM, Abe Heward abe.hew...@gmail.com wrote:
 The script fails when trying to open the browser, with this error message:

 C:/Ruby191/lib/ruby/gems/1.9.1/gems/childprocess-0.1.8/lib/childprocess.rb:91:in
 `close_on_exec=': close_on_exec=() function is unimplemented on this machine
 (NotImplementedError)
     from

I would recommend upgrading to Ruby 1.9.2. 1.9.1 has a bunch of known
problems, and is not supported by a lot of common gems (including
rails or selenium-webdriver).

If you're still seeing the problem after upgrading, please file an
issue against childprocess and I'll see what I can do:

  https://github.com/jarib/childprocess/issues

-- 
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: Sending single key presses to element.

2011-04-22 Thread Jari Bakken
On Thu, Apr 21, 2011 at 7:15 PM, orde ohil...@gmail.com wrote:
 You should able to accomplish it through either .fire_event
 or .send_keys methods.  Examples:

 fire_event: 
 http://rdoc.info/gems/watir/1.8.1/Watir/Element#fire_event-instance_method
 send_keys: 
 http://rdoc.info/gems/watir/1.8.1/Watir/IE#send_keys-instance_method

 But I think that send_keys only works with IE.  Hope it helps.


As a side note, WebDriver tries very hard to avoid the user having to
do things like fire_event() by instead doing the clicking and key
presses as native, OS-level events whenever possible. I've seen
existing Watir scripts that use fire_event heavily break when ported
because WebDriver actual does a proper click, and the fire_event calls
in the code makes the event fire twice.

-- 
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] Slow speed of filling of text area on watir-webdriver

2011-04-21 Thread Jari Bakken
On Thu, Apr 21, 2011 at 5:07 PM, the_zonker the.zonk...@gmail.com wrote:
 Environment:
 watir-webdriver 2.0.0
 Ruby 1.9.2
 Firefox 3.6, IE8


It's a good practice to always try the latest released version before
reporting issues. watir-webdriver is currently at 0.2.2.

 I faced with a problem - I need to put a content of XML file into text
 area.
 The content  is quite long and the process of filling is extremely
 slow.

 This slowness of filling causes a timeout error:

How long is the string? WebDriver simulates native key presses on some
platforms (like Windows), which may be slow.



 For putting value into text area I use:
  text_area.set(value)

 Are there any other ways to fill in text area more quick?
 I tried Javascript via execute_script method but JavaScript cannot
 handle XML content (probably because of quotes) as a valid element
 value.

Using execute_script should work. If you could provide an example
string where it doesn't work, I could probably help you out. Another
approach is to do what a user would do: paste in the XML from the
clipboard. If you have the XML content on the clipboard, you should be
able to do that by sending Control-V:

  text_area.send_keys [:control, 'v']

Jari

PS. The full list of keys you can send can be found here:
http://selenium.googlecode.com/svn/trunk/rb/lib/selenium/webdriver/common/keys.rb

-- 
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: Slow speed of filling of text area on watir-webdriver

2011-04-21 Thread Jari Bakken
On Thu, Apr 21, 2011 at 8:33 PM, Adam Reed reed.a...@gmail.com wrote:
 Using text_area.value = string rather than text_area.set string has
 saved a significant amount of time for my scripts in massive-data-
 entry scenarios.


Not so for watir-webdriver - they both use the same mechanism under
the hood (which in some cases means native key press events).

Jari

-- 
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] Problem about watir-webdriver

2011-04-19 Thread Jari Bakken
On Tue, Apr 19, 2011 at 10:28 AM, Ekin Han nbkhic...@gmail.com wrote:
 Hi all,

 I am using watir-webdriver now.

 Could anybody tell me where is the online doc of waitr webdriver?


API docs: http://rubydoc.info/github/jarib/watir-webdriver/master/frames
Wiki: https://github.com/jarib/watir-webdriver/wiki/_pages

 And is watir-webdriver stable enough for real world testing?


Yes. I know several big companies who use the underlying WebDriver
technology very successfully in production, and has been doing so for
years. However it depends on what browsers you need to test. I'm using
the Firefox driver for real world testing and it's *very* stable. The
Chrome driver which is in the current release is not great, but a
rewrite has just landed in Selenium trunk and by the next release of
selenium-webdriver (which watir-webdriver builds on top of) we will
have excellent Chrome support as well. The IE driver has traditionally
been the least stable driver, but it has seen huge improvements over
the past few months (thanks to fantastic work by Jim Evans) and its
pass rate on watirspec is now looking very good as well. I haven't
used it for any real world testing, so can't really speak to its
stability outside the specs.

Jari

-- 
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] checkbox set but returns false for set?

2011-04-11 Thread Jari Bakken
Hi,

I can't see anything obviously wrong in your code. You'll need to
provide a minimal test case including the HTML, Javascript and Ruby
code needed to reproduce the problem (for example, we can't guess what
the toggle_alt() function in your HTML example does - we'll need a
more complete example to debug this further). Since you've posted to
the webdriver list, I assume you're using watir-webdriver, but it
would be good to also know what browser and operating system you're
using.

Jari

On Mon, Apr 11, 2011 at 11:11 AM, bryan rasmussen.br...@gmail.com wrote:
 Hi,
 I asked this some days ago in a webdriver forum but haven't gotten any
 response.
 It's sort of a followup to my earlier question on how to set the value
 of an input element because I decided just to change the code to make
 it explicitly find the element as a checkbox.

 I have the following code:

 [...]

-- 
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] how to change value of Watir::Input?

2011-04-10 Thread Jari Bakken
On Fri, Apr 8, 2011 at 12:54 PM, bryan rasmussen.br...@gmail.com wrote:
 Hi,

 If I have an element of type Watir:Input how should I set the value -
 I would like to not use textfield (unless there is someway I can
 easily convert Watir:Input to a Watir:TextField and then do a set on
 it.

If this is in the context of watir-webdriver, you can do:

  browser.input(:name = foo).to_subtype.set(bar)


Tiffany: This is an addition in watir-webdriver, where you can use
browser.input in addition to the normal file_field, text_field etc.

-- 
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: checkbox question

2011-04-07 Thread Jari Bakken
On Thu, Apr 7, 2011 at 4:03 PM, Tiffany Fodor tcfo...@comcast.net wrote:

 Good luck with your Selenium project!  If you ever need Watir help,
 you know where to find us.  :)


I haven't created a watir-webdriver list, since I think it's fine to
discuss watir-webdriver issues here. I'd be happy to create one if you
guys think otherwise.

-- 
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] checkbox question

2011-04-07 Thread Jari Bakken
On Thu, Apr 7, 2011 at 1:25 AM, bryan rasmussen.br...@gmail.com wrote:

 When I look for the label Regnskab I find it, but when I run the
 label.checkbox(:index, 1) I get

  And I click Regnskab                                              #
 features/step_definitions/general_navigation.rb:61
      unable to locate element, using
 {:index=1, :tag_name=input, :type=checkbox}
 (Watir::Exception::UnknownObjectException)

 Any particular explanation on this?


I think this is because watir-webdriver is 0-indexed, not 1-indexed
like Watir. That's one of the major changes, you'll find a list of
more here:

  https://github.com/jarib/watir-webdriver/wiki/Comparison-with-Watir-1.X

Jari

-- 
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] Simulate keystroke with watir-webdriver

2011-04-04 Thread Jari Bakken
On Mon, Apr 4, 2011 at 11:46 AM, Dan Claudiu Pop
danclaudiu...@gmail.com wrote:
 Hello,

 Is there a way to simulate keystroke with watir-webdriver.
 I know that, recently Jarib pushed send_keys method.
 Does it simulate keystroke as well ?
 I've tried all kind of combinations, including ascii, but no success.
 browser.send_keys('{F11}')


The API is slightly different:

  browser.send_keys :f11

or e.g.

  browser.text_field.send_keys [:control, 'a'], :backspace

You can see the full list of available keys here: http://goo.gl/DTZ9g

Jari

-- 
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] Firefox 4 and Firewatir

2011-03-22 Thread Jari Bakken
Den 22. mars 2011 kl. 16:57 skrev Željko Filipin 
zeljko.fili...@wa-research.ch:

On Tue, Mar 22, 2011 at 4:53 PM, Alastair Montgomery doodl...@gmail.com
wrote:
 Has anyone tried running Firewatir with Firefox 4?

Firewatir will not work with Firefox 4 because we do not have jssh for it. I
think watir-webdriver works with FF 4.


Make sure to get the latest release (0.2.1) for full Firefox 4 support.

Željko
--
watir.com - community manager
watir.com/book - author
viaqa.mobi conference on software testing - organizer
watirpodcast.com - host
testingpodcast.com - audio podcasts on software testing. all of them


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

-- 
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] get .zip by url

2011-03-13 Thread Jari Bakken
On Sun, Mar 13, 2011 at 2:01 PM, maga chat...@gmail.com wrote:

 So, how can I specify a path to save the archive and how to manage
 saving flow(something like autoit for windows)?


First of all, if no JavaScript support is required, you should be able
to download the file with a HTTP library (like Net::HTTP in stdlib) -
you don't need watir-webdriver for this at all.

Otherwise, this isn't currently possible with the HtmlUnit driver +
the remote server. You can do it with a local Firefox like so:

  profile = Selenium::WebDriver::Firefox::Profile.new
  profile['browser.download.dir'] = /path/to/downloads
  profile['browser.download.folderList'] = 2
  profile['browser.helperApps.neverAsk.saveToDisk'] = application/zip

  browser = Watir::Browser.new(:firefox, :profile = profile)

or with a remote Firefox:

  profile = Selenium::WebDriver::Firefox::Profile.new
  profile['browser.download.dir'] = /path/to/downloads # refers to a
path on the machine where the selenium server is running
  profile['browser.download.folderList'] = 2
  profile['browser.helperApps.neverAsk.saveToDisk'] = application/zip

  capabilities =
Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile =
profile)
  browser = Watir::Browser.new(:remote, :desired_capabilities = capabilities)

That's your options at the moment.

-- 
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] double load of the same file

2011-03-11 Thread Jari Bakken
On Fri, Mar 11, 2011 at 3:59 PM, Usman Hussain usmanhhuss...@gmail.com wrote:
 Hi Guys,

 Im in a bit of a Pickle. Im using Watir-Webdriver with Cucumber but
 the language im coding in is RUBY.


This looks like a problem not really specific to Watir - you should
ask on the Cucumber mailing list. That being said, I don't think this
is currently possible with Cucumber and your needs correspond to this
feature request:

  
https://rspec.lighthouseapp.com/projects/16211/tickets/531-declarative-mechanism-for-expressing-dependencies-on-step-definitions

Jari

-- 
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: Interact with Javascript Pop Up

2011-03-07 Thread Jari Bakken
On Mon, Mar 7, 2011 at 12:04 PM, Mattias Karlsson
mattiaskar...@gmail.com wrote:

 1)
  returned = @browser.alert do
    @browser.goto('http://
 www.url.com/+void(document.cookie=authorization=true)+alert(document.cookie)+')
   end

   returned.should == ok
 # Doing positive test first

 but it doesn't find the alert box when it is displayed, and it is not
 working when I am setting the URL outside the block as well.


That's correct. If you look at the Browser#alert implementation, we
overwrite the window.alert function, and that will be gone when a new
page is loaded. This approach only works when the page doesn't change
inside the block.

 2)
 Option two, however, does work, but only for firefox, and I would want
 it to work for all browsers with watir-webdriver.


You'll have to stick to Firefox for this test until WebDriver
implements the API cross-browser - it's a work in progress. You can
watch the status of this issue to follow its progress:

  http://code.google.com/p/selenium/issues/detail?id=27

Jari

-- 
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] Interact with Javascript Pop Up

2011-03-03 Thread Jari Bakken
On Thu, Mar 3, 2011 at 2:12 PM, Usman Hussain usmanhhuss...@gmail.com wrote:
 Hi Guys,

 Im doing a test at the moment where when I enter in something into the
 url it brings up a Javascript pop up.
 Now  I do not want to turn the pop up function off by writing some
 Javascript and then using @b.execute_script etc...

 What I would LIKE to do is to somehow interact with the javascript pop
 up and click on the button to close it.
 Is there any way i can do it using the Watir or Webdriver Api or
 something?

 The pop up is an ALERT box.
 I am using a MAC
 I am using Watir-Webdriver with Cucumber
 Ruby v1.8.7

 any more info please shout.
 Any help would be awesome.


There are two ways to do this:

1. Use watir-webdriver's execute_script hacks:

  require 'watir-webdriver/extensions/alert'

  browser.alert do
# perform action that triggers alert
  end

See https://github.com/jarib/watir-webdriver/blob/master/spec/alert_spec.rb
for more examples.

2. Use WebDriver's alert handling API directly (currently Firefox-only
and considered experimental)

  # perform action that triggers alert
  browser.driver.switch_to.alert.accept

More examples of this here
http://code.google.com/p/selenium/source/browse/trunk/rb/spec/integration/selenium/webdriver/target_locator_spec.rb#97

Jari

-- 
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: Error on running script for first time

2011-02-24 Thread Jari Bakken
On Thu, Feb 24, 2011 at 9:47 AM, Ashu ashay.n...@gmail.com wrote:

Looks like it's trying to install ffi 1.0.6:


 Gem files will remain installed in C:/Ruby186/lib/ruby/gems/1.8/gems/
 ffi-1.0.6 f
 or inspection.
 Results logged to C:/Ruby186/lib/ruby/gems/1.8/gems/ffi-1.0.6/ext/
 ffi_c/gem_make

..but childprocess depends on 0.6.X:

 ffi ~ 0.6.3


I have no idea what would cause this. AFAIK none of our dependencies
have a loose dependency that would cause 1.0.6 to get installed.

What version of Rubygems do you have?

-- 
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: CookieManager/cookie api

2011-02-22 Thread Jari Bakken
On Tue, Feb 22, 2011 at 11:40 AM, Usman Hussain usmanhhuss...@gmail.com wrote:
 ahhh sorry ignore my last post
 the following works:
 @browser.driver.manage.delete_all_cookies


Right. Note that WebDriver has a limitation in that it only will let
you manipulate cookies for the current domain.

-- 
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: CookieManager/cookie api

2011-02-21 Thread Jari Bakken
WebDriver has the capability but it's not (yet) exposed on the Watir side.

You can access WebDriver's Options interface [1] through

  browser.driver.manage #= #Selenium::WebDriver::Options

Jari

[1] http://rubydoc.info/gems/selenium-webdriver/0.1.3/Selenium/WebDriver/Options

On Mon, Feb 21, 2011 at 4:41 PM, Usman Hussain usmanhhuss...@gmail.com wrote:
 Hi Guys,

 Did this get implemented for Watir-Webdriver? If so what is the method
 to delete all cookies or a specific cookie?
 Im using a MAC, and having been searching the net for this. Has this
 already been completed? Where can i get it from?

 Kind regards,
 Usman Hussain

 On Jan 20, 11:00 pm, Charley Baker charley.ba...@gmail.com wrote:
 Cool, I guess you're looking at setting up a Jira ticket? Please add
 one for this.

 Cheers,

 Charley Baker
 Lead Developer, Watir,http://watir.com







 On Thu, Jan 20, 2011 at 11:45 AM, Chad Larkin chadjlar...@gmail.com wrote:
  I just started to look into cookie management for testing some form
  pages that leave a cookie.  To test the form from various referrers
  the cookie must be deleted so the form is not pre-populated on
  revisit.  This would be the removal of a specific cookie not all
  cookies.

  --
  Before posting, please readhttp://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

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


-- 
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: Accessing file_field under div style

2011-02-13 Thread Jari Bakken
On Mon, Feb 14, 2011 at 12:00 AM, Dave McNulla mcnu...@gmail.com wrote:
 I had to set up watir-webdriver to test this out. Seems that it doesn't work
 on IE for me at all (doesn't run), but who's got time to debug that. On
 Chrome, the field is never found. It works with Watir (I only tried with
 IE). I'd heard that watir-webdriver didn't support popups (required for
 setting a file_field), but never investigated that.

Dave: watir-webdriver is passing the file fields specs on both Firefox
and IE. If you can't make it work, please file bugs. For Chrome, it's
a known limitation - file fields are not supported by the current
Chrome driver.

Dan: How are the elements styled? You should only see that exception
if the element isn't visible to the user, in which case you would have
a hard time testing it manually as well. As a worst case solution, you
can modify the style using Browser#execute_script to make it
accessible.

-- 
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: Problems with driving IE via watir-webdriver

2011-02-02 Thread Jari Bakken

 Interesting. I turned off Protected Mode, and made all zones Medium. That
 actually fixed the problem in the test under VM.
 It would have been no biggie to turn Protected Mode off (I don't use IE
 much), but my Hudson server is running
 using non-admin account on a PC, and I can't do it there.

As far as I know, all zones just need to be the same level - shouldn't
matter what level that is.


 You can also try building the gem from trunk (go //rb:gem:build) and
 see if that helps. Several IE bug fixes since last release.

 I need some help here. What go?
 I've downloaded watir-webdriver sources and tried both  gem build
 watir-webdriver.gemspec and rake build, but they produce:


Ah, sorry for not being more clear. I meant in the selenium repo, to
build a new version of the selenium-webdriver gem:

http://code.google.com/p/selenium/source/checkout

You'll just need to run `go //rb:gem:build` in the checkout to build
the gem (should appear in the build/ directory).


 Fair enough. Do you want me to isolate problems to selenium-webdriver? They
 all seem
 to occur there.


If you can reproduce with selenium-webdriver after trying the gem from
trunk (at least the hard crash should be fixed by now), then yes,
please file the bugs in the Selenium tracker.

-- 
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] testing a page that goes through multiple redirects.

2011-01-20 Thread Jari Bakken
On Thu, Jan 20, 2011 at 12:06 PM, vishnu path...@gmail.com wrote:
 Ideally in the case of these redirects, I'd like to be able to check
 if watir believes the page is loaded AND if no javascript is currently
 executing, because I know that in this specific case, on none of my
 pages do I have to worry about javascript running on a setTimeout.
 Done is well defined in my case. Is it possible for me to check that
 my definition of done is true?

JavaScript is always currently executing - i.e. the event loop is
always running. At no point will the browser throw up its hands and
say all done! - the closest you'll get is polling the document's
readyState property

  browser.execute_script(return document.readyState) == complete

but in my experience, relying on this sort of stuff as a generic
mechanism leads to race conditions and a lot of flaky tests. My
advice: poll for the elements you want to interact with to be there.

-- 
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] testing a page that goes through multiple redirects.

2011-01-20 Thread Jari Bakken
On Thu, Jan 20, 2011 at 1:01 PM, vishnu path...@gmail.com wrote:

 Another idea I had was to in a wait block
 attachEventListener to document load a function of the form
 setTimeout(0, function(){}) and my attached function would set some
 element on the page and use watir to check for this element. This way
 the element I attach will eventually exist on the correct page or on
 any of various error pages.
 What do you think of this approach? Are there some pitfalls I'm
 missing? If it seems that this too is likely to fail, then I'll just
 poll for the elements I expect on the success page as you suggest.


Absolutely - if you're able to change the application under test to
provide hooks for the test code to let it know when it's finished,
that's a good solution. From the Ruby side you're still polling the
state of the DOM, but you have more control.

-- 
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] testing a page that goes through multiple redirects.

2011-01-19 Thread Jari Bakken
On Wed, Jan 19, 2011 at 8:31 PM, vishnu path...@gmail.com wrote:

 I posted an issue on github and jarib suggested I use something like
 wait_until_present to make sure I'm on the page I expect to be. But I
 have 2 concerns.
 firstly, even with wait_until_present is there a likelyhood I get a
 stale reference error?

This error only occurs if you're trying to interact with an element
that is no longer on the page, e.g.

  button = browser.button
  # page refreshes, or the button is removed
  button.click

I think seeing this error from calling wait_until_present is very
unlikely. If you do, please create a test case I can look at.

 secondly, sometimes one of these redirects on the way might actually
 fail and throw me onto an error page. In which case I'll have to
 wait_until_present with a timeout.

As mentioned in the issue, check out the docs for these methods.
#wait_until_present and friends include a built-in timeout. You can
pass the number of seconds to wait as the first argument.

 I'd prefer a more deterministic
 approach. Is there a way for me to get watir to check if the current
 page has completely loaded AND all onload scripts have run before
 giving me control? Something I can run in a loop so that the script
 continues only when all redirects are done


No. Since browsers are inherently asynchronous, there's no way for the
tool to know what you consider finished. We try to wait for the most
obvious things, but at some point we have to give control back to the
user. Consider e.g.

  body onload=setTimeout(someFunction, 1000)

someFunction could call out to code that does more setTimeout (or
other async calls) and eventually end up changing elements or
redirecting to some other page. The most deterministic solution you'll
get is polling the DOM for the state you want it to be in before
proceeding, which is what wait.rb in watir-webdriver was designed to
let you do easily.

-- 
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] Timeout when setting a text_field

2011-01-04 Thread Jari Bakken
This is documented on the WebDriver wiki:

http://code.google.com/p/selenium/wiki/RubyBindings

Basically, you want to do something like this:

  client = Selenium::WebDriver::Remote::Http::Default.new
  client.timeout = 120 # seconds - default is 60
  driver = Selenium::WebDriver.for(:firefox, :http_client = client)

  browser = Watir::Browser.new(driver)

On Tue, Jan 4, 2011 at 11:59 PM, Emmanuel Cecchet cecc...@gmail.com wrote:
 Hi all,

 I was finally able to catch the stack trace of the timeout (see below). Even
 when the error occurs, the operation continues and the keystrokes are still
 sent to the browser.
 I am not sure how to override the read timeout in protocol.rb, any
 suggestion?

 Timeout::Error: execution expired
        from C:/Ruby187/lib/ruby/1.8/timeout.rb:64:in `rbuf_fill'
        from C:/Ruby187/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
        from C:/Ruby187/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
        from C:/Ruby187/lib/ruby/1.8/net/protocol.rb:126:in `readline'
        from C:/Ruby187/lib/ruby/1.8/net/http.rb:2028:in `read_status_line'
        from C:/Ruby187/lib/ruby/1.8/net/http.rb:2017:in `read_new'
        from C:/Ruby187/lib/ruby/1.8/net/http.rb:1051:in `request'
        from C:/Ruby187/lib/ruby/1.8/net/http.rb:1037:in `request'
        from C:/Ruby187/lib/ruby/1.8/net/http.rb:543:in `start'
        from C:/Ruby187/lib/ruby/1.8/net/http.rb:1035:in `request'
        from
 C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/remote/http/default.rb:36:in
 `request'
        from
 C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/remote/http/common.rb:36:in
 `call'
        from
 C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/remote/bridge.rb:429:in
 `raw_execute'
        from
 C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/remote/bridge.rb:407:in
 `execute'
        from
 C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/remote/bridge.rb:324:in
 `sendKeysToElement'
        from
 C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/common/element.rb:123:in
 `send_keys'
        from
 C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/common/element.rb:114:in
 `each'
        from
 C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-0.1.2/lib/selenium/webdriver/common/element.rb:114:in
 `send_keys'
        from
 C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.1.8/lib/watir-webdriver/elements/text_field.rb:17:in
 `set'
        from (irb):17

 Thanks
 manu

 On 1/4/2011 3:45 PM, manu wrote:

 Hi all,

 I am writing a pretty big chunk of text in a form and want to keep the
 default typing speed in the form to emulate a real user.
 So when I call:
 browser.text_field(:name, 'field').set('some very long text here')

 The operation stops before completion with a timeout.
 Is there a way I can override the timeout in the set operation so that
 it can complete?
 Any other workaround you can suggest?

 Thanks
 manu


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


-- 
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] An intro to Watir-WebDriver

2010-12-14 Thread Jari Bakken
On Tue, Dec 14, 2010 at 1:45 PM, Alister Scott alister.sc...@gmail.com wrote:
 Hi,

 I've written a new blog post about how to use Watir-WebDriver for those who
 are curious:
 http://watirmelon.com/2010/12/14/watir-webdriver-a-detailed-introduction/


Thanks a lot for this Alister!

Just a nitpick - it's probably more correct to call watir-webdriver a
Watir implementation *on* WebDriver rather than a Watir
implementation *of* WebDriver .

Another thing you might include is that the server jar can be
controlled programatically through the Selenium::Server class:

require 'selenium/server'
server = Selenium::Server.new(/path/to/jar, :background = true)
server.start
# run your tests
server.stop

-- 
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] Watir/Cucumber with Lua

2010-12-03 Thread Jari Bakken
On Fri, Dec 3, 2010 at 3:46 PM, Usman Hussain usmanhhuss...@gmail.com wrote:
 Ive had a look at Rufus/Lua (on GITHub) but cannot seem to get this
 working.
 I keep getting this error when i have require 'rufus/lua' along with
 requiring 'rubygems' 'rspec' and 'watir-webdriver'

You'll probably get better results asking the rufus-lua developers
about this problem.

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


  1   2   >