public void RegistracijaTusciaisLaukais() { BrowserWindow browser = BrowserWindow.FromProcess(proc); UITestControl uiSubmit = new UITestControl(browser); uiSubmit.TechnologyName = "Web"; uiSubmit.SearchProperties.Add("ControlType", "Button"); uiSubmit.SearchProperties.Add("Name", "submit"); UITestControl uiSignUp = new UITestControl(browser); uiSignUp.TechnologyName = "Web"; uiSignUp.SearchProperties.Add("ControlType", "Hyperlink"); uiSignUp.SearchProperties.Add("TagName", "A"); Mouse.Click(uiSignUp); Mouse.Click(uiSubmit); UITestControl uiUsername = new UITestControl(browser); uiUsername.TechnologyName = "Web"; uiUsername.SearchProperties.Add("ControlType", "Edit"); uiUsername.SearchProperties.Add("Id", "inputUsername"); uiUsername.SearchProperties.Add("Name", "user_username"); Keyboard.SendKeys(uiUsername, "Demo"); Mouse.Click(uiSubmit); UITestControl uiEmail = new UITestControl(browser); uiEmail.TechnologyName = "Web"; uiEmail.SearchProperties.Add("ControlType", "Edit"); uiEmail.SearchProperties.Add("Id", "inputEmail"); uiEmail.SearchProperties.Add("Name", "user_email"); Keyboard.SendKeys(uiEmail, "*****@*****.**"); Mouse.Click(uiSubmit); UITestControl uiPassword1 = new UITestControl(browser); uiPassword1.TechnologyName = "Web"; uiPassword1.SearchProperties.Add("ControlType", "Edit"); uiPassword1.SearchProperties.Add("Id", "inputPassword"); Keyboard.SendKeys(uiPassword1, "aaa"); Mouse.Click(uiSubmit); }
public void TestCalculatorThroughCode() { ApplicationUnderTest appObj = ApplicationUnderTest.Launch(@"D:\CSD\Projects\BillManagement\SampleCalculator\bin\Debug\SampleCalculator.exe"); Assert.AreEqual(appObj.Title, "MainWindow"); WinUWindow = new WpfWindow(); WinUWindow.SearchProperties[UITestControl.PropertyNames.Name] = "MainWindow"; WinUWindow.SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.ClassName, "HwndWrapper", PropertyExpressionOperator.Contains)); WinUWindow.WindowTitles.Add("MainWindow"); Keyboard.SendKeys(TextboxObject("textBox"), "2"); Keyboard.SendKeys(TextboxObject("textBox_Copy"), "1"); WpfComboBox comboObj = ComboBoxObject("comboBox"); comboObj.SelectedIndex = 1; Mouse.Click(ButtonObject("button")); var outVal = TextboxObject("textBox_Copy1").Text; Assert.AreEqual(outVal, "3"); }
public void TestUpdateDataGridView() { RunScriptOpenBack(); RunScriptOpenFront(); Robot.GetCurrentForm("formCustomer"); Robot.ClickButton("大麥克" + "\n" + "39元"); Robot.ClickButton("麥香魚" + "\n" + "75元"); Robot.AssertText("_labelTotal", "總計:114元"); Robot.GetCurrentForm("formEmployee"); Robot.ClickListViewByValue("_listBoxAllMeals", "大麥克"); Robot.ClickButton("_deleteMeal"); Robot.ClickListViewByValue("_listBoxAllMeals", "麥香魚"); Robot.SetEdit("_textBoxMealName", "Nigger"); Keyboard.SendKeys("{Enter}"); Robot.SetEdit("_textBoxMealPrice", "200"); Robot.SetComboBox("_comboBoxMealCategory", "甜點"); Robot.GetCurrentForm("formCustomer"); Robot.AssertText("_labelTotal", "總計:200元"); }
public void US1_OprettelseAfBrugerProfil() { // Arrange this.UIMap.NavigateToRegisterUser(); // Act this.UIMap.ClickEmailBox(); Keyboard.SendKeys("*****@*****.**"); this.UIMap.ClickPasswordBox(); Keyboard.SendKeys("tester1"); this.UIMap.ClickRepeatPasswordBox(); Keyboard.SendKeys("tester1"); this.UIMap.CheckAgreeToAllTerms(); this.UIMap.ClickRegister(); _dbContext.RemoveUser("*****@*****.**"); // Assert this.UIMap.AssertPageContainsLoginText(); }
/// <summary> /// Log into System Successfully /// </summary> public void LoginSuccess() { #region Variable Declarations WinCustom uIItemCustom = this.UIC4SerializationAppliWindow.UIItemWindow1.UIItemCustom; WinControl uIItemDocument = this.UIC4SerializationAppliWindow.UIItemWindow1.UIItemDocument; #endregion // Click custom control Mouse.Click(uIItemCustom, new Point(114, 16)); // Type 'jleung{Tab}' in custom control Keyboard.SendKeys(uIItemCustom, this.LoginSuccessParams.UIItemCustomSendKeys, ModifierKeys.None); // Type '1234{+}five' in custom control Keyboard.SendKeys(uIItemCustom, this.LoginSuccessParams.UIItemCustomSendKeys1, ModifierKeys.None); // Click document Mouse.Click(uIItemDocument, new Point(242, 351)); }
/// <summary> /// add 1 to cell A1 /// </summary> public void UIBasicTest1() { #region Variable Declarations WinClient uISpreadsheetPanel1Client = this.UIYexcelWindow.UIItemWindow.UISpreadsheetPanel1Client; WinEdit uITextBox_contentEdit = this.UIYexcelWindow.UITextBox_contentWindow.UITextBox_contentEdit; #endregion // Launch '%USERPROFILE%\Visual Studio 2013\Projects\PS6\SpreadsheetGUI\bin\Debug\SpreadsheetGUI.exe' ApplicationUnderTest uIYexcelWindow = ApplicationUnderTest.Launch(this.UIBasicTest1Params.UIYexcelWindowExePath, this.UIBasicTest1Params.UIYexcelWindowAlternateExePath); // Click 'spreadsheetPanel1' client Mouse.Click(uISpreadsheetPanel1Client, new Point(94, 38)); // Type '1' in 'textBox_content' text box uITextBox_contentEdit.Text = this.UIBasicTest1Params.UITextBox_contentEditText; // Type '{Enter}' in 'textBox_content' text box Keyboard.SendKeys(uITextBox_contentEdit, this.UIBasicTest1Params.UITextBox_contentEditSendKeys, ModifierKeys.None); }
/// <summary> /// RecordedMethod2 - Use 'RecordedMethod2Params' to pass parameters into this method. /// </summary> public void RecordedMethod2() { #region Variable Declarations WinEdit uIAddressandsearchusinEdit = this.UINewtabInternetExplorWindow.UIAddressandsearchusinWindow.UIAddressandsearchusinEdit; WinEdit uIItemEdit = this.UINewtabInternetExplorWindow.UIItemWindow.UIItemEdit; #endregion // Go to web page 'about:Tabs' using new browser instance this.UINewtabInternetExplorWindow.LaunchUrl(new System.Uri(this.RecordedMethod2Params.UINewtabInternetExplorWindowUrl)); // Click 'Address and search using Bing' text box Mouse.Click(uIAddressandsearchusinEdit, new Point(241, 9)); // Type 'http{RShiftKey}://tailspinpaasdeploy.azurewebsites' in text box Keyboard.SendKeys(uIItemEdit, this.RecordedMethod2Params.UIItemEditSendKeys, ModifierKeys.None); // Type '.net{Enter}' in text box Keyboard.SendKeys(uIItemEdit, this.RecordedMethod2Params.UIItemEditSendKeys1, ModifierKeys.None); }
public Boolean _Navigate(object fpObj, string sLabelName, int iSearchMax) { string sFunctionName = "_Navigate"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); Boolean bFind = false; string sCurrentLabel = ""; if (iSearchMax == 0) { iSearchMax = 100; } for (int i = 1; i <= iSearchMax; i++) { sCurrentLabel = this._ReturnSelectRowContent(fpObj); if (sCurrentLabel == sLabelName) { bFind = true; break; } else { Keyboard.SendKeys((WinClient)fpObj, "{Down}"); } } if (bFind) { _gLib._Report(_PassFailStep.Pass, "Function <" + sFunctionName + "> successfully navigate to :" + sLabelName); } else { _gLib._Report(_PassFailStep.Pass, "Function <" + sFunctionName + "> Failed to navigate to :" + sLabelName + "or reach to Maximum search range: " + iSearchMax); _gLib._MsgBoxYesNo("Continue Testing?", "Fail: Function: <" + sFunctionName + "> Failed to navigate to :" + sLabelName + " or reach to Maximum search range: " + iSearchMax); } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends"); return(bFind); }
/// <summary> /// RecordedMethod1 - Use 'RecordedMethod1Params' to pass parameters into this method. /// </summary> public void RecordedMethod1() { #region Variable Declarations WinControl uIChromeLegacyWindowDocument = this.UIHomePageQueryBuilderWindow.UIChromeLegacyWindowWindow.UIChromeLegacyWindowDocument; #endregion // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument, new Point(179, 417)); // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument, new Point(1189, 19)); // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument, new Point(1189, 19)); // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument, new Point(14, 22)); // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument, new Point(14, 22)); // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument, new Point(176, 254)); // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument, new Point(163, 240)); // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument, new Point(669, 359)); // Type '{Back}' in 'Chrome Legacy Window' document Keyboard.SendKeys(uIChromeLegacyWindowDocument, this.RecordedMethod1Params.UIChromeLegacyWindowDocumentSendKeys, ModifierKeys.None); // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument, new Point(754, 353)); // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument, new Point(751, 594)); // Click 'Chrome Legacy Window' document Mouse.Click(uIChromeLegacyWindowDocument, new Point(800, 293)); }
public void _ts_PasteValue(string sValue, Boolean bFrom2Row = false) { string sFunctionName = "_ts_PasteValue"; _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Starts:"); _gLib._SendKeysUDWin("", this.wRetirementStudio.wEntrySetup.grid, "{Home}{Home}", 0, ModifierKeys.Control, false); _gLib._SendKeysUDWin("", this.wRetirementStudio.wEntrySetup.grid, "{PageUp}{PageUp}{PageUp}{PageUp}", 0); _gLib._SendKeysUDWin("", this.wRetirementStudio.wEntrySetup.grid, "{PageUp}", 0); _gLib._SendKeysUDWin("", this.wRetirementStudio.wEntrySetup.grid, "{PageUp}", 0); if (bFrom2Row) { _gLib._SetSyncUDWin("Entry Setup", this.wRetirementStudio.wEntrySetup.grid, "Click", 0, false, 108, 50); } else { _gLib._SetSyncUDWin("Entry Setup", this.wRetirementStudio.wEntrySetup.grid, "Click", 0, false, 108, 30); } if (!_gLib._Exists("Table Field", this.wRetirementStudio.wTableField.txt, 3, false)) { _gLib._MsgBox("Warning", "Table field is NOT activated, please manually activate the first cell can type Ctrl-V to paste value"); } else { Clipboard.Clear(); Clipboard.SetText(sValue); try { Keyboard.SendKeys(this.wRetirementStudio.wTableField.txt, "v", ModifierKeys.Control); } catch (Exception ex) { _gLib._Report(_PassFailStep.Fail, "\t\tFunction <" + sFunctionName + "> fail to send Keys. Because of Exception thrown: " + Environment.NewLine + ex.Message); _gLib._MsgBoxYesNo("Continue Testing?", "Fail: Function <" + sFunctionName + "> fail to send Keys. Because of Exception thrown: " + Environment.NewLine + ex.Message); } } _gLib._Report(_PassFailStep.Step, "Function <" + sFunctionName + "> Ends:"); }
public void EnterWorkflowCategory(string categoryName) { #region Variable Declarations WinWindow uIServiceDetailsWindow1 = StudioWindow.GetChildren()[0] as WinWindow; #endregion int l1 = uIServiceDetailsWindow1.BoundingRectangle.Left; int t1 = uIServiceDetailsWindow1.BoundingRectangle.Top; Point toClick = new Point(l1 + 185, t1 + 138); // Ack :< Required due to lack of Workflow Inspectibility // Click 'Service Details' window Mouse.Click(toClick); // Clear any existing Category Mouse.DoubleClick(); SendKeys.SendWait("{DELETE}"); // Type 'CodedUITestCategory' in 'Service Details' window Keyboard.SendKeys(uIServiceDetailsWindow1, categoryName, ModifierKeys.None); }
public void SimpleWebTest() { //open the default browser and navigate to a web page - blog.falafel.com BrowserWindow browser = BrowserWindow.Launch(new Uri("http://blog.falafel.com")); //we can use controls as a way to narrow down the search for other controls var headerSection = browser.SearchFor <HtmlCustom>(new { TagName = "HEADER" }); //let's search for something var searchIcon = headerSection.SearchFor <HtmlHyperlink>(new { href = "http://blog.falafel.com/#searchbox" }); Mouse.Click(searchIcon); var searchInput = browser.SearchFor <HtmlEdit>(new { name = "s" }, new { type = "INPUT" }); searchInput.Text = "treats and tricks"; Keyboard.SendKeys("{ENTER}"); //find our searched for item var postToLookFor = browser.SearchFor <HtmlCustom>(new { TagName = "ARTICLE" }, new { InnerText = "31 Days of Visual Studio 2015 Tricks and Treats Blog Post" }); //validate our search Assert.IsTrue(postToLookFor.Exists); }
/// <summary> /// RecordedMethod1 - Use 'RecordedMethod1Params' to pass parameters into this method. /// </summary> public void RecordedMethod1() { #region Variable Declarations WinEdit uITbPraeteritumEdit = this.UIStarkeundunregelmäßiWindow.UITbPraeteritumWindow.UITbPraeteritumEdit; WinEdit uITbPerfektEdit = this.UIStarkeundunregelmäßiWindow.UITbPerfektWindow.UITbPerfektEdit; WinButton uIOKButton = this.UIStarkeundunregelmäßiWindow.UIOKWindow.UIOKButton; #endregion // Type 'zog' in 'tbPraeteritum' text box uITbPraeteritumEdit.Text = this.RecordedMethod1Params.UITbPraeteritumEditText; // Type '{Tab}' in 'tbPraeteritum' text box Keyboard.SendKeys(uITbPraeteritumEdit, this.RecordedMethod1Params.UITbPraeteritumEditSendKeys, ModifierKeys.None); // Type 'gezogen' in 'tbPerfekt' text box uITbPerfektEdit.Text = this.RecordedMethod1Params.UITbPerfektEditText; // Click 'Ok' button Mouse.Click(uIOKButton, new Point(88, 11)); }
/// <summary> /// mtr - Используйте "mtrParams" для передачи параметров в этот метод. /// </summary> public void mtr() { #region Variable Declarations WinComboBox uI_beginDateComboBox = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UI_beginDateWindow.UI_beginDateComboBox; WinComboBox uI_endDateComboBox = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UI_endDateWindow.UI_endDateComboBox; WinEdit uI_beginDateEdit = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UIItemComboBox.UI_beginDateEdit; WinEdit uI_endDateEdit = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UIItemComboBox1.UI_endDateEdit; #endregion // Тип "{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}" в "_beginDate" поле со списком Keyboard.SendKeys(uI_beginDateComboBox, this.mtrParams.UI_beginDateComboBoxSendKeys, ModifierKeys.None); // Тип "{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}" в "_endDate" поле со списком Keyboard.SendKeys(uI_endDateComboBox, this.mtrParams.UI_endDateComboBoxSendKeys, ModifierKeys.None); Keyboard.SendKeys(uI_beginDateComboBox, "01.06.2018"); // Тип "{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}{Back}" в "_endDate" поле со списком Keyboard.SendKeys(uI_endDateComboBox, "07.06.2018"); }
/// <summary> /// LoginToCL - Use 'LoginToCLParams' to pass parameters into this method. /// </summary> public void LoginToCL() { #region Variable Declarations WpfEdit uIItemEdit = this.UIConciergeLinkWindow.UIItemCustom.UIContentScrollViewerPane.UIUserNameText.UIItemEdit; WpfEdit uIItemEdit1 = this.UIConciergeLinkWindow.UIItemCustom.UIContentScrollViewerPane.UIPasswordText.UIItemEdit; WpfButton uILogInButton = this.UIConciergeLinkWindow.UIItemCustom.UIContentScrollViewerPane.UILogInButton; #endregion // Type 'itechdev' in first text box next to 'User Name' label uIItemEdit.Text = this.LoginToCLParams.UIItemEditText; // Click first text box next to 'Password' label Mouse.Click(uIItemEdit1, new Point(38, 31)); // Type '********' in first text box next to 'Password' label Keyboard.SendKeys(uIItemEdit1, this.LoginToCLParams.UIItemEditSendKeys, true); // Click 'Log In' button Mouse.Click(uILogInButton, new Point(137, 32)); }
/// <summary> /// RecordedMethod1 - Use 'RecordedMethod1Params' to pass parameters into this method. /// </summary> public void RecordedMethod1() { #region Variable Declarations WpfEdit uITbNameEdit = this.UIMainWindowWindow.UITbNameEdit; WpfEdit uITbIdEdit = this.UIMainWindowWindow.UITbIdEdit; WpfButton uISubmitButton = this.UIMainWindowWindow.UISubmitButton; #endregion this.RecordedMethod1Params.GenerateNewValues(); // Type 'Prateek' in 'tbName' text box uITbNameEdit.Text = this.RecordedMethod1Params.UITbNameEditText; // Type '{Tab}' in 'tbName' text box Keyboard.SendKeys(uITbNameEdit, this.RecordedMethod1Params.UITbNameEditSendKeys, ModifierKeys.None); // Type '101010' in 'tbId' text box uITbIdEdit.Text = this.RecordedMethod1Params.UITbIdEditText; // Click 'Submit' button Mouse.Click(uISubmitButton, new Point(321, 32)); }
/// <summary> /// RecordedMethod1 - Use 'RecordedMethod1Params' to pass parameters into this method. /// </summary> public void RecordedMethod1() { #region Variable Declarations WinComboBox uIOpenComboBox = this.UIRunWindow.UIItemWindow.UIOpenComboBox; WinEdit uIOpenEdit = this.UIRunWindow.UIItemWindow1.UIOpenEdit; WinButton uICloseButton = this.UIUntitledNotepadWindow.UIUntitledNotepadTitleBar.UICloseButton; #endregion // Press keyboard shortcut keys 'Windows + r' Keyboard.SendKeys(this.RecordedMethod1Params.SendKeys, ModifierKeys.Windows); // Select 'notepad' in 'Open:' combo box uIOpenComboBox.EditableItem = this.RecordedMethod1Params.UIOpenComboBoxEditableItem; // Type '{Enter}' in 'Open:' text box Keyboard.SendKeys(uIOpenEdit, this.RecordedMethod1Params.UIOpenEditSendKeys, ModifierKeys.None); // Click 'Close' button Mouse.Click(uICloseButton, new Point(18, 9)); }
/// <summary> /// LoginWinApp - Use 'LoginWinAppParams' to pass parameters into this method. /// </summary> public void LoginWinApp() { #region Variable Declarations WinEdit uITxtUserEdit = this.UILoginWindow.UITxtUserWindow.UITxtUserEdit; WinEdit uITxtPwdEdit = this.UILoginWindow.UITxtPwdWindow.UITxtPwdEdit; WinButton uILoginButton = this.UILoginWindow.UILoginWindow1.UILoginButton; #endregion // Type 'shalaka' in 'txtUser' text box uITxtUserEdit.Text = this.LoginWinAppParams.UITxtUserEditText; // Type '{Tab}' in 'txtUser' text box Keyboard.SendKeys(uITxtUserEdit, this.LoginWinAppParams.UITxtUserEditSendKeys, ModifierKeys.None); // Type '********' in 'txtPwd' text box Keyboard.SendKeys(uITxtPwdEdit, this.LoginWinAppParams.UITxtPwdEditSendKeys, true); // Click 'Login' button Mouse.Click(uILoginButton, new Point(39, 16)); }
public void Login1() { BrowserWindow.CurrentBrowser = "chrome"; bw = BrowserWindow.Launch(new Uri("https://*****:*****@rmms.co.za"); Keyboard.SendKeys(txtPassword, "Fgx1234!"); Mouse.Click(btnLogin); // SelectBusinessPartner(); }
/// <summary> /// Logs in user /// </summary> public void LogInTest() { #region Variable Declarations WinEdit uIUsernameEdit = this.UILogInMozillaFirefoxWindow.UILogInDocument.UIUsernameEdit; WinEdit uIPasswordEdit = this.UILogInMozillaFirefoxWindow.UILogInDocument.UIPasswordEdit; WinButton uILOGINButton = this.UILogInMozillaFirefoxWindow.UILogInDocument.UILOGINButton; #endregion // Type 'krzesimir' in 'Username:'******'Password:'******'********' in 'Password:'******'LOG IN' button Mouse.Click(uILOGINButton, new Point(98, 33)); }
/// <summary> /// Standart - Используйте "StandartParams" для передачи параметров в этот метод. /// </summary> public void Standart() { #region Variable Declarations WinEdit uITextBoxOp1Edit = this.UIForm1Window.UITextBoxOp1Window.UITextBoxOp1Edit; WinEdit uITextBoxOp2Edit = this.UIForm1Window.UITextBoxOp2Window.UITextBoxOp2Edit; WinButton uIItemButton = this.UIForm1Window.UIItemWindow1.UIItemButton; #endregion // Тип "2" в "textBoxOp1" надпись uITextBoxOp1Edit.Text = this.StandartParams.UITextBoxOp1EditText; // Тип "3" в "textBoxOp2" надпись uITextBoxOp2Edit.Text = this.StandartParams.UITextBoxOp2EditText; // Тип "{Tab}" в "textBoxOp2" надпись Keyboard.SendKeys(uITextBoxOp2Edit, this.StandartParams.UITextBoxOp2EditSendKeys, ModifierKeys.None); // Тип "{Enter}" в "/" кнопка Keyboard.SendKeys(uIItemButton, this.StandartParams.UIItemButtonSendKeys, ModifierKeys.None); }
public void FormLoginKH_MatKhauRong() { Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.Disabled; Playback.PlaybackSettings.DelayBetweenActions = 500; Playback.PlaybackSettings.SearchTimeout = 10000; try { BrowserWindow browser = BrowserWindow.Launch("http://localhost:12742/"); browser.Maximized = true; browser.DrawHighlight(); //Playback.Wait(5000); UITestControl btnLogin = new UITestControl(browser); btnLogin.TechnologyName = "MSAA"; btnLogin.SearchProperties.Add("Name", "Đăng nhập"); btnLogin.SearchProperties.Add("ControlType", "Edit"); btnLogin.DrawHighlight(); Mouse.Click(btnLogin); //Playback.Wait(500); UITestControl txtTen = new UITestControl(browser); txtTen.TechnologyName = "MSAA"; txtTen.SearchProperties.Add("Name", "Nhập tài khoản ..."); txtTen.SearchProperties.Add("ControlType", "Edit"); txtTen.DrawHighlight(); Keyboard.SendKeys(txtTen, "admin"); UITestControl btnDangNhap = new UITestControl(browser); btnDangNhap.TechnologyName = "MSAA"; btnDangNhap.SearchProperties.Add("Name", "Đăng nhập"); btnDangNhap.SearchProperties.Add("ControlType", "Button"); btnDangNhap.DrawHighlight(); Mouse.Click(btnDangNhap); Playback.Wait(1000); } catch (Exception e) { Assert.Fail(e.ToString()); } }
public void EjecucionBasicaTest() { ProcessStartInfo start = new ProcessStartInfo(); start.FileName = @"C:\Users\FEDE\AppData\Local\Temp\basica.exe"; using (ApplicationUnderTest app = ApplicationUnderTest.Launch(start)) { app.SetFocus(); Keyboard.SendKeysDelay = 2000; //2 segundos //Keyboard.SendKeys("5"); Keyboard.SendKeys("{ENTER}"); } string resultado = ObtenerResultadoArchivo(); Assert.IsTrue(resultado == ""); }
/// <summary> /// Realiza la búsqueda avanazada de un artículo /// </summary> /// <param name="article"><see cref="Article"/></param> /// <returns><see cref="ResultsSearch"/></returns> public ResultsSearch SearchArticle(Article article) { // Ingresa la palabra clave Keyboard.SendKeys(UISearchAdvancedPage.Body.KeyWordArticle, article.KeyWord); // Selecciona la categoría Mouse.Click(UISearchAdvancedPage.Body.Category); HtmlControl bodyElement = new HtmlControl(UISearchAdvancedPage.Body); bodyElement.SearchProperties[HtmlControl.PropertyNames.TagName] = "option"; bodyElement.SearchProperties.Add(HtmlControl.PropertyNames.InnerText, article.Category, PropertyExpressionOperator.Contains); HtmlControl categoryElement = (HtmlControl)bodyElement.FindMatchingControls().FirstOrDefault(); Keyboard.SendKeys(categoryElement, categoryElement.InnerText); Keyboard.SendKeys(categoryElement, "{ESCAPE}"); // Hace clic en el botón buscar Mouse.Click(UISearchAdvancedPage.Body.ContainerSearch.ButtonSearch); return(new ResultsSearch()); }
/// <summary> /// RecordedMethod1 - Use 'RecordedMethod1Params' to pass parameters into this method. /// </summary> public void RecordedMethod1() { #region Variable Declarations WinEdit uIItemEdit = this.UIMotorolaMODFactoryTeWindow.UIItemWindow.UIItemEdit; #endregion // Launch 'C:\prod\SNAP\LEFT\ModFactoryTestUI.exe' ApplicationUnderTest uIMotorolaMODFactoryTeWindow = ApplicationUnderTest.Launch(this.RecordedMethod1Params.UIMotorolaMODFactoryTeWindowExePath, this.RecordedMethod1Params.UIMotorolaMODFactoryTeWindowAlternateExePath); // Type '0000000001' in text box uIItemEdit.Text = this.RecordedMethod1Params.UIItemEditText; // Type '{Enter}' in text box Keyboard.SendKeys(uIItemEdit, this.RecordedMethod1Params.UIItemEditSendKeys, ModifierKeys.None); // Type '1111111111' in text box uIItemEdit.Text = this.RecordedMethod1Params.UIItemEditText1; // Type '' in text box uIItemEdit.Text = this.RecordedMethod1Params.UIItemEditText2; }
/// <summary> /// Initial sample of UI auotmation via VS /// </summary> public void PersonEntrySample() { #region Variable Declarations WinEdit uINameEdit = this.UIDebugWindow.UIItemWindow.UISampleAppexeListItem.UINameEdit; WpfEdit uIItemEdit = this.UIPersonEntryWindow.UIPersonalDetailsGroup.UIGivenNameText.UIItemEdit; WinList uIItemsViewList = this.UIDebugWindow.UIShellViewWindow.UIShellViewClient.UIItemsViewList; WpfButton uISaveButton = this.UIPersonEntryWindow.UISaveButton; #endregion // Double-Click 'Name' text box Mouse.DoubleClick(uINameEdit, new Point(40, 10)); // Click first text box next to 'Given Name' label Mouse.Click(uIItemEdit, new Point(143, 16)); // Type 'Lee{Tab}{Tab}Campe{Back}bell{Tab}' in 'Items View' list box Keyboard.SendKeys(uIItemsViewList, this.PersonEntrySampleParams.UIItemsViewListSendKeys, ModifierKeys.None); // Click 'Save' button Mouse.Click(uISaveButton, new Point(70, 16)); }
public void EjecucionEjecucionMientrasTest() { ProcessStartInfo start = new ProcessStartInfo(); start.FileName = @"C:\Users\FEDE\AppData\Local\Temp\ejecucionMientrasTest.exe"; using (ApplicationUnderTest app = ApplicationUnderTest.Launch(start)) { app.SetFocus(); Keyboard.SendKeysDelay = 1000; //2 segundos Keyboard.SendKeys("{ENTER}"); } string resultado = ObtenerResultadoArchivo(); Assert.IsTrue(!resultado.Contains("ERROR")); }
/// <summary> /// EnterSelectText - Use 'EnterSelectTextParams' to pass parameters into this method. /// </summary> public void EnterSelectText() { #region Variable Declarations UITestControl uIDocument1Document = this.UIDocument1MicrosoftWoWindow.UIMicrosoftWordDocumenWindow.UIDocument1Document; #endregion // Type 'The ' in 'Document1' document Keyboard.SendKeys(uIDocument1Document, this.EnterSelectTextParams.UIDocument1DocumentSendKeys, ModifierKeys.None); // Type '{LShiftKey}' in 'Document1' document Keyboard.SendKeys(uIDocument1Document, this.EnterSelectTextParams.UIDocument1DocumentSendKeys1, ModifierKeys.None); // Type 'Coded UI Word 2010 Add-in will record this text and execute an assertion on the ' in 'Document1' document Keyboard.SendKeys(uIDocument1Document, this.EnterSelectTextParams.UIDocument1DocumentSendKeys2, ModifierKeys.None); // Type 'selected text.{Left}{Left}{Left}{Left}{Left}{Left}' in 'Document1' document Keyboard.SendKeys(uIDocument1Document, this.EnterSelectTextParams.UIDocument1DocumentSendKeys3, ModifierKeys.None); // Type 'Control, Shift + {Left}' in 'Document1' document Keyboard.SendKeys(uIDocument1Document, this.EnterSelectTextParams.UIDocument1DocumentSendKeys4, (ModifierKeys.Control | ModifierKeys.Shift)); }
/// <summary> /// Einsatz_Erstellen - Verwenden Sie "Einsatz_ErstellenParams", um Parameter an diese Methode zu übergeben. /// </summary> public void Einsatz_Erstellen() { #region Variable Declarations WinListItem uIM120LB2FS16ListItem = this.UIDebugWindow.UIItemWindow.UIElementansichtList.UIM120LB2FS16ListItem; WinEdit uINameEdit = this.UIDebugWindow.UIItemWindow.UIM120LB2FS16ListItem.UINameEdit; WpfButton uINeuButton = this.UIMainWindowWindow.UINeuButton; WpfComboBox uIMitarbeiterComboBox = this.UIEinzelAnsichtWindow.UIMitarbeiterComboBox; WpfDatePicker uIDatumDatePicker = this.UIEinzelAnsichtWindow.UIDatumDatePicker; WpfEdit uIStart_zeitEdit = this.UIEinzelAnsichtWindow.UIStart_zeitEdit; WpfEdit uIEnd_zeitEdit = this.UIEinzelAnsichtWindow.UIEnd_zeitEdit; WpfButton uISpeichernButton = this.UIEinzelAnsichtWindow.UISpeichernButton; #endregion // "Alt + p" in "M120-LB2-FS16" Listenelement eingeben Keyboard.SendKeys(uIM120LB2FS16ListItem, this.Einsatz_ErstellenParams.UIM120LB2FS16ListItemSendKeys, ModifierKeys.Alt); // Doppelklicken "Name" Textfeld Mouse.DoubleClick(uINameEdit, new Point(128, 9)); // Klicken "Neu" Schaltfläche Mouse.Click(uINeuButton, new Point(28, 6)); // "Anton Affolter" in "mitarbeiter" Kombinationsfeld auswählen uIMitarbeiterComboBox.SelectedItem = this.Einsatz_ErstellenParams.UIMitarbeiterComboBoxSelectedItem; // "06-Jun-2016" in "datum" Datumsauswahl auswählen uIDatumDatePicker.DateAsString = this.Einsatz_ErstellenParams.UIDatumDatePickerDateAsString; // "08:00" in "start_zeit" Textfeld eingeben uIStart_zeitEdit.Text = this.Einsatz_ErstellenParams.UIStart_zeitEditText; // "{Tab}" in "start_zeit" Textfeld eingeben Keyboard.SendKeys(uIStart_zeitEdit, this.Einsatz_ErstellenParams.UIStart_zeitEditSendKeys, ModifierKeys.None); // "15:00" in "end_zeit" Textfeld eingeben uIEnd_zeitEdit.Text = this.Einsatz_ErstellenParams.UIEnd_zeitEditText; // Klicken "Speichern" Schaltfläche Mouse.Click(uISpeichernButton, new Point(56, 8)); }
/// <summary> /// RecordedMethod333 - Используйте "RecordedMethod333Params" для передачи параметров в этот метод. /// </summary> public void RecordedMethod333() { #region Variable Declarations WinComboBox uIПопривязкепациентовкComboBox = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UIПопривязкепациентовкWindow.UIПопривязкепациентовкComboBox; WinEdit uIFilterCombo_EmbeddabEdit = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UIFilterCombo_EmbeddabWindow.UIFilterCombo_EmbeddabEdit; WinComboBox uIВсеComboBox = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UIВсеWindow.UIВсеComboBox; WinEdit uI_conditionCombo_EmbeEdit = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UI_conditionCombo_EmbeWindow.UI_conditionCombo_EmbeEdit; WinComboBox uIТолькопрошедшиеComboBox = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UIВсеWindow.UIТолькопрошедшиеComboBox; WinEdit uI_conditionCombo_EmbeEdit1 = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UI_conditionCombo_EmbeWindow.UI_conditionCombo_EmbeEdit1; WinButton uIПолучитьданныеButton = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UIПолучитьданныеWindow.UIПолучитьданныеButton; #endregion Keyboard.SendKeys(uIПопривязкепациентовкComboBox, "{Down}"); Keyboard.SendKeys(uIВсеComboBox, "{Down}"); // Щелкните "Получить данные" кнопка Mouse.Click(uIПолучитьданныеButton, new Point(71, 19)); }