2

I am writing some regression tests in WatiN and needed to make a couple POST web requests. The requests are working fine but I get an annoying dialog box asking me if I want to save the file or find a program online to open it. The line of code that is causing this is:

browser.Navigate2(ref uri, ref nflags, ref ntargetFrame, 
                  ref dataBytes, ref headers);

Is anyone familiar with the Navigate2() method? Any idea on how to get rid of this download box?

Alan
  • 281
  • 2
  • 9

1 Answers1

2

Here is my answer:

The Navigate2() method looks like this:

HRESULT Navigate2(
    VARIANT *URL,
    VARIANT *Flags,
    VARIANT *TargetFrameName,
    VARIANT *PostData,
    VARIANT *Headers
);

the flags can be defined as enum BrowserNavConstants like this:

typedef enum BrowserNavConstants {
    navOpenInNewWindow = 0x1,
    navNoHistory = 0x2,
    navNoReadFromCache = 0x4,
    navNoWriteToCache = 0x8,
    navAllowAutosearch = 0x10,
    navBrowserBar = 0x20,
    navHyperlink = 0x40,
    navEnforceRestricted = 0x80,
    navNewWindowsManaged = 0x0100,
    navUntrustedForDownload = 0x0200,
    navTrustedForActiveX = 0x0400,
    navOpenInNewTab = 0x0800,
    navOpenInBackgroundTab = 0x1000,
    navKeepWordWheelText = 0x2000,
    navVirtualTab = 0x4000,
    navBlockRedirectsXDomain = 0x8000,
    navOpenNewForegroundTab = 0x10000
} BrowserNavConstants;

I used navUnstrustedForDownload and it did away with the download box. Hope this helps someone somewhere

Alan
  • 281
  • 2
  • 9
  • This solution simple masks the problem and fails to solve it. Input is still appreciated – Alan Jun 29 '11 at 16:50