本文整理汇总了C#中WebPage.PerformDialogAction方法的典型用法代码示例。如果您正苦于以下问题:C# WebPage.PerformDialogAction方法的具体用法?C# WebPage.PerformDialogAction怎么用?C# WebPage.PerformDialogAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebPage
的用法示例。
在下文中一共展示了WebPage.PerformDialogAction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Click_OnHtmlInputButtonWithEqualsSignInSearchParameterValue_Succeeds
public void Click_OnHtmlInputButtonWithEqualsSignInSearchParameterValue_Succeeds()
{
//Arrange
using (var tempFile = new TempFile(
@"<html>
<head>
<title>test</title>
</head>
<body>
<input type=""submit"" value=""="" onclick=""alert('onclick');""/>
</body>
</html>"))
{
WebPage.Launch(tempFile.FilePath);
var window = new WebPage("test");
EnhancedHtmlInputButton button = window.Get<EnhancedHtmlInputButton>("Value==");
//Act
button.Click();
window.PerformDialogAction(BrowserDialogAction.Ok);
window.Close();
}
}
示例2: HtmlInputButton_UsingSearchParameterWithValueAsKey_Succeeds
public void HtmlInputButton_UsingSearchParameterWithValueAsKey_Succeeds()
{
//Internet Explorer may display the message: Internet Explorer restricted this webpage from running scripts or ActiveX controls.
//This security restriction prevents the alert message to appear.
//To enable running scripts on the local computer, go to Tools > Internet options > Advanced > Security > [checkmark] Allow active content to run in files on My Computer
//Arrange
using (var tempFile = new TempFile(
@"<html>
<head>
<title>test</title>
</head>
<body>
<input type=""submit"" value=""Log In"" onclick=""alert('onclick');""/>
</body>
</html>"))
{
WebPage.Launch(tempFile.FilePath);
var window = new WebPage("test");
EnhancedHtmlInputButton button = window.Get<EnhancedHtmlInputButton>("Value=Log In");
//Act
button.Click();
if (WebPage.GetCurrentBrowser() is InternetExplorer)
{
//read JavaScript alert text
var popup = new EnhancedWinWindow("ClassName=#32770;Name=Message from webpage");
EnhancedWinText text = popup.Get<EnhancedWinText>();
Assert.AreEqual("onclick", text.DisplayText);
}
window.PerformDialogAction(BrowserDialogAction.Ok);
window.Close();
}
}
示例3: SelectItem_UsingHtmlComboBoxThatAlertsOnChange_Succeeds
public void SelectItem_UsingHtmlComboBoxThatAlertsOnChange_Succeeds()
{
//Arrange
using (var tempFile = new TempFile(
@"<html>
<head>
<title>test</title>
</head>
<body>
<select id=""selectId"" onchange=""alert('onchange');"">
<option>Apple</option>
<option>Banana</option>
<option>Carrot</option>
</select>
</body>
</html>"))
{
WebPage.Launch(tempFile.FilePath);
var window = new WebPage("test");
EnhancedHtmlComboBox comboBox = window.Get<EnhancedHtmlComboBox>("Id=selectId");
//Act
comboBox.SelectItem("Banana");
window.PerformDialogAction(BrowserDialogAction.Ok);
window.Close();
}
}
示例4: HtmlTable_ClickOnColumnHeader_Succeeds
public void HtmlTable_ClickOnColumnHeader_Succeeds()
{
WebPage.Launch(CurrentDirectory + "/TestHtmlPage.html");
var bWin = new WebPage("A Test");
EnhancedHtmlTable tbl = bWin.Get<EnhancedHtmlTable>("id=tableWithAlertOnHeaderClick");
tbl.FindHeaderAndClick(0, 0);
bWin.PerformDialogAction(BrowserDialogAction.Ok);
bWin.Close();
}