Example #1
0
        public void SetUp()
        {
            Settings.WaitForCompleteTimeOut = 80;
            Settings.WaitUntilExistsTimeOut = 80;

            platform = (Platform)Enum.Parse(typeof(Platform), System.Configuration.ConfigurationManager.AppSettings["Platform"]);
            targetHost = System.Configuration.ConfigurationManager.AppSettings["TargetHost"];

            switch (platform)
            {
                case Platform.IE:

                    browser = new IE();
                    browser.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Maximize);
                    break;
                case Platform.FF:
                    browser = new FireFox();
                    browser.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Maximize);
                    break;

            }
            browser.GoTo(targetHost);
        }
        public void T11_Check_username_RememberUsername()
        {
            TestUserSignIn(UN, PW, true, 2);

            System.Diagnostics.Process[] processList = System.Diagnostics.Process.GetProcessesByName("firefox");
            foreach (System.Diagnostics.Process process in processList)
            {
                process.Kill();
                // sleep to make sure process is killed
                System.Threading.Thread.Sleep(2000);
            }
            browser = new FireFox();
            browser.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Maximize);
            browser.GoTo(targetHost);
            System.Threading.Thread.Sleep(2000);
            if (browser.Div(Find.ById("topNavMemberDiv")).Exists == true)
            {
                Assert.IsTrue(true);
            }
            else
            {

                Assert.IsTrue(false);
            }
        }
Example #3
0
        public void SetUp()
        {
            Settings.WaitForCompleteTimeOut = 80;
            Settings.WaitUntilExistsTimeOut = 80;

            platform = (Platform)Enum.Parse(typeof(Platform), System.Configuration.ConfigurationManager.AppSettings["Platform"]);
            //targetHost = System.Configuration.ConfigurationManager.AppSettings["TargetHost"];

            switch (platform)
            {
                case Platform.IE:
                    if (IE.InternetExplorers().Count == 0)
                    {
                        browser = new IE();
                        browser.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Maximize);

                    }
                    else
                    {
                        int pagecount = IE.InternetExplorers().Count;
                        int index=100;

                        for (int i=0; i < pagecount; i++)
                        {
                            if (IE.InternetExplorers()[i].Url.Contains(targetHost) == true)
                            {
                                index = i;
                            }

                        }
                        if (index != 100)
                        {
                            browser = IE.InternetExplorers()[index];
                        }
                        else
                        {
                            browser = new IE();
                        }
                        browser.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Maximize);
                    }
                    break;
                    //if (IE.InternetExplorers().Count == 0)
                    //{
                    //    browser = new IE();
                    //}
                    //else
                    //{
                    //    int Count = IE.InternetExplorers().Count;

                    //    //for(int i; i<Count;i++)
                    //    //{
                    //    //    bool Contains;
                    //    //    Contains
                    //    //    IE.InternetExplorers()[1].Url.Contains(targetHost);

                    //    //}

                    //    if(IE.InternetExplorers())
                    //    {
                    //        browser = IE.InternetExplorers()[1];
                    //        IE.InternetExplorers()[1].Url.Contains(targetHost);
                    //    }
                    //    else
                    //    {
                    //        browser = new IE();
                    //    }
                    //}

                case Platform.FF:
                    browser = new FireFox();
                    browser.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Maximize);
                    break;

            }
        }