# Controlling non-IE based application

**URL:** <https://rubytalk.org/t/controlling-non-ie-based-application/45725>\
**Category:** ruby-talk\
**Created:** [7 April 2008 20:10 UTC](https://rubytalk.org/t/controlling-non-ie-based-application/45725 "2008-04-07T20:10:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_Nakasone](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@Sean\_Nakasone](https://rubytalk.org/u/Sean_Nakasone)\
**Post date:** [7 April 2008 20:10 UTC](https://rubytalk.org/t/controlling-non-ie-based-application/45725/1 "2008-04-07T20:10:04Z")

</div>

Hello, I've been previously been using waitr to control a web based application. The application has been rewritten so that it doesn't use IE anymore so my watir scripts don't work anymore. I know the application is still sort of web-based because it still uses \*.aspx files. Is there a way to continue using watir, win32ole or interop? How do I attach to the window of the application if it runs in vendor supplied exe.

---

<div class="post-metadata">

**Author:** ![Kyle\_Schmitt](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@Kyle\_Schmitt](https://rubytalk.org/u/Kyle_Schmitt)\
**Post date:** [7 April 2008 20:51 UTC](https://rubytalk.org/t/controlling-non-ie-based-application/45725/2 "2008-04-07T20:51:12Z")

</div>

I've been in that situation before: web app is converted to psudo  
desktop app by means of embedding an IE element on a local only  
asp/asp.net server. I believe it's commonly done through something  
called Microsoft cassini.

If it's that, and I'm gonna guess it is, you've got a chore infront of you.  
Cassini only allows local connections to the web app, so you'll need  
to port scan locally, find the port, and see if you can use ie to  
browse to the app. If you can, you're in luck, and a simple mod to  
your watir scripts will work. If not, you need to bug your developers  
to help you.

I've never seen, or heard of, a successful attempt to automate an  
embedded ie object with watir.

Good luck.  
--Kyle

> **···**
>
> On Mon, Apr 7, 2008 at 3:10 PM, Sean Nakasone \<seannakasone@yahoo.com\> wrote:
> 
> > Hello, I've been previously been using waitr to control a web based  
> > application. The application has been rewritten so that it doesn't use IE  
> > anymore so my watir scripts don't work anymore. I know the application is  
> > still sort of web-based because it still uses \*.aspx files. Is there a way  
> > to continue using watir, win32ole or interop? How do I attach to the window  
> > of the application if it runs in vendor supplied exe.

---

<div class="post-metadata">

**Author:** ![Sean\_Nakasone](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@Sean\_Nakasone](https://rubytalk.org/u/Sean_Nakasone)\
**Post date:** [9 April 2008 00:55 UTC](https://rubytalk.org/t/controlling-non-ie-based-application/45725/3 "2008-04-09T00:55:11Z")

</div>

Yes, you are correct, the vendor said they are using Microsoft Cassini to create their exe. Knowing this is already a huge help--thankyou. Using your advice I successfully used netstat -an to see which local port is being used. But with a known port, how do I use watir to connect? How do I use IE to browse from here?

---

<div class="post-metadata">

**Author:** ![Phil](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@Phil](https://rubytalk.org/u/Phil)\
**Post date:** [9 April 2008 01:01 UTC](https://rubytalk.org/t/controlling-non-ie-based-application/45725/4 "2008-04-09T01:01:25Z")

</div>

Sean Nakasone wrote:

> Yes, you are correct, the vendor said they are using Microsoft Cassini  
> to create their exe. Knowing this is already a huge help--thankyou.  
> Using your advice I successfully used netstat -an to see which local  
> port is being used. But with a known port, how do I use watir to  
> connect? How do I use IE to browse from here?

If the application listens on the port (like a webserver),  
localhost:port could work.

NB: I never used Cassini, nor watir, nor do I play a user of those on TV.

- --  
Phillip Gawlowski  
Twitter: twitter.com/cynicalryan

Let your compiler do the simple optimisations.  
Don't strain to re-use code; reorganise instead.  
~ - The Elements of Programming Style (Kernighan & Plaugher)

---

<div class="post-metadata">

**Author:** ![Kyle\_Schmitt](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@Kyle\_Schmitt](https://rubytalk.org/u/Kyle_Schmitt)\
**Post date:** [9 April 2008 13:53 UTC](https://rubytalk.org/t/controlling-non-ie-based-application/45725/5 "2008-04-09T13:53:57Z")

</div>

Sean,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Phillip is right. Use IE to browse to  
[http://localhost](http://localhost):whateverportitchose. You should be able to browse it  
from there, and knowing that you can write your scripts.

I don't remember if Cassini always uses the same port, or if it  
randomly chooses an unused one, so you may want to look at how to port  
scan from ruby.

I'm thinking something ugly like, get an array of open ports when the  
app isn't running, use ruby to launch the app you're working on, get  
an array of ports now, and blindly assume that the new port is the one  
cassini is using... Not pretty but definitely better than manually  
finding the port each time (if it changes that is).

--Kyle

> **···**
>
> On Tue, Apr 8, 2008 at 8:01 PM, Phillip Gawlowski \<cmdjackryan@googlemail.com\> wrote:
> 
> > -----BEGIN PGP SIGNED MESSAGE-----  
> > Hash: SHA1
> > 
> > Sean Nakasone wrote:  
> > \>  
> > \>  
> > \> Yes, you are correct, the vendor said they are using Microsoft Cassini  
> > \> to create their exe. Knowing this is already a huge help--thankyou.  
> > \> Using your advice I successfully used netstat -an to see which local  
> > \> port is being used. But with a known port, how do I use watir to  
> > \> connect? How do I use IE to browse from here?  
> > \>  
> > \>  
> > If the application listens on the port (like a webserver),  
> > localhost:port could work.
> > 
> > NB: I never used Cassini, nor watir, nor do I play a user of those on TV.
> > 
> > - --  
> > Phillip Gawlowski  
> > Twitter: twitter.com/cynicalryan
> > 
> > Let your compiler do the simple optimisations.  
> > Don't strain to re-use code; reorganise instead.  
> > ~ - The Elements of Programming Style (Kernighan & Plaugher)  
> > -----BEGIN PGP SIGNATURE-----  
> > Version: GnuPG v1.4.8 (MingW32)  
> > Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)
> > 
> > iEYEARECAAYFAkf8FWoACgkQbtAgaoJTgL9mPACggx00wGt824etWXyGsFEUJaox  
> > lSAAoJj+XlJe9lvpex25GkzZSNCtwFrZ  
> > =Scqt  
> > -----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![Sean\_Nakasone](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@Sean\_Nakasone](https://rubytalk.org/u/Sean_Nakasone)\
**Post date:** [10 April 2008 16:10 UTC](https://rubytalk.org/t/controlling-non-ie-based-application/45725/6 "2008-04-10T16:10:11Z")

</div>

Folks, I tried to use an IE to browse to [http://localhost](http://localhost):port , port  
being substituted by the port number i got from using the "netstat -  
an" command. IE gave an error saying something to the effect that it  
could not display or open that address. Let me give more background  
on the application. It's an website, internal to our company. The  
website is run on a remote server using IIS as the web server. The  
client used to be IE, but now it's a vendor supplied exe that opens  
it's own window independent of IE. I want to control the non-IE  
window programatically. I'm hoping to use watir, but correct me if  
i'm wrong, but it seems watir only controls IE, correct?

---

<div class="post-metadata">

**Author:** ![Kyle\_Schmitt](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@Kyle\_Schmitt](https://rubytalk.org/u/Kyle_Schmitt)\
**Post date:** [10 April 2008 16:46 UTC](https://rubytalk.org/t/controlling-non-ie-based-application/45725/7 "2008-04-10T16:46:35Z")

</div>

Watir currently only controls IE, but development for watir  
controlling other browser is in development. No news as to when it  
will happen.

If Cassini is being used, it would be running an instance of  
[IIS+ASP.NET](http://IIS+ASP.NET) on the client machine. It's still possible it's calling  
out to an external server for some things, but it doesn't have to at  
all.

What your saying sounds like they are doing some sort of weird hybrid.  
Still, it should be independent of the browser: an http server is an  
http server for all intensive purposes here. The question becomes  
then, how do you get at that.

I'd try all the open ports (tcp -ln) that you can find & can't ID as  
standard. Either use the browser to check for an http server, or  
telnet to them, and type in "get" then hit enter. IIRC that should  
return the index.html from the root directory of the http server.

--Kyle

---

<div class="post-metadata">

**Author:** ![W\_James](https://avatars.discourse-cdn.com/v4/letter/w/e274bd/32.png) [@W\_James](https://rubytalk.org/u/W_James)\
**Post date:** [10 April 2008 21:15 UTC](https://rubytalk.org/t/controlling-non-ie-based-application/45725/8 "2008-04-10T21:15:13Z")

</div>

intents and purposes

> **···**
>
> On Apr 10, 11:46 am, Kyle Schmitt \<kyleaschm...@gmail.com\> wrote:
> 
> > http server for all intensive purposes

---

<div class="post-metadata">

**Author:** ![Bret\_Pettichord](https://avatars.discourse-cdn.com/v4/letter/b/9fc348/32.png) [@Bret\_Pettichord](https://rubytalk.org/u/Bret_Pettichord)\
**Post date:** [11 April 2008 02:30 UTC](https://rubytalk.org/t/controlling-non-ie-based-application/45725/9 "2008-04-11T02:30:05Z")

</div>

Actually Watir wraps the IE automation object. If you can find an  
alternate way of getting a handle on the object that is embedded in  
your application, you could inject it directly into a Watir::IE object  
and it would work.

Bret

> **···**
>
> On Apr 10, 11:46 am, Kyle Schmitt \<kyleaschm...@gmail.com\> wrote:
> 
> > Watircurrently only controls IE, but development forwatir  
> > controlling other browser is in development. No news as to when it  
> > will happen.

---

<div class="post-metadata">

**Author:** ![Sean\_Nakasone](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@Sean\_Nakasone](https://rubytalk.org/u/Sean_Nakasone)\
**Post date:** [12 April 2008 12:20 UTC](https://rubytalk.org/t/controlling-non-ie-based-application/45725/10 "2008-04-12T12:20:03Z")

</div>

Assuming I can get the handle to an IE automation object. How do I  
inject it directly into a Watir::IE object? The closest thing that I  
know of is using the ie attribute of the Watir::IE object, but the ie  
attribute can only get the raw ie object, i don't think it's meant to  
set it.

> **···**
>
> On Apr 10, 4:27 pm, Bret Pettichord \<bpettich...@gmail.com\> wrote:
> 
> > Actually Watir wraps the IE automation object. If you can find an  
> > alternate way of getting a handle on the object that is embedded in  
> > your application, you could inject it directly into a Watir::IE object  
> > and it would work.
> > 
> > Bret
