Beispiel #1
0
        public static FireFox AttachToFireFoxNoWait(Constraint findBy, int timeout)
        {
            FireFox result = new FireFox(false);

            result.AttachToExisting(findBy, timeout, false);
            return(result);
        }
Beispiel #2
0
        public void Should_get_the_date()
        {
            // GIVEN
            using (var browser = new FireFox("http://jqueryui.com/demos/datepicker/"))
            {
                var datePicker = browser.Control<DatePicker>("datepicker");
                datePicker.Date = new DateTime(2009, 12, 6);
                
                // WHEN
                var date = datePicker.Date;

                // THEN
                Assert.AreEqual(new DateTime(2009, 12, 6), date);
            }
        }
Beispiel #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:

                    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);
            }
        }
        public virtual Browser CreateBrowser()
        {
            switch (browserConfiguration.BrowserType)
            {
                case BrowserType.IE:
                    var ie = new IE();
                    ie.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Maximize);
                    return ie;

                case BrowserType.FireFox:
                    var fireFox = new FireFox();
                    return fireFox;

                case BrowserType.Chrome:
                    throw new NotSupportedException("Chrome browser not fully supported by WatiN at this time!");

                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #6
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;

            }
        }