本文整理汇总了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();
}
示例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();
}
示例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);
}
}
示例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();
}
示例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();
}
示例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);
}
}
示例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();
}
示例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);
}
}
示例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));
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
}
示例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§ion=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();
}
}