本文整理汇总了C#中Screen.Type方法的典型用法代码示例。如果您正苦于以下问题:C# Screen.Type方法的具体用法?C# Screen.Type怎么用?C# Screen.Type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Screen
的用法示例。
在下文中一共展示了Screen.Type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LogInTest
public void LogInTest()
{
//Screen
Screen loginPage = new Screen();
//Pattern
Pattern nextButton = new Pattern(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + @"Images\nextButton.png"));
Pattern userNameInput = new Pattern(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + @"Images\emailInput.png"));
Pattern userPassInput = new Pattern(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + @"Images\passwordInput.png"));
Pattern signInButton = new Pattern(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + @"Images\signInButton.png"));
//Waiting until the user name input is present
loginPage.Wait(userNameInput);
//Setting user name and password
loginPage.Type(userNameInput, "[email protected]", KeyModifier.NONE);
//Clicking on the Next button
loginPage.Click(nextButton);
//Waiting until the password input is present
loginPage.Wait(userPassInput);
//Setting user name and password
loginPage.Type(userPassInput, "123456789abcd!", KeyModifier.NONE);
//Clicking on the "Sign in" button
loginPage.Click(signInButton);
//Drag and drop
//Screen
Screen gmailPage = new Screen();
Pattern moreIcon = new Pattern(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + @"Images\moreApp.png"));
Pattern driveIcon = new Pattern(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + @"Images\driveIcon.png"));
Pattern trashOption = new Pattern(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + @"Images\trashOption.png"));
Pattern pdfFile = new Pattern(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + @"Images\pdfFile.png"));
//Clicking on the more icon
gmailPage.Wait(moreIcon);
gmailPage.Click(moreIcon);
//Waiting Drive icon
gmailPage.Wait(driveIcon);
//Clicking on the Drive Icon
gmailPage.Click(driveIcon);
//Waiting elements
gmailPage.Wait(pdfFile,40);
gmailPage.Wait(trashOption);
gmailPage.DragDrop(pdfFile, trashOption);
}
示例2: Type
public bool Type(string pattern_path, Point offset, string text,double similar = 0.5)
{
Pattern pattern = new Pattern(pattern_path, offset, similar);
Screen scrn = new Screen();
try
{
scrn.Type(pattern, text);
}
catch
{
return false;
}
return true;
}