That's what was my question - is it expected behaviour that text_field
should not be accessed this way.

If you look here 
http://wiki.openqa.org/display/WTR/Ways+Available+To+Identify+HTML+Element
then there is an example of using :after? (although not :before?,
though this is also available), but if you look here
http://pettichord.com/watirtutorial/docs/watir_cheat_sheet/WTR/Methods%20supported%20by%20Element.html
then there isn't anything related with :after? or :before?. So i don't
know :-) Maybe these pages are out of date, but nevertheless :after?
and :before? are there in Watir::Element and they work with span, for
example. You can easily try this simple html:
<html>
<body>
<form action="">
<input type="text" id="text1"/>
<span id="span1">
span1
</span>
<input type="text" id="text2"/>
</form>
</body>
</html>

And then this Ruby code:
require 'watir'

b = Watir::IE.attach(:url, /blah/)
puts b.span(:after? => b.text_field(:id => 'text1')).html
puts b.span(:after?, b.text_field(:id, 'text1')).html

# expecting to find text_field#text2
puts b.text_field(:after? => b.text_field(:id => 'text1')).html

And the output for this code is this:
<SPAN id=span1>span1 </SPAN>
<SPAN id=span1>span1 </SPAN>
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/locator.rb:127:in
`after?': wrong number of arguments (0 for 1) (Argumen
tError)
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
locator.rb:127:in `send'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
locator.rb:127:in `match?'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
locator.rb:112:in `locate'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
locator.rb:110:in `each'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
locator.rb:110:in `locate'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
locator.rb:108:in `catch'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
locator.rb:108:in `locate'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
locator.rb:105:in `each'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
locator.rb:105:in `locate'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
container.rb:742:in `locate_input_element'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
input_elements.rb:5:in `locate'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
element.rb:49:in `assert_exists'
        from (eval):2:in `html'
        from C:/projects/aplikatsioonid/ui-tests/blahhh.rb:9

In other words - it works okay with span, but not with input field. Is
there anywhere most up to date documentation so everyone would know if
it's supported or not? If there is some outdated documentation, can it
be deleted from the web?

Anyway, it would be great if it worked with every element.

Jarmo


On Jan 20, 10:48 pm, marekj <marekj....@gmail.com> wrote:
> I've never needed to do this type of access for text_field
>   container.text_field(:after? => (element))
> is Watir supposed to conform to this syntax?
> have you tried a comma instead of hash?
> container.text_field(:after?, (element))
>
> yeah, looking at the code it appers: in span we use TaggedElementLocator
> while the text_field uses InputElementLocator
> and they both use diff def match? implementations.
>
> Can you provide the html you test against? (well, a relevant snippet)
> and if indeed this syntax should be the way to access textfield then
> please open an issue
>
> marekj
>
> Watirloo: Semantic Page Objects in UseCaseshttp://github.com/marekj/watirloo/
> Support Watir Projecthttp://pledgie.com/campaigns/2982
-- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general

Reply via email to