The object invoked has disconnected from its clients (WatIn)

2

I am using WatIn to login to web ,i am working with this tool for a long time and never see this error before

The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))

This error appears when i am trying to open browser, i am not doing nothing before just first step open blowser:

  using (var browser = new IE("https://www.itau.com.br#/"))//here it fails
                {

               //it is not getting in here 
               //my  part of code

step = "1";
                    #region Login

                    try
                    {
                        browser.WaitForComplete();
                        linkExist = browser.TextField(Find.ById("campo_agencia")).Exists;
                        attempt = 40;
                        while (attempt > 0 && !linkExist)
                        {
                            Thread.Sleep(200);
                            linkExist = browser.TextField(Find.ById("campo_agencia")).Exists;
                            attempt--;
                        }
                        if (linkExist) browser.TextField(Find.ById("campo_agencia")).Value = strUser;
                        Thread.Sleep(200);

}
catch (Exception ex)
{

}
                }

Same times it is working,but in 90% it is not and i get an error.

Do any one know this error , and know how to fix it.

c#
.net
watin

1 Answer

2

After some research i have found there are Websites that add a reference to the browser (if I am not wrong), and when you launch again it fails. I've made a small change in my code, and now it works every time.

Just use GoTo after you build:

using (var browser = new IE())
    {
      browser.GoTo("https://www.itau.com.br#/");

   }
answered on Stack Overflow Oct 14, 2014 by Vladimir Potapov • edited Dec 4, 2015 by Law

User contributions licensed under CC BY-SA 3.0