Hello everyone!
I’m happy to announce that Watir 3 has been finally released!
Its biggest goal is to conform even better with WatirSpec making it more
compliant with Watir-WebDriver.
Changelog is quite long, but reading it makes your life easier:
* Browser#status returns an empty string if status bar is disabled in IE9
* Browser#style fixed for IE9
* #execute_script evaluates JavaScript code inside of an anonymous function
- use “return” statement if value is needed by Ruby
* #execute_script returns nil instead of ‘undefined’
* drag and drop fixed for IE9
* Window#current? and Window#== are more robust
* all html elements are now supported (even html5 ones)
* CookieManager removed
* cookies API support added (
https://github.com/watir/watirspec/blob/master/cookies_spec.rb)
* drag and drop API support added (
https://github.com/watir/watirspec/blob/master/drag_and_drop_spec.rb)
* Element#(before|after)? removed
* Element#(before|after)_text removed
* Browser#cell(s) and Browser#row(s) removed
* Browser#Element camelCase methods removed, use under_score methods instead
* Browser#element(s) supports only general attributes like :id, :title,
:class_name, :text, :html and such
* Browser#modal_dialog improved
* Browser#send_keys and Element#send_keys have now same syntax as specified
in WatirSpec
* Element#style returns internal styles only for IE9, inline style will be
returned for IE8
* Table#each removed – use Table#(trs|rows).each instead
* Table#row(s) and Table#cell(s) added which ignore inner tables – use
#td/#tr for all.
* raise an Exception if more locators are specified with :xpath/:css
* searching by :xpath and :css code rewritten
* Browser#textarea(s) method for searching elements
* Element#focus works with IE9
* Element#focused? returns the state of focus on that element
* Element#to_subtype returns Element if non-supported tag found instead of
crashing
* searching by :class will match now partially like other tools behave
(e.g. jQuery)
* Button#text returns value if exists instead of text
* Browser#goto prepends url automatically with http:// if scheme is missing
* Browser#element(s)_by_(xpath/css) are now private methods – use
#element(:css => …) and #element(:xpath => …) instead
* Browser#label supports searching by :for attribute
* Browser#options method for searching elements
* Browser#body, #thead, #tfoot, #tbody, #frameset and #fieldset added
* Browser#window and Browser#windows added implementing window switching
API (https://github.com/jarib/watirspec/blob/master/window_switching_spec.rb
)
* Element#present? returns false if exception is thrown by #exists? or
#visible?
* Element#style returns CSS text instead of OLE object
* Element#text returns an empty string for non-visible elements
* Element#parent returns correct instance of Element class (e.g. Div
instead of Element)
* Element#focus focuses document before focusing on the element
* Element#right_click and Element#double_click added
* Element#to_subtype added which returns specific instance of
Watir::Element subclass
* Element#send_keys added
* Element#eql? as an alias for Element#== added
* Element#tag_name added
* ElementCollection#[] method supports negative indexes like regular Arrays
* ElementCollection#[] returns always an object, even if the index is out
of bounds
* FileField#set and Image#save uses correct Windows file path (e.g. convert
“\”-es into “/”-es)
* FileField#set raises Errno::ENOENT instead of WatirException if file
doesn’t exist
* FileField#value= as an alias for FileField#set added
* Font#color, #face and #size added
* Form#submit triggers onSubmit event and doesn’t submit the form if
event’s callback returns false
* Frame#execute_script added
* Image#file_size, #height and #width return integer instead of a string
* Image#save blocking fixed
* Meta#content and #http_equiv added
* Option code rewritten, causing changes in its API
* SelectList code rewritten, causing changes in its API
* SelectList#(selected_)options returns now Options collection instead of
an array of strings
* Table and its subelements code rewritten, causing changes in its API
* Table#strings and #hashes added
* TextField#label added
* searching elements will find only correct types – e.g. using Browser#div
returns only DIV element even if all other provided selectors match
* all selectors and tag of the element needs to match even if searching by
:id
* supporting html5 data-* attributes by using :data_* for locating and
#data_* for retrieving attribute values
* many other internal changes
Please try it out by executing:
gem install watir
I would love to use it but I can’t resolve this ffi needs devkit problem.
What’s the exact problem? Are you using Devkit? What version of Ruby are you using?
ruby 192 (my komodo ide does not support debgging in 193)
i have been through the dev kit instructions and it seems to work (adds itself to path …) but when the watir install gets to fii it fails. I can send you the errors it gives. I have googled extensively on this and not found an adequate fix.
C:\Users\michael.kernaghan.NORTH_AMERICA>gem install watir
Temporarily enhancing PATH to include DevKit…
Building native extensions. This could take a while…
ERROR: Error installing watir:
ERROR: Failed to build gem native extension.
C:/Ruby192/bin/ruby.exe extconf.rb
checking for ffi.h… *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=C:/Ruby192/bin/ruby
–with-ffi_c-dir
–without-ffi_c-dir
–with-ffi_c-include
–without-ffi_c-include=${ffi_c-dir}/include
–with-ffi_c-lib
–without-ffi_c-lib=${ffi_c-dir}/lib
–with-libffi-config
–without-libffi-config
–with-pkg-config
–without-pkg-config
C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in `try_do’: The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in `postpone’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:833:in `have_header’
from extconf.rb:9:in `’
Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-1.0.11 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-1.0.11/ext/ffi_c/gem_make.out
Try to install older version of ffi before installing Watir:
gem install ffi -v 1.0.9
Any luck with that approach?
rubygems.org/gems/ffi-1.0.9 actively refuses the connection
What do you mean by that? It is installing fine for me.
ok thanks. i fixed my firewall bypassing and got it and yes that fixes the watir install .
Thanks very much!!!
Very exciting! Since the spec is closer in line to watir-webriver, will this help speed along the 4.0 release?
what am I to use instead of ie2.cell(:text => ‘some name’).click
Thanks
Tom
You have to use td or tr methods when trying to locate from some other container than table. When you locate table first then cell and row methods still work.
Something like this:
ie2.td(:text => 'some name').click
ie2.table(:id => 'myTable').cell(:text => 'some name').click
Thanks for your help. I am still having problems w/ watir 3.0
I have tried both and some other methods but can’t locate the element or click it.
ie2.td(:text => ‘some name’).click
ie2.table(:id => ‘myTable’).cell(:text => ‘some name’).click
When I used – ie2.cell(:text => ‘some name’).click
it worked fine.
Thanks
Tom
code is
+
–
–
–
And what is the error you’re getting? Can you show us the html and ruby code your writing?
Jarmo – I had thought the code was in the last correspondence. I will try to send it this weekend. The code is copied to an image file and I was having difficulty pasting it into this text box. I’ll get the code to you though.
Thanks
Tom
Just create a gist at http://gist.github.com
Jarmo,
Thank You for looking at this for me. I have created a gist at github at the following location
https://gist.github.com/3621713
If you can access the location above, then I can send othere examples as well.
I have created a few ruby test scripts but this one has stumped me.
Tom
I’ve left a comment on your gist.
thanks I left another comment at the same location
Jamo – added a code snippet for the span tag
Jarmo – I left some more comments regarding the script I have been working on at the following https://gist.github.com/3621713
If you could review it, id appreciate it.
comment from tom at
https://gist.github.com/3621713