Hi Jarmo,

Thanks for the great news and hard work on this!

We have faced an issue with SelectList Option #text() method, it returns an
empty string for all options which are not currently selected, because they
are... not visible. I am not sure whether it is per design because we are
unable to find an option by text and just asses the content of options in a
dropdown. It returns correct text value in watir-webdriver, where there is
no check for visibility. More details follow below.


Option class is located in input_elements.rb and its text is defined like
this:

*class Option < Element*

*…*

*    attr_ole :label*

*…*

* **    def text*

*      l = label*

*      l.empty? ? super : l rescue ''*

*    end*

*…*

*end*

Here - since label parameter is not used usually – the super method will be
called, which works like this:

*# Return the innerText of the object or an empty string if the object is*

*# not visible*

*# Raise an ObjectNotFound exception if the object cannot be found*

*def text*

*  assert_exists*

*  visible? ? ole_object.innerText.strip : ""*

*end*

 If Options are not visible => an empty string will be returned in this
case.

We are thinking about a monkey-patch for Option#text like this in the
meantime:

*def text*

*  l = label*

*  l.empty? ? ole_object.innerText : l rescue ''*

*end*

Thank you,
Aliaksandr Ikhelis


On Thu, Sep 20, 2012 at 11:33 AM, Željko Filipin <zel...@filipin.eu> wrote:

> On Wed, Sep 19, 2012 at 10:32 PM, Jarmo <jarm...@gmail.com> wrote:
> > I'm happy to announce that Watir-Classic 3.2.0 has been released!
>
> Thanks Jarmo!
>
> Everybody, feel free to share the news:
>
> http://watir.com/2012/09/20/watir-classic-3-2-0-released/
> https://twitter.com/watir/status/248730057814708224
> https://www.facebook.com/watirproject/posts/496151940395969
> https://plus.google.com/u/0/100602917593825281282/posts/dGuj49tqMfk
> http://www.linkedin.com/groups/I-m-happy-announce-that-88535.S.166152155
>
> Željko
> --
> filipin.eu
>
> _______________________________________________
> Wtr-development mailing list
> Wtr-development@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-development
>
_______________________________________________
Wtr-development mailing list
Wtr-development@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to