views:

447

answers:

3

I am using HTTPWatch automation API to launch a new Firefox instance like that:

HttpWatch.Controller ct = new HttpWatch.Controller();
HttpWatch.Plugin plugin = ct.FireFox.New("");
plugin.GotoURL("http://www.google.com");

These codes could start a Firefox browser successfully. Then I want to control the browser in WatiN 2.0:

FireFox ff = Browser.AttachTo<FireFox>(Find.ByTitle("Google"));

WatiN could not find Firefox window (JSSH plugin has been added in Firefox). But the same test on IE 7 is ok.

I even tried to open a Firefox window manually and visit google.com page. WaitN in IE7 could attach to the browser, but Firefox failed.

Is there anything wrong with my codes? Or any other advice? Thanks in advance!

Here is the config for my environment:

  • OS: Windows XP Pro SP2
  • WatiN: 2.0 RC1
  • Browser: IE 7, Firefox 3.0/3.5/3.6 with JSSH plugin
+1  A: 

Two things to check:

First the call Browser.AttachTo seem to be broken in 2.0 RC1 as far as I know. It can be replace with something like:

FireFox ff = (FireFox)Browser.AttachTo(typeof(FireFox),Find.ByTitle("Google"));

Also you may need to update your JSSH plugin if you use Firefox 3.6, the one included with the WatiN 2.0 RC1 binary was not compatible with it.

It can be found here : http://wiki.openqa.org/display/WTR/FireWatir+Installation

Vaudry
much thanks for that link
Frank Schwieterman
A: 

Thanks Vaudry, I updated JSSH plugin from the site you gave for matching Firefox3.6. But the function FireFox.AttachToFireFox() couldn't be found in WatiN 3.0 RC1 and Beta1. I used the attach method provided by HttpWatch to control the Firefox browser:

HttpWatch.Controller ct = new HttpWatch.Controller();
HttpWatch.Plugin plugin = controller.Firefox.Attach("Default");

It works! But....the attach method provided by HttpWatch is not working for IE,

HttpWatch.Controller ct = new HttpWatch.Controller();
HttpWatch.Plugin plugin = ct.IE.Attach((SHDocVw.IWebBrowser2)ie.InternetExplorer);

Above code throws an exception like that:

Could not load file or assembly 'Interop.SHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=db7cfd3acb5ad44e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

So difficult to let WatiN 2.0 and HttpWatch work together....

Shu Yang
A: 

A breaking change was made recently that made WatiN browser-agnostic and allows testers to create a browser text fixture that will run the tests on the specified browser without having to code it specifically inline.

I'll post something a little more specific once I locate the code; I changed assignments and now am working with TFS 2010 instead of WatiN (not my choice, I love WatiN!).

LateBloomer