当前位置: 首页>>代码示例>>C#>>正文


C# Screen.Type方法代码示例

本文整理汇总了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);
        }
开发者ID:nvega-ms,项目名称:SikuliDotNetExample,代码行数:57,代码来源:TestClass.cs

示例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;
 }
开发者ID:OVRLab,项目名称:SeleniumPP,代码行数:14,代码来源:IDesktop.cs


注:本文中的Screen.Type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。