本文整理汇总了C#中IE.GoTo方法的典型用法代码示例。如果您正苦于以下问题:C# IE.GoTo方法的具体用法?C# IE.GoTo怎么用?C# IE.GoTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IE
的用法示例。
在下文中一共展示了IE.GoTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_detect_error
public void Should_detect_error()
{
using (var ie = new IE())
{
var ieClass = (InternetExplorerClass) ie.InternetExplorer;
var doc = (IHTMLDocument2) ieClass.Document;
var window = (HTMLWindowEvents_Event) doc.parentWindow;
window.onerror += (description, url, line) => Console.WriteLine(@"{0}: '{1}' on line {2}", url, description, line);
ie.GoTo(@"D:\Projects\WatiN\Support\ErrorInJavascript\Test.html");
ie.GoTo("google.com");
ie.GoTo(@"D:\Projects\WatiN\Support\ErrorInJavascript\Test.html");
}
}
示例2: DownloadRun
public void DownloadRun()
{
var dhdl = new FileDownloadHandler(FileDownloadOptionEnum.Run);
var ie = new IE();
ie.AddDialogHandler(dhdl);
ie.WaitForComplete();
ie.GoTo("http://watin.sourceforge.net/WatiN-1.0.0.4000-net-1.1.msi");
dhdl.WaitUntilFileDownloadDialogIsHandled(5);
dhdl.WaitUntilDownloadCompleted(20);
ie.Close();
}
示例3: LogonDialogTest
public void LogonDialogTest()
{
using (var ie = new IE())
{
var logonDialogHandler = new LogonDialogHandler("test", "this");
using (new UseDialogOnce(ie.DialogWatcher, logonDialogHandler))
{
ie.GoTo("http://irisresearch.library.cornell.edu/control/authBasic/authTest");
}
ie.WaitUntilContainsText("Basic Authentication test passed successfully",5);
}
}
示例4: DownloadOpen
public void DownloadOpen()
{
var dhdl = new FileDownloadHandler(FileDownloadOptionEnum.Open);
var ie = new IE();
ie.AddDialogHandler(dhdl);
ie.WaitForComplete();
ie.GoTo("http://watin.sourceforge.net/WatiNRecorder.zip");
dhdl.WaitUntilFileDownloadDialogIsHandled(5);
dhdl.WaitUntilDownloadCompleted(20);
ie.Close();
}
示例5: DownloadSave
public void DownloadSave()
{
var file = new FileInfo(@"c:\temp\test.zip");
file.Directory.Create();
file.Delete();
Assert.That(file.Exists, Is.False, file.FullName + " file should not exist before download");
var fileDownloadHandler = new FileDownloadHandler(file.FullName);
using (var ie = new IE())
{
ie.AddDialogHandler(fileDownloadHandler);
// ie.GoTo("http://watin.sourceforge.net/WatiN-1.0.0.4000-net-1.1.msi");
ie.GoTo("http://watin.sourceforge.net/WatiNRecorder.zip");
fileDownloadHandler.WaitUntilFileDownloadDialogIsHandled(15);
fileDownloadHandler.WaitUntilDownloadCompleted(200);
}
file = new FileInfo(@"c:\temp\test.zip");
Assert.IsTrue(file.Exists, file.FullName + " file does not exist after download");
}
示例6: ClearCache
public void ClearCache()
{
using (var ie = new IE(GoogleUrl))
{
// Testing cache clearing directly is a little difficult because we cannot
// easily enumerate its contents without using system APIs.
// We could create a sample page that includes a nonce but says it's cacheable
// forever. Then we should only observe the change on refresh or cache clearing.
// Fortunately Google has already done it for us.
// Save the original page html.
var oldHtml = GetHtmlSource(ie);
// If we navigate to the page again, we should see identical Html.
ie.GoTo(GoogleUrl);
Assert.AreEqual(oldHtml, GetHtmlSource(ie), "HTML should be identical when pulling from the cache.");
// But after clearing the cache, things are different.
ie.ClearCache();
ie.GoTo(GoogleUrl);
Assert.AreNotEqual(oldHtml, GetHtmlSource(ie), "HTML should differ after cache has been cleared.");
}
}