本文整理汇总了C#中IE类的典型用法代码示例。如果您正苦于以下问题:C# IE类的具体用法?C# IE怎么用?C# IE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IE类属于命名空间,在下文中一共展示了IE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UseLambasSpeedTest
public void UseLambasSpeedTest()
{
using (var ie = new IE(BaseWatiNTest.MainURI))
{
var textFieldStart = ie.TextField(t => t.Name == "TextareaName");
const int numberOfLookUps = 500;
StopWatch stopWatch1 = new StopWatch();
stopWatch1.Start();
for (var i = 0; i < numberOfLookUps; i++)
{
var textField = ie.TextField(t => t.Name == "TextareaName");
Assert.That(textField.Exists);
}
stopWatch1.Stop();
var stopWatch2 = new StopWatch();
stopWatch2.Start();
for (var i = 0; i < numberOfLookUps; i++)
{
var textField = ie.TextField(Find.ByName("TextareaName"));
Assert.That(textField.Exists);
}
stopWatch2.Stop();
Console.WriteLine("1: " + stopWatch1.TicksSpend / numberOfLookUps + " " + stopWatch1.TicksSpend + " " + stopWatch1.TicksSpend / 1000);
Console.WriteLine("2: " + stopWatch1.TicksSpend / numberOfLookUps + " " + stopWatch2.TicksSpend + " " + stopWatch2.TicksSpend / 1000);
}
}
示例2: AddProtocolToUrlIfOmmitted
public void AddProtocolToUrlIfOmmitted()
{
using (var ie = new IE("www.google.com"))
{
Assert.That(ie.Url, Text.StartsWith("http://"));
}
}
示例3: WhenOnBeforeUnloadReturnJavaDialogIsShown_ClickingOnCancelShouldKeepIEOpen
public void WhenOnBeforeUnloadReturnJavaDialogIsShown_ClickingOnCancelShouldKeepIEOpen()
{
using (var ie = new IE(OnBeforeUnloadJavaDialogURI))
{
var returnDialogHandler = new ReturnDialogHandler();
ie.AddDialogHandler(returnDialogHandler);
var hWnd = ie.hWnd;
// can't use ie.Close() here cause this will cleanup the registered
// returnDialogHandler which leads to a timeout on the WaitUntilExists
var internetExplorer = (IWebBrowser2)ie.InternetExplorer;
internetExplorer.Quit();
returnDialogHandler.WaitUntilExists();
returnDialogHandler.CancelButton.Click();
Thread.Sleep(2000);
Assert.IsTrue(Browser.Exists<IE>(new AttributeConstraint("hwnd", hWnd.ToString())));
// finally close the ie instance
internetExplorer.Quit();
returnDialogHandler.WaitUntilExists();
returnDialogHandler.OKButton.Click();
}
}
示例4: DoesFrameCodeWorkIfTwoBrowsersWithFramesAreOpen
public void DoesFrameCodeWorkIfTwoBrowsersWithFramesAreOpen()
{
using (var ie2 = new IE(FramesetURI))
{
var contentsFrame = ie2.Frame(Find.ByName("contents"));
Assert.IsFalse(contentsFrame.Html.StartsWith("<FRAMESET"), "inner html of frame is expected");
}
}
示例5: GetBrowser
public Browser GetBrowser(Uri uri)
{
if (ie == null)
{
ie = (IE) CreateBrowser(uri);
}
return ie;
}
示例6: CheckIEIsInheritingProperTypes
public void CheckIEIsInheritingProperTypes()
{
using (var ie = new IE())
{
Assert.IsInstanceOfType(typeof (IE), ie, "Should be an IE instance");
Assert.IsInstanceOfType(typeof (Browser), ie, "Should be a Browser instance");
Assert.IsInstanceOfType(typeof (DomContainer), ie, "Should be a DomContainer instance");
}
}
示例7: UsingLinqExtensionMethodsWithWatiN_1_3
public void UsingLinqExtensionMethodsWithWatiN_1_3()
{
using (var ie = new IE("www.google.com"))
{
var button = ie.Buttons.Where(b => b.GetValue("name") == "btnG").First();
Assert.That(button.GetValue("Name"), Is.EqualTo("btnG"));
}
}
示例8: UsingLambdaExpressionsWithWatiN_1_3
public void UsingLambdaExpressionsWithWatiN_1_3()
{
using (var ie = new IE("www.google.com"))
{
var textField = ie.TextField(t => t.Name == "q");
Assert.That(textField.Name, Is.EqualTo("q"));
}
}
示例9: UsingLinqQueryWithWatiN_1_3
public void UsingLinqQueryWithWatiN_1_3()
{
using (var ie = new IE("www.google.com"))
{
var buttons = from button in ie.Buttons
where button.GetValue("Name") == "btnG"
select button;
Assert.That(buttons.First().GetValue("Name"), Is.EqualTo("btnG"));
}
}
示例10: Test2
static void Test2(IE
ie)
{
ie.doom
();
object
o
=
ie.Clone();
ie.Dispose
();
}
示例11: 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();
}
示例12: ShouldBeAbleToGetTheMetaTags
public void ShouldBeAbleToGetTheMetaTags()
{
// GIVEN
using (var browser = new IE(MainURI))
{
// WHEN
var metaTags = browser.ElementsWithTag("meta");
// THEN
Assert.That(metaTags.Count, Is.EqualTo(1));
}
}
示例13: FinishInitializationAndWaitForComplete
public Browser FinishInitializationAndWaitForComplete(IE ie, SimpleTimer timer, bool waitForComplete)
{
ie.FinishInitialization(null);
if (waitForComplete)
{
var ieWaitForComplete = new IEWaitForComplete((IEBrowser) ie.NativeBrowser) { Timer = timer };
ie.WaitForComplete(ieWaitForComplete);
}
return ie;
}
示例14: 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");
}
}
示例15: 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();
}