Thanks Željko,

This syntax did run fine, I did however notice a strange result.

The image collection returned contains a nil entry per image on screen
where the alt tag did not match the regular expression.

This adds overhead to my iteration over the collection - by needing to
check if the current image is nil.

Do you know how to keep these nil entries out of the image collection?


On Dec 4, 8:52 pm, Željko Filipin <[email protected]>
wrote:
> On Fri, Dec 4, 2009 at 6:56 AM, bender25 <[email protected]> wrote:
> > Ideally I need to get from my page all images that have their "alt"
> > feild starting with text "expand"
>
> Not tested, but something like this could work:
>
> expand_images = browser.images.collect do |image|
>   image if image.alt =~ /^expand/
> end
>
> Let me know if you want to know how it works.
>
> Ž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 [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general

Reply via email to