当前位置: 首页>>代码示例>>C#>>正文


C# IE.WaitForComplete方法代码示例

本文整理汇总了C#中WatiN.Core.IE.WaitForComplete方法的典型用法代码示例。如果您正苦于以下问题:C# IE.WaitForComplete方法的具体用法?C# IE.WaitForComplete怎么用?C# IE.WaitForComplete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WatiN.Core.IE的用法示例。


在下文中一共展示了IE.WaitForComplete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ForceBrowserClose

        public Result ForceBrowserClose(bool forceClose)
        {
            if (isLocal || forceClose)
            {
                try
                {
                    browser = new IE(Urls.Root);

                    browser.WaitForComplete();
                }
                catch (Exception e)
                {
                    Console.WriteLine("BaseFixture.ForceBrowserForDatabaseReset: " + e.ToString());

                    Thread.Sleep(500);

                    browser = new IE(Urls.Root);

                    browser.WaitForComplete();
                }

                CloseBrowser(forceClose);
            }

            return Result.CreatePass();
        }
开发者ID:ihenehan,项目名称:Behavior,代码行数:26,代码来源:BaseFixture.cs

示例2: TestFixtureSetup

 public void TestFixtureSetup()
 {
     rootURL = ConfigurationManager.AppSettings["RootURL"];
     // hide IE browser during tests
     Settings.Instance.MakeNewIeInstanceVisible = true;
     browser = new IE(rootURL + "Account/LogOn");
     browser.WaitForComplete();
 }
开发者ID:luisexposito,项目名称:AsistenteInteligente,代码行数:8,代码来源:BaseUITest.cs

示例3: Remote_server_does_nothing

 public void Remote_server_does_nothing()
 {
     using (IWebServer server = WebServerFactory.CreateWebServer("Remote", "http://www.bing.com/", null, 0))
     using (Browser browser = new IE(server.RootUrl))
     {
         browser.WaitForComplete();
         Assert.Equal("Bing", browser.Title);
     }
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:9,代码来源:SampleTest.cs

示例4: UploadImage

        public void UploadImage(IE ie, string filePath)
        {
            ie.Link(Find.ById("uploadImage")).Click();

            var fu = ie.FileUpload(Find.ByClass("ImageUpload"));
            fu.Set(filePath);

            ie.Button(Find.ById("ctl00_cphAdmin_btnUploadImage")).Click();
            ie.WaitForComplete();
        }
开发者ID:sagasu,项目名称:tddLegacy,代码行数:10,代码来源:EditPost.cs

示例5: UploadVideo

        public void UploadVideo(IE ie, string filePath)
        {
            ie.Link(Find.ById("uploadVideo")).Click();

            var fu = ie.FileUpload(Find.ById("ctl00_cphAdmin_txtUploadVideo"));
            fu.Set(filePath);

            ie.Button(Find.ById("ctl00_cphAdmin_btnUploadVideo")).Click();
            ie.WaitForComplete();
        }
开发者ID:sagasu,项目名称:tddLegacy,代码行数:10,代码来源:EditPost.cs

示例6: Sample_app_started_in_IISExpress

 public void Sample_app_started_in_IISExpress()
 {
     using (IWebServer server = WebServerFactory.CreateWebServer())
     using (Browser browser = new IE(server.RootUrl))
     {
         browser.WaitForComplete();
         IndexPage page = browser.Page<IndexPage>();
         Assert.Contains("Please run the WatiN test", page.Message.Text);
     }
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:10,代码来源:SampleTest.cs

示例7: ResultWindow

 public ResultWindow(int timeLimit , string idProblem)
     : this()
 {
     this.timeLimit = timeLimit;
     this.idProblem = idProblem;
     Process process = new Process();
     process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
     process.StartInfo.CreateNoWindow = true;
     process.StartInfo.UseShellExecute = false;
     process.StartInfo.FileName = "cmd";
     process.StartInfo.Arguments =
         string.Format("/C \"\"{0}\" < \"{1}\" > \"{2}\"\"",
         Properties.Settings.Default.FileExec,
         Properties.Settings.Default.FileInput,
         Properties.Settings.Default.FileOutput);
     process.Start();
     if (!process.WaitForExit(timeLimit * 1000))
         process.Kill();
     if (process.ExitCode != 0)
     {
         runtime.Visibility = Visibility.Visible;
         return;
     }
     timeExec.Content = process.TotalProcessorTime.Milliseconds / 1000f + "s";
     try
     {
         textInput = File.ReadAllText(Properties.Settings.Default.FileInput);
         textOutput = File.ReadAllText(Properties.Settings.Default.FileOutput);
         textOutput = textOutput.Replace("\r\n", "\n");
         //Settings.MakeNewIeInstanceVisible = false;
         WatiN.Core.Settings.Instance.AutoMoveMousePointerToTopLeft = false;
         browser = new IE(prefix + idProblem);
         TextField inputField = browser.TextField(Find.ById("edit-input-data"));
         WatiN.Core.Button buttonSubmit = browser.Button(Find.ById("edit-output"));
         inputField.Value = textInput;
         buttonSubmit.Click();
         browser.WaitForComplete();
         string result = browser.Html;
         int begin = result.IndexOf("<pre>") + 5;
         textCorrect = result.Substring(begin, result.IndexOf("</pre>") - begin);
         File.WriteAllText(Properties.Settings.Default.FileCorrect, textCorrect);
         if (textOutput != textCorrect)
             incorrect.Visibility = Visibility.Visible;
         else
             accepted.Visibility = Visibility.Visible;
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     browser.ForceClose();
 }
开发者ID:HuyTranQ,项目名称:UvaLocalJudge,代码行数:52,代码来源:ResultWindow.xaml.cs

示例8: TestClickNextBlog

 public void TestClickNextBlog()
 {
     using (var browser = new IE("http://localhost:8888/Blog/My-New-iMac"))
     {
         var funnyDialog = new AlertDialogHandler();
         using (new UseDialogOnce(browser.DialogWatcher, funnyDialog))
         {
             browser.Link("MainContent_linkNextBlog").ClickNoWait();
             funnyDialog.WaitUntilExists();
             funnyDialog.OKButton.Click();
             Assert.IsTrue(funnyDialog.Message.Contains("I've told you I am writing:)"));
         }
         browser.WaitForComplete(3);
     }
 }
开发者ID:WayneYe,项目名称:WayneBlog,代码行数:15,代码来源:ViewBlogPageTest.cs

示例9: SuccessfulAdministrationLogin

        public void SuccessfulAdministrationLogin()
        {
            var browserUrl = string.Empty;
            using (var browser = new IE("http://localhost:1200/"))
            {
                browser.Link(Find.ByText("Admin")).Click();
                browser.TextField(Find.ById("UserName")).TypeText("administrator");
                browser.TextField(Find.ById("Password")).TypeText("password123!");

                browser.Element(Find.ByValue("Log On")).Click();
                browser.WaitForComplete(2);

                browserUrl = browser.Url;
            }

            Assert.That(browserUrl.Contains("/StoreManager"), string.Format("Browser Url is incorrect - it is actually {0}", browserUrl));
        }
开发者ID:stack72,项目名称:SpecFlow-Demo-Project-with-MVC-Music-Store,代码行数:17,代码来源:LoginTests.cs

示例10: DeletePostByTitle

        public bool DeletePostByTitle(string title, IE ie)
        {
            ie.GoTo(Url);
            ie.WaitForComplete();

            var tblPosts = ie.Table("Posts");

            if (tblPosts != null)
            {
                foreach (var row in tblPosts.TableRows)
                {
                    if (!string.IsNullOrEmpty(row.Id) && row.InnerHtml.Contains(title))
                    {
                        ie.Link("a-" + row.Id).Click();
                        return true;
                    }
                }
            }
            return false;
        }
开发者ID:royosherove,项目名称:tddnetcoursedemos,代码行数:20,代码来源:PostList.cs

示例11: StressThread

        void StressThread()
        {
            //Settings.WaitForCompleteTimeOut = 3600;
            //Settings.WaitUntilExistsTimeOut = 3600;
            
            using (IE ie = new IE("http://localhost:8888/"))
            {
                //ie.Frame(Find.ById("uploadManager")).FileUpload(Find.ById("test")).Set("e:\\downloads\\VS7.1sp1-KB918007-X86.exe");
                //ie.Frame(Find.ById("uploadManager")).FileUpload(Find.ById("test")).Set("e:\\downloads\\Sandcastle.msi");
                SetFileUpload(ie, "slickUpload_selector_html_file0", @"C:\Users\Chris\Downloads\Firefox Setup 7.0.exe");

                //_waitEvent.WaitOne();
                ie.Link(Find.ById("uploadButton")).Click();

                while (!ie.ContainsText("Upload Result"))
                {
                    Thread.Sleep(1000);
                    //ie.WaitForComplete();
                }

                Assert.True(ie.ContainsText("Complete"));

                ie.Link(Find.ById("newUploadButton")).Click();
                ie.WaitForComplete();

                SetFileUpload(ie, "slickUpload_selector_html_file0", @"C:\Users\Chris\Downloads\SlickUpload-6.1-S3MetadataFix.zip");
                SetFileUpload(ie, "slickUpload_selector_html_file1", @"C:\Users\Chris\Downloads\MSBuild Extension Pack April 2011 (All Files) (1).zip");
                ie.Link(Find.ById("uploadButton")).Click();

                while (!ie.ContainsText("Upload Result"))
                {
                    Thread.Sleep(1000);
                    //ie.WaitForComplete();
                }

                Assert.True(ie.ContainsText("Complete"));

                //Thread.Sleep(10000);
            }
        }
开发者ID:codingbat,项目名称:BandCamp,代码行数:40,代码来源:WebStressTest.cs

示例12: Check_That_When_Logged_In_As_Admin_Then_Add_Product_Works

        public void Check_That_When_Logged_In_As_Admin_Then_Add_Product_Works()
        {
            var result = false;
            using (IE netWindow = new IE("http://localhost:49573/default.aspx"))
            {
                LoginAsAdmin(netWindow);

                netWindow.Link(Find.ById("ctl00_ucHeader_lnkAdminPage")).Click();
                #region hidden new way
                netWindow.Link(Find.ById(new Regex("AdminPage$")));
                #endregion

                netWindow.WaitForComplete();

                netWindow.Button(Find.ById("ctl00_ucHeader_lnkProductAdmin")).Click();
                netWindow.WaitForComplete();

                netWindow.Button(Find.ById("ctl00_ContentPlaceHolder1_RadDock1_C_btnAddProduct")).Click();
                netWindow.WaitForComplete();

                netWindow.TextField(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_txtProductName")).TypeText(String.Format("Paul Test Product {0}", DateTime.Now.Ticks.ToString()));
                netWindow.SelectList(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_ddlProductManufacturer")).SelectByValue("3");
                netWindow.SelectList(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_ddlCategoryList")).SelectByValue("2");
                netWindow.WaitForComplete(100);
                netWindow.SelectList(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_ddlSubCategoryList")).SelectByValue("2");
                netWindow.WaitForComplete();
                netWindow.Link(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_btnAddCombo")).Click();
                netWindow.WaitForComplete();
                netWindow.TextField(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_txtProductPrice")).TypeText("19.99");
                netWindow.TextField(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_txtProductModel")).TypeText("Paul Test Model 1");
                netWindow.Link(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_btnSave")).Click();

                netWindow.WaitForComplete();

                Span resultMessage = netWindow.Span(Find.ById("ctl00_ContentPlaceHolder1_ucProduct_ucMessage_lblMessage"));
                if (resultMessage.Text == "New Product created successfuly")
                {
                    result = true;
                }
            }
            Assert.IsTrue(result);
        }
开发者ID:stack72,项目名称:SpecFlow-Demo-Project-with-MVC-Music-Store,代码行数:42,代码来源:SampleTestsforWebforms.cs

示例13: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                IE ie = new IE();

                ie.GoTo("www.terra.com.br");

                ie.WaitForComplete();

                ie.TextField("autocomplete").Value = "esporte";
                ie.TextField("autocomplete").Focus();

                SendKeys.SendWait("{ENTER}");
                //ie.TextField("autocomplete").KeyPress((char)Keys.Enter);

            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }
        }
开发者ID:Willamar,项目名称:Projetos,代码行数:23,代码来源:Form1.cs

示例14: PopulateBrandMobilePhones

        public void PopulateBrandMobilePhones(IEnumerable<int> brandIdList)
        {
            Settings.AttachToBrowserTimeOut = 240;
            Settings.WaitUntilExistsTimeOut = 240;
            Settings.WaitForCompleteTimeOut = 240;
            using (var dbContext = new MobilesDbContext())
            {
                try
                {
                    List<BrandPage> brandPages =
                        dbContext.BrandPages.Include("Brand").Where(p => brandIdList.Contains(p.Brand.Id) && p.IsRead == false).ToList();
                    foreach (BrandPage brandPage in brandPages)
                    {
                        string url = brandPage.Url;
                        try
                        {
                            using (var browser = new IE(url, true))
                            {
                                browser.ShowWindow(NativeMethods.WindowShowStyle.Hide);
                                browser.WaitForComplete();

                                IEnumerable<Div> productsDivs =
                                    browser.Divs.Where(d => d.ClassName != null && d.ClassName.Contains("makers"));

                                var listOfProducts = new List<OnlineShopModel.Product>();
                                foreach (Div productDiv in productsDivs)
                                {
                                    List productsList = productDiv.Lists.First();

                                    if (productsList != null && productsList.Exists)
                                    {
                                        foreach (ListItem productListItem in productsList.ListItems)
                                        {
                                            Link productLink = productListItem.Links.First();
                                            Element productName =
                                                productLink.Children().Where(c => c.TagName.ToUpper() == "STRONG").First();
                                            Image productImage = productLink.Images.First();
                                            listOfProducts.Add(new OnlineShopModel.Product
                                            {
                                                ProductName = productName.Text,
                                                Url = productLink.Url,
                                                ImageUrl = productImage.Src,
                                                Description = productImage.Title
                                            });
                                        }
                                    }
                                }

                                Database.SetInitializer(new CreateDatabaseIfNotExists<MobilesDbContext>());

                                List<Product> dbProductsList = dbContext.Products.ToList();

                                foreach (OnlineShopModel.Product product in listOfProducts)
                                {
                                    Product filterProduct = dbProductsList.Where(p => p.Url == product.Url).FirstOrDefault();
                                    if (filterProduct == null)
                                    {
                                        Product dbProduct = GetDbProduct(product);
                                        dbProduct.Brand = brandPage.Brand;
                                        dbContext.Products.Add(dbProduct);
                                    }
                                }

                                brandPage.IsRead = true;

                                dbContext.SaveChanges();
                            }
                        }
                        catch (Exception)
                        {

                        }

                    }
                }

                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    Console.ReadLine();
                    //throw ex;
                }
            }
        }
开发者ID:josegeorge,项目名称:WoldOfMobiels,代码行数:84,代码来源:gsmarenaOnline.cs

示例15: Main

 static void Main(string[] args)
 {
     //Делаем компилятор счастливым
     string username = "";
     System.Console.WriteLine("OZWar Bot v1.0");
     System.Console.WriteLine("Инициализация IE...");
     //Инициализация ватина
     WatiN.Core.IE ieb = new IE("http://ozwar.ru/forum/index.php?app=core&module=global&section=login");
     ieb.Visible = false;
     int ii = 0;
     while (ii == 0)
     {
         System.Console.WriteLine("Авторизация...");
         ieb.WaitForComplete();
         //Вводим данные
         System.Console.WriteLine("Введите имя пользователя:");
         username = System.Console.ReadLine();
         System.Console.WriteLine("Введите пароль:");
         string password = System.Console.ReadLine();
         ieb.TextField(WatiN.Core.Find.ByName("ips_username")).TypeText(username);
         ieb.TextField(WatiN.Core.Find.ByName("ips_password")).TypeText(password);
         ieb.Button(WatiN.Core.Find.ByClass("input_submit")).Click();
         ieb.WaitForComplete();
         if (ieb.Link(WatiN.Core.Find.ByTitle(username)).Exists)
         {
             ii = 1;
         }
     }
     //Смотрим баланс
     ieb.GoTo(ieb.Link(WatiN.Core.Find.ByTitle(username)).Url);
     ieb.WaitForComplete();
     System.Console.WriteLine("Баланс: " + ieb.Span(WatiN.Core.Find.ByClass("fc")).Text.ToString());
     System.Console.WriteLine("Грузим ссылки...");
     //Грузим ссылки
     var ar1 = new List<string>();
     System.IO.StreamReader file = new System.IO.StreamReader(@"c:\list.txt");
     string line;
     while ((line = file.ReadLine()) != null)
     {
         ar1.Add(line);
     }
     //Грузим фразы
     System.Console.WriteLine("Грузим фразы...");
     var ar2 = new List<string>();
     System.IO.StreamReader file2 = new System.IO.StreamReader(@"c:\phrases.txt");
     string line2 = "";
     while ((line2 = file2.ReadLine()) != null)
     {
         ar2.Add(line2);
     }
     int co = 0;
     while (co < ar1.Count)
     {
         ieb.GoTo(ar1[co]);
         ieb.WaitForComplete();
         if (!ieb.Link(WatiN.Core.Find.ByTitle("Изменить")).Exists)
         {
             System.Console.WriteLine("Текущая ссылка: " + ar1[co]);
             int rnd = RandomInt(0, ar2.Count);
             System.Console.WriteLine("Пишем");
             ieb.TextField(WatiN.Core.Find.ByName("Post")).TypeTextQuickly(ar2[rnd] + "[color=#222222]Эта информация тут только для дебага, цыц, вы этого не видели. Не, ну серьёзно. Ну, а раз видели, значит её сейчас, к сожалению, сейчас не станет. Это сообщение отправлено ботом OreNew, пожалуйста, не читайте его.[/color]");
             ieb.Form(WatiN.Core.Find.ById("ips_fastReplyForm")).Submit();
             ieb.WaitForComplete();
             ieb.GoTo(ieb.Link(WatiN.Core.Find.ByTitle("Изменить")).Url);
             ieb.WaitForComplete();
             ieb.TextField(WatiN.Core.Find.ByName("Post")).TypeText(ar2[rnd]);
             ieb.Form(WatiN.Core.Find.ById("postingform")).Submit();
             System.Console.WriteLine("Выполнено");
             ieb.GoTo("http://ozwar.ru/forum/index.php?/user/609-benderfromfuture/");
             ieb.WaitForComplete();
             System.Console.WriteLine("Баланс: " + ieb.Span(WatiN.Core.Find.ByClass("fc")).Text.ToString());
             co++;
         }
         else
         {
             System.Console.WriteLine("Найдены следы нас!");
             co++;
         }
         System.Console.WriteLine("Ссылки кончились, бот завершил свою работу");
         ieb.Link(WatiN.Core.Find.ByTitle("Выход")).Click();
         System.Console.WriteLine("Выход из профиля...");
         System.Console.ReadLine();
     }
 }
开发者ID:1337erature,项目名称:OZWarBot,代码行数:84,代码来源:Program.cs


注:本文中的WatiN.Core.IE.WaitForComplete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。