本文整理汇总了C#中IE.Button方法的典型用法代码示例。如果您正苦于以下问题:C# IE.Button方法的具体用法?C# IE.Button怎么用?C# IE.Button使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IE
的用法示例。
在下文中一共展示了IE.Button方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CloseSpecificBrowserAlert
public void CloseSpecificBrowserAlert()
{
Assert.AreEqual(0, Ie.DialogWatcher.Count, "DialogWatcher count should be zero");
var firstIE = Ie;
firstIE.RunScript("document.title = 'firstIe'; ");
using (var secondIe = new IE(TestPageUri,true))
{
secondIe.RunScript("document.title = 'secondIe'; ");
// set up a second browser with an open dialog
var secondAlertDialogHandler = new AlertDialogHandler();
using (new UseDialogOnce(secondIe.DialogWatcher, secondAlertDialogHandler))
{
secondIe.Button(Find.ByValue("Show alert dialog")).ClickNoWait();
secondAlertDialogHandler.WaitUntilExists(5);
// close the original message
var firstAlertDialogHandler = new AlertDialogHandler();
using (new UseDialogOnce(firstIE.DialogWatcher, firstAlertDialogHandler))
{
firstIE.Button(Find.ByValue("Show alert dialog")).ClickNoWait();
firstAlertDialogHandler.WaitUntilExists(5);
var message = firstAlertDialogHandler.Message;
firstAlertDialogHandler.OKButton.Click();
firstIE.WaitForComplete(5);
Assert.IsTrue(secondAlertDialogHandler.Exists(), "Original Alert Dialog should be open.");
Assert.AreEqual("This is an alert!", message, "Unexpected message");
Assert.IsFalse(firstAlertDialogHandler.Exists(), "Alert Dialog should be closed.");
}
// close the second message
secondAlertDialogHandler.OKButton.Click();
secondIe.WaitForComplete(5);
Assert.IsFalse(secondAlertDialogHandler.Exists(), "Alert Dialog should be closed.");
}
}
}
示例2: TestMultipleIE
public void TestMultipleIE()
{
using (var ie = new IE(TestEventsURI))
{
var handler = new ConfirmDialogHandler();
try
{
ie.AddDialogHandler(handler);
ie.Button(Find.ByValue("Show confirm dialog")).ClickNoWait();
handler.WaitUntilExists(5);
handler.OKButton.Click();
}
finally
{
ie.RemoveDialogHandler(handler);
}
using (var ie2 = new IE(TestEventsURI))
{
var handler2 = new ConfirmDialogHandler();
try
{
ie2.AddDialogHandler(handler2);
ie2.Button(Find.ByValue("Show confirm dialog")).ClickNoWait();
handler2.WaitUntilExists(5);
handler2.OKButton.Click();
}
finally
{
ie2.RemoveDialogHandler(handler2);
}
}
}
}
示例3: TestWatiNWithInjectedHTMLCode
public void TestWatiNWithInjectedHTMLCode()
{
var html = "<HTML><input name=txtSomething><input type=button name=btnSomething value=Click></HTML>";
using(var ie = new IE())
{
var document = ((IEDocument)ie.NativeDocument).HtmlDocument;
document.writeln(html);
Assert.That(ie.Button(Find.ByName("btnSomething")).Exists);
}
}
示例4: DocumentShouldBeDisposedSoHTMLDialogGetsDisposedAndReferenceCountIsOK
public void DocumentShouldBeDisposedSoHTMLDialogGetsDisposedAndReferenceCountIsOK()
{
DialogWatcher dialogWatcher;
int ReferenceCount;
using (var ie = new IE(MainURI))
{
ReferenceCount = ie.DialogWatcher.ReferenceCount;
ie.Button("popupid").Click();
Thread.Sleep(100);
using (Document document = ie.HtmlDialog(Find.ByIndex(0)))
{
Assert.AreEqual(ReferenceCount + 1, ie.DialogWatcher.ReferenceCount, "DialogWatcher reference count");
}
dialogWatcher = ie.DialogWatcher;
}
Assert.AreEqual(ReferenceCount - 1, dialogWatcher.ReferenceCount, "DialogWatcher reference count should be zero after test");
}
示例5: HtmlDialogCollectionShouldReturnOnlyItsOwnChildHtmlDialogs
public void HtmlDialogCollectionShouldReturnOnlyItsOwnChildHtmlDialogs()
{
Ie.Button("popupid").Click();
using (var ie2 = new IE(MainURI))
{
ie2.Button("popupid").Click();
Assert.That(Ie.HtmlDialogs.Count, Is.EqualTo(1));
Assert.That(ie2.HtmlDialogs.Count, Is.EqualTo(1));
}
}
示例6: DialogWatcherOfIEAndHTMLDialogShouldNotBeNull
public void DialogWatcherOfIEAndHTMLDialogShouldNotBeNull()
{
using (var ie = new IE(MainURI))
{
Assert.IsNotNull(ie.DialogWatcher, "ie.DialogWatcher should not be null");
ie.Button("modalid").ClickNoWait();
using (var htmlDialog = ie.HtmlDialog(Find.ByTitle("PopUpTest")))
{
Assert.IsNotNull(htmlDialog.DialogWatcher, "htmlDialog.DialogWatcher should not be null");
}
}
}
示例7: TestMultipleIEInstancesOpeningAlertDialogs
public void TestMultipleIEInstancesOpeningAlertDialogs()
{
using (var ie = new IE(TestEventsURI))
{
var handler = new ConfirmDialogHandler();
using (new UseDialogOnce(ie.DialogWatcher, handler))
{
ie.Button(Find.ByValue("Show confirm dialog")).ClickNoWait();
handler.WaitUntilExists(5);
using (var ie2 = new IE(TestEventsURI))
{
var handler2 = new ConfirmDialogHandler();
using (new UseDialogOnce(ie2.DialogWatcher, handler2))
{
ie2.Button(Find.ByValue("Show confirm dialog")).ClickNoWait();
handler2.WaitUntilExists(5);
handler2.OKButton.Click();
}
}
handler.OKButton.Click();
}
}
}