本文整理汇总了C#中WinWindow.Get方法的典型用法代码示例。如果您正苦于以下问题:C# WinWindow.Get方法的具体用法?C# WinWindow.Get怎么用?C# WinWindow.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WinWindow
的用法示例。
在下文中一共展示了WinWindow.Get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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 (TempFile tempFile = new TempFile(
@"<html>
<head>
<title>test</title>
</head>
<body>
<input type=""submit"" value=""Log In"" onclick=""alert('onclick');""/>
</body>
</html>"))
{
BrowserWindow.Launch(tempFile.FilePath);
var window = new BrowserWindowUnderTest("test");
HtmlInputButton button = window.Get<HtmlInputButton>("Value=Log In");
//Act
button.Click();
if (BrowserWindowUnderTest.GetCurrentBrowser() is InternetExplorer)
{
//read JavaScript alert text
WinWindow popup = new WinWindow("ClassName=#32770;Name=Message from webpage");
WinText text = popup.Get<WinText>();
Assert.AreEqual("onclick", text.DisplayText);
}
window.PerformDialogAction(BrowserDialogAction.Ok);
window.Close();
}
}