Attach to changing URL

7 views
Skip to first unread message

bobwas...@hotmail.com

unread,
Mar 27, 2009, 9:32:10 PM3/27/09
to Watir General
I'm still some what of a n00b with regards to Watir. I have a web app
that displays "new" browser windows. I know that I can use
Watir::IE.attach(url:, 'enter url') to attach to a window. However
the snippet of the url below keeps changing. Also hwnd keeps
changing. Is this because the site is https?

TOKEN=5937dfd955519a57-4AA53C6C-1143-EBE5-767BAE115006BD65

Leigh

unread,
Mar 28, 2009, 8:05:29 AM3/28/09
to watir-...@googlegroups.com
Anyway you can use the title to attach vs. the url?
Watir::IE.attach(title:, 'title of browser window')

Bobby Washington

unread,
Mar 29, 2009, 8:05:57 AM3/29/09
to watir-...@googlegroups.com
I thought about that, however the title is the same.  Sorry for not mentioning this before.

Thanks,

Bobby Washington




Date: Sat, 28 Mar 2009 08:05:29 -0400
Subject: [wtr-general] Re: Attach to changing URL
From: leighi...@gmail.com
To: watir-...@googlegroups.com


Hotmail® is up to 70% faster. Now good news travels really fast. Find out more.

Wesley Chen

unread,
Mar 29, 2009, 8:10:45 AM3/29/09
to watir-...@googlegroups.com
Are the URL the same?
You may try: Watir::IE.find(:url, //)

Thanks.
Wesley Chen.

Bobby Washington

unread,
Mar 29, 2009, 8:15:34 AM3/29/09
to watir-...@googlegroups.com
The url is similar, but only up to a point.  The last part 'TOKEN=5937dfd955519a57-4AA53C6C-1143-EBE5-767BAE115006BD65'  keeps changing.  I will see if Watir can use only a portion of the URL with Watir::IE.find(:url, //)

Thanks to everyone that has commented thus far.

Thanks,

Bobby Washington




Date: Sun, 29 Mar 2009 20:10:45 +0800

Subject: [wtr-general] Re: Attach to changing URL

Bret Pettichord

unread,
Mar 30, 2009, 10:17:58 AM3/30/09
to watir-...@googlegroups.com
Have you considered saving your reference to the browser in a variable
and using it?

Bret

Bobby Washington wrote:
> The url is similar, but only up to a point. The last part
> 'TOKEN=5937dfd955519a57-4AA53C6C-1143-EBE5-767BAE115006BD65' keeps
> changing. I will see if Watir can use only a portion of the URL
> with Watir::IE.find(:url, //)
>
> Thanks to everyone that has commented thus far.
>
> Thanks,
>
> Bobby Washington
>
>
>
> Date: Sun, 29 Mar 2009 20:10:45 +0800
> Subject: [wtr-general] Re: Attach to changing URL
> From: cjq...@gmail.com
> To: watir-...@googlegroups.com
>
> Are the URL the same?
> You may try: Watir::IE.find(:url, //)
>
> Thanks.
> Wesley Chen.
>
>
> On Sun, Mar 29, 2009 at 8:05 PM, Bobby Washington
> <bobwas...@hotmail.com <mailto:bobwas...@hotmail.com>> wrote:
>
> I thought about that, however the title is the same. Sorry for
> not mentioning this before.
>
> Thanks,
>
> Bobby Washington
>
>
>
> Date: Sat, 28 Mar 2009 08:05:29 -0400
> Subject: [wtr-general] Re: Attach to changing URL
> From: leighi...@gmail.com <mailto:leighi...@gmail.com>
> To: watir-...@googlegroups.com
> <mailto:watir-...@googlegroups.com>
>
>
> Anyway you can use the title to attach vs. the url?
> Watir::IE.attach(title:, 'title of browser window')
>
> On Fri, Mar 27, 2009 at 9:32 PM, <bobwas...@hotmail.com
> <mailto:bobwas...@hotmail.com>> wrote:
>
>
> I'm still some what of a n00b with regards to Watir. I have a
> web app
> that displays "new" browser windows. I know that I can use
> Watir::IE.attach(url:, 'enter url') to attach to a window.
> However
> the snippet of the url below keeps changing. Also hwnd keeps
> changing. Is this because the site is https?
>
> TOKEN=5937dfd955519a57-4AA53C6C-1143-EBE5-767BAE115006BD65
>
>
>
>
>
> Hotmail® is up to 70% faster. Now good news travels really fast.
> Find out more.
> <http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_032009>
>
>
>
>
>
>
> Hotmail® is up to 70% faster. Now good news travels really fast. Find
> out more.
> <http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_032009>
> >


--
Bret Pettichord
CTO, WatirCraft LLC, www.watircraft.com
Lead Developer, Watir, www.watir.com
Blog, www.io.com/~wazmo/blog
Twitter, www.twitter.com/bpettichord

Watir Training: Portland/Beaverton April 16-17
www.watircraft.com/training

Željko Filipin

unread,
Mar 30, 2009, 10:23:02 AM3/30/09
to watir-...@googlegroups.com
On Sun, Mar 29, 2009 at 14:15, Bobby Washington <bobwas...@hotmail.com> wrote:
> The url is similar, but only up to a point.

Try:

browser = Watir::IE.find(:url, /the_similar_part/)

or

browser = Watir::IE.attach(:url, /the_similar_part/)

Željko

bobwas...@hotmail.com

unread,
Apr 24, 2009, 1:27:46 PM4/24/09
to Watir General
I thought about this some a little more and I think I get what you are
saying. However I need a way to get at the browser window before I
can capture the url. Is there a way for Watir to give me a list of
all browser sessions current open. Then couldn't I do something like
browser.url to get the url from the browser window of interest?

Thanks,
Bobby

On Mar 30, 10:17 am, Bret Pettichord <b...@pettichord.com> wrote:
> Have you considered saving your reference to the browser in a variable
> and using it?
>
> Bret
>
>
>
>
>
> Bobby Washington wrote:
> > Theurlis similar, but only up to a point.  The last part
> > 'TOKEN=5937dfd955519a57-4AA53C6C-1143-EBE5-767BAE115006BD65'  keeps
> >changing.  I will see if Watir can use only a portion of theURL
> > with Watir::IE.find(:url, //)
>
> > Thanks to everyone that has commented thus far.
>
> > Thanks,
>
> > Bobby Washington
>
> > Date: Sun, 29 Mar 2009 20:10:45 +0800
> > Subject: [wtr-general] Re: Attach tochangingURL
> > From: cjq....@gmail.com
> > To: watir-...@googlegroups.com
>
> > Are theURLthe same?
> > You may try: Watir::IE.find(:url, //)
>
> > Thanks.
> > Wesley Chen.
>
> > On Sun, Mar 29, 2009 at 8:05 PM, Bobby Washington
> > <bobwashing...@hotmail.com <mailto:bobwashing...@hotmail.com>> wrote:
>
> >     I thought about that, however the title is the same.  Sorry for
> >     not mentioning this before.
>
> >     Thanks,
>
> >     Bobby Washington
>
> >     Date: Sat, 28 Mar 2009 08:05:29 -0400
> >     Subject: [wtr-general] Re: Attach tochangingURL
> >     From: leighisle...@gmail.com <mailto:leighisle...@gmail.com>
> >     To: watir-...@googlegroups.com
> >     <mailto:watir-...@googlegroups.com>
>
> >     Anyway you can use the title to attach vs. theurl?
> >     Watir::IE.attach(title:, 'title of browser window')
>
> >     On Fri, Mar 27, 2009 at 9:32 PM, <bobwashing...@hotmail.com
> >     <mailto:bobwashing...@hotmail.com>> wrote:
>
> >         I'm still some what of a n00b with regards to Watir.  I have a
> >         web app
> >         that displays "new" browser windows.  I know that I can use
> >         Watir::IE.attach(url:, 'enterurl') to attach to a window.
> >          However
> >         the snippet of theurlbelow keepschanging.  Also hwnd keeps
> >        changing.  Is this because the site is https?
>
> >         TOKEN=5937dfd955519a57-4AA53C6C-1143-EBE5-767BAE115006BD65
>
> >     Hotmail® is up to 70% faster. Now good news travels really fast.
> >     Find out more.
> >     <http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_0...>
>
> > Hotmail® is up to 70% faster. Now good news travels really fast. Find
> > out more.
> > <http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_0...>
>
> --
> Bret Pettichord
> CTO, WatirCraft LLC,www.watircraft.com
> Lead Developer, Watir,www.watir.com
> Blog,www.io.com/~wazmo/blog
> Twitter,www.twitter.com/bpettichord
>
> Watir Training: Portland/Beaverton April 16-17www.watircraft.com/training- Hide quoted text -
>
> - Show quoted text -

Bret Pettichord

unread,
Apr 24, 2009, 2:56:28 PM4/24/09
to watir-...@googlegroups.com
bobwas...@hotmail.com wrote:
> I thought about this some a little more and I think I get what you are
> saying. However I need a way to get at the browser window before I
> can capture the url. Is there a way for Watir to give me a list of
> all browser sessions current open. Then couldn't I do something like
> browser.url to get the url from the browser window of interest?
>
Watir::IE.each will iterate through the existing browser windows.

Bret

--
Bret Pettichord


CTO, WatirCraft LLC, www.watircraft.com
Lead Developer, Watir, www.watir.com
Blog, www.io.com/~wazmo/blog
Twitter, www.twitter.com/bpettichord

Ask me about Watir training
www.watircraft.com/training

bobwas...@hotmail.com

unread,
Apr 28, 2009, 7:54:42 AM4/28/09
to Watir General
After reading more docs online I was able to learn about regular
expressions in Watir. I'm happily attaching to my browser even though
the a portion of the URL is constantly changing. Thanks to all for
you help!

Thanks,
Bobby

On Apr 24, 2:56 pm, Bret Pettichord <b...@pettichord.com> wrote:
> bobwashing...@hotmail.com wrote:
> > I thought about this some a little more and I think I get what you are
> > saying.  However I need a way to get at the browser window before I
> > can capture theurl.  Is there a way for Watir to give me a list of
> > all browser sessions current open.  Then couldn't I do something like
> > browser.urlto get theurlfrom the browser window of interest?
>
> Watir::IE.each will iterate through the existing browser windows.
>
> Bret
>
> --
> Bret Pettichord
> CTO, WatirCraft LLC,www.watircraft.com
> Lead Developer, Watir,www.watir.com
> Blog,www.io.com/~wazmo/blog
> Twitter,www.twitter.com/bpettichord
>
> Ask me about Watir trainingwww.watircraft.com/training
Reply all
Reply to author
Forward
0 new messages