[wtr-general] Re: :after? and :before? methods not supported for all elements?

2010-01-22 Thread Jarmo Pertman
I just had a case where I wanted to check needed fields, for example
there's a form something like this:

  
  
  


now if i press submit, then the form will have an error message
something like "all necessary fields need to be filled", and the form
will be something like this:

  
  *
  
  *
  


So i wanted to make some helper method in my test to check if those *
marks are there and saw that there is a method called :before?
and :after? and thought that i could use them:
def field_needed?(el1, el2)
  span(:after? => el1, :before? => el2).exists?
end

That actually seemed to work, but i wanted to make it even better and
implement :between? to Watir::Element, when I noticed that it doesn't
seem to work with at least text_fields (didn't try anything else, but
i'm also suspecting that the problem seem to exist with
Watir::InputElement).

On Jan 21, 10:56 pm, Charley Baker  wrote:
> I've never actually used :after? or :before? either. We are still reporting
> issues in Jira, which does need some maintenance soon.
>
> Charley Baker

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


[wtr-general] Re: :after? and :before? methods not supported for all elements?

2010-01-22 Thread Jarmo Pertman
On Jan 21, 2:38 pm, Željko Filipin 
wrote:
> On Thu, Jan 21, 2010 at 9:48 AM, Jarmo Pertman  wrote:
> > then there is an example of using :after? (although not :before?,
> > though this is also available)
>
> I think :before? is deprecated because it did not work.
:before? seems to work for me with the span for example, so why are
you saying it doesn't work? I think that i've seen that beforeText and
afterText are the methods, which doesn't seem to work correctly, maybe
youre confusing with these?
Also, no comments or any other indications that :before? or :after? is
broken in current Watir source code either:
http://github.com/bret/watir/blob/master/watir/lib/watir/element.rb


>
> > 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?
>
> Wiki should be up to date. If something is wrong, please fix it. If you need
> any help with the wiki, just let me know.
That's the case - i don't know if it is supposed to work like that or
not :-) It seems to me like a bug due to no other indications.


>
> These are the pages that mention :after?
>
> http://wiki.openqa.org/display/WTR/Watir+Methods+Supported+by+HTML+El...http://wiki.openqa.org/display/WTR/How+and+Whathttp://wiki.openqa.org/display/WTR/Ways+Available+To+Identify+HTML+El...
>
> Athttp://wiki.openqa.org/display/WTR/Watir+Methods+Supported+by+HTML+El...
> can mark elements that work with :after?. For now, only link is marked
> as supported.
>
> Željko
> --
> watir.com - community manager
> watirpodcast.com - host

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


Re: [wtr-general] Re: :after? and :before? methods not supported for all elements?

2010-01-21 Thread Charley Baker
I've never actually used :after? or :before? either. We are still reporting
issues in Jira, which does need some maintenance soon.


Charley Baker
blog: http://blog.charleybaker.org/
Lead Developer, Watir, http://watir.com
QA Architect, Gap Inc Direct


On Thu, Jan 21, 2010 at 1:02 PM, marekj  wrote:

> Then this :after? usage looks like a bug.
> Zeljko, do we still use jira for that?
> Where should we log and track this issue? jira? lighthouse? github?
> thoughts please?
>
> marekj
>
> Watirloo: Semantic Page Objects in UseCases
> http://github.com/marekj/watirloo/
> Support Watir Project http://pledgie.com/campaigns/2982
>
>
>
> On Thu, Jan 21, 2010 at 6:38 AM, Željko Filipin
>  wrote:
> > On Thu, Jan 21, 2010 at 9:48 AM, Jarmo Pertman 
> wrote:
> >> then there is an example of using :after? (although not :before?,
> >> though this is also available)
> >
> > I think :before? is deprecated because it did not work.
> >
> >> 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?
> >
> > Wiki should be up to date. If something is wrong, please fix it. If you
> need
> > any help with the wiki, just let me know.
> >
> > These are the pages that mention :after?
> >
> >
> http://wiki.openqa.org/display/WTR/Watir+Methods+Supported+by+HTML+Element
> > http://wiki.openqa.org/display/WTR/How+and+What
> >
> http://wiki.openqa.org/display/WTR/Ways+Available+To+Identify+HTML+Element
> >
> > At
> >
> http://wiki.openqa.org/display/WTR/Watir+Methods+Supported+by+HTML+Element
> > you can mark elements that work with :after?. For now, only link is
> marked
> > as supported.
> >
> > Željko
> > --
> > watir.com - community manager
> > watirpodcast.com - host
> >
> >
> >
> >
> > --
> > 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
> >
>
> --
> 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
>
-- 
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

Re: [wtr-general] Re: :after? and :before? methods not supported for all elements?

2010-01-21 Thread marekj
Then this :after? usage looks like a bug.
Zeljko, do we still use jira for that?
Where should we log and track this issue? jira? lighthouse? github?
thoughts please?

marekj

Watirloo: Semantic Page Objects in UseCases
http://github.com/marekj/watirloo/
Support Watir Project http://pledgie.com/campaigns/2982



On Thu, Jan 21, 2010 at 6:38 AM, Željko Filipin
 wrote:
> On Thu, Jan 21, 2010 at 9:48 AM, Jarmo Pertman  wrote:
>> then there is an example of using :after? (although not :before?,
>> though this is also available)
>
> I think :before? is deprecated because it did not work.
>
>> 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?
>
> Wiki should be up to date. If something is wrong, please fix it. If you need
> any help with the wiki, just let me know.
>
> These are the pages that mention :after?
>
> http://wiki.openqa.org/display/WTR/Watir+Methods+Supported+by+HTML+Element
> http://wiki.openqa.org/display/WTR/How+and+What
> http://wiki.openqa.org/display/WTR/Ways+Available+To+Identify+HTML+Element
>
> At
> http://wiki.openqa.org/display/WTR/Watir+Methods+Supported+by+HTML+Element
> you can mark elements that work with :after?. For now, only link is marked
> as supported.
>
> Željko
> --
> watir.com - community manager
> watirpodcast.com - host
>
>
>
>
> --
> 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
>
-- 
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

Re: [wtr-general] Re: :after? and :before? methods not supported for all elements?

2010-01-21 Thread Željko Filipin
On Thu, Jan 21, 2010 at 9:48 AM, Jarmo Pertman  wrote:
> then there is an example of using :after? (although not :before?,
> though this is also available)

I think :before? is deprecated because it did not work.

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

Wiki should be up to date. If something is wrong, please fix it. If you need
any help with the wiki, just let me know.

These are the pages that mention :after?

http://wiki.openqa.org/display/WTR/Watir+Methods+Supported+by+HTML+Element
http://wiki.openqa.org/display/WTR/How+and+What
http://wiki.openqa.org/display/WTR/Ways+Available+To+Identify+HTML+Element

At
http://wiki.openqa.org/display/WTR/Watir+Methods+Supported+by+HTML+Elementyou
can mark elements that work with :after?. For now, only link is marked
as supported.

Željko
--
watir.com - community manager
watirpodcast.com - host
-- 
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

[wtr-general] Re: :after? and :before? methods not supported for all elements?

2010-01-21 Thread Jarmo Pertman
Forgot to mention that it doesn't matter if you use comma or a hash in
this case - result is the same.

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

[wtr-general] Re: :after? and :before? methods not supported for all elements?

2010-01-21 Thread Jarmo Pertman
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:





span1






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

Re: [wtr-general] Re: :after? and :before? methods not supported for all elements?

2010-01-20 Thread marekj
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 UseCases
http://github.com/marekj/watirloo/
Support Watir Project http://pledgie.com/campaigns/2982



On Wed, Jan 20, 2010 at 8:53 AM, Jarmo Pertman  wrote:
> Sorry, stacktrace got truncated. Here is full one:
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/locator.rb:127:in
> `before?': wrong number of arguments (0
>  for 1) (ArgumentError)
>        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 S:/ui-tests/blahhh.rb:16
>
> --
> 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
>
-- 
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

[wtr-general] Re: :after? and :before? methods not supported for all elements?

2010-01-20 Thread Jarmo Pertman
Sorry, stacktrace got truncated. Here is full one:
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/locator.rb:127:in
`before?': wrong number of arguments (0
 for 1) (ArgumentError)
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 S:/ui-tests/blahhh.rb:16
-- 
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