/// <summary> /// EntercustomerdetailsFirstNameLastNameStreetCityStateZip - Test Case 244 - Use 'EntercustomerdetailsFirstNameLastNameStreetCityStateZipParams' to pass parameters into this method. /// </summary> public void EntercustomerdetailsFirstNameLastNameStreetCityStateZip() { #region Variable Declarations HtmlEdit uIFirstNameEdit = this.UICreateWindowsInterneWindow.UICreateDocument.UIFirstNameEdit; HtmlEdit uILastNameEdit = this.UICreateWindowsInterneWindow.UICreateDocument.UILastNameEdit; HtmlEdit uIStreetEdit = this.UICreateWindowsInterneWindow.UICreateDocument.UIStreetEdit; HtmlEdit uICityEdit = this.UICreateWindowsInterneWindow.UICreateDocument.UICityEdit; HtmlEdit uIStateEdit = this.UICreateWindowsInterneWindow.UICreateDocument.UIStateEdit; HtmlEdit uIZipEdit = this.UICreateWindowsInterneWindow.UICreateDocument.UIZipEdit; HtmlCustom uIItemCustom = this.UICreateWindowsInterneWindow.UICreateDocument.UIContentCustom.UIItemCustom; #endregion // Type 'Brian' in 'First Name' text box uIFirstNameEdit.Text = this.EntercustomerdetailsFirstNameLastNameStreetCityStateZipParams.UIFirstNameEditText; // Type 'Keller' in 'Last Name' text box uILastNameEdit.Text = this.EntercustomerdetailsFirstNameLastNameStreetCityStateZipParams.UILastNameEditText; // Type '361 North Avenue' in 'Street' text box uIStreetEdit.Text = this.EntercustomerdetailsFirstNameLastNameStreetCityStateZipParams.UIStreetEditText; // Type 'Redmond' in 'City' text box uICityEdit.Text = this.EntercustomerdetailsFirstNameLastNameStreetCityStateZipParams.UICityEditText; // Type 'WA' in 'State' text box uIStateEdit.Text = this.EntercustomerdetailsFirstNameLastNameStreetCityStateZipParams.UIStateEditText; // Type '98052' in 'Zip' text box uIZipEdit.Text = this.EntercustomerdetailsFirstNameLastNameStreetCityStateZipParams.UIZipEditText; // Click custom control Mouse.Click(uIItemCustom, new Point(199, 586)); }
public void CodedUITestMethod1() { var testPage = Path.Combine(TestContext.DeploymentDirectory, "HTMLPage1.html"); var window = BrowserWindow.Launch(testPage); // run script before Coded UI interaction to show document.all.item(...) returns a single object window.ExecuteScript("foo();"); window.CaptureImage().Save(Path.Combine(TestContext.DeploymentDirectory, "00-before.png"), ImageFormat.Png); TestContext.AddResultFile("00-before.png"); // Use Coded UI to Find a control but not interact with it var radioButton = new HtmlRadioButton(window); radioButton.SearchProperties.Add(HtmlControl.PropertyNames.Id, "a"); radioButton.Find(); // run script after Coded UI interaction to show document.all.item(...) now returns an array of length 1 window.ExecuteScript("foo();"); window.CaptureImage().Save(Path.Combine(TestContext.DeploymentDirectory, "01-after.png"), ImageFormat.Png); TestContext.AddResultFile("01-after.png"); var p = new HtmlCustom(window); p.SearchProperties.Add(HtmlControl.PropertyNames.Id, "p"); StringAssert.DoesNotMatch(p.InnerText, new Regex(@"\.checked : undefined")); }
private static HtmlCustom GetHtmlCustom(string uiTitle, string uiType) { dynamic htmlControl = new HtmlCustom(Browser.Locate(uiTitle, uiType)); htmlControl.TechnologyName = TechnologyNameWeb; return(htmlControl); }
public void SavedSettingsAreRestoredAfterLogin() { const string firstName = "Mike"; const string lastName = "Pav"; this.accountSettingsPageObject.FirstName = firstName; this.accountSettingsPageObject.LastName = lastName; this.accountSettingsPageObject.ClickSave(); this.accountSettingsPageObject.FirstName = ""; this.accountSettingsPageObject.LastName = ""; // duplicate nav definition HtmlCustom nav = new HtmlCustom(window); nav.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "nav"); HtmlButton loginButton = new HtmlButton(nav); loginButton.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, "Login"); Mouse.Click(loginButton); // need access to the login page in account settings tests! // Yuck, how to deal with this? var loginPage = new LoginPageObject(this.window); loginPage.Username = this.newUsername; loginPage.Password = this.newPassword; var newReferenceToAccountSettings = loginPage.ClickLoginButton(); Assert.IsTrue(StringComparer.Ordinal.Equals(firstName, newReferenceToAccountSettings.FirstName)); Assert.IsTrue(StringComparer.Ordinal.Equals(lastName, newReferenceToAccountSettings.LastName)); }
public ProjectGanttWindow(MicrosoftDynamics365Window bw) { m_bw = bw; ProjectGanttDocument doc = m_bw.MicrosoftDynamics365Document.MainContentAreaFrame.ProjectGanttDocument; m_filterButton = doc.FilterButton.ItemPane; m_saveChangesButtonPane = doc.SaveButton.SavePane; m_expandAllButtonPane = doc.ExpandAllButton.ExpandAllPane; m_collapseAllButtonPane = doc.CollapseAllButton.CollapseallPane; m_geveePane = doc.GanttBasePane.GeveePane; m_addNewProjectPane = doc.AddNewProjectCustom.AddnewprojectPane; m_newProjectPane = doc.GanttBasePane.NewProjectPane; m_addChildTaskPane = doc.AddChildTaskCustom.AddChildTaskPane; m_projectItemEdit = doc.EditProjectTaskWindowPane.ItemEdit; m_projectOkLabel = doc.EditProjectTaskWindowPane.OKLabel; m_resourceCategoryPane = doc.EditProjectTaskResourceRolePane.ItemPane; m_developerJuniorPane = doc.DeveloperJuniorPane; m_itemStatusPane = doc.ItemStatusPane; m_chargeableCustom = doc.ChargeableCustom; m_projectNameEdit = doc.PromxCreateNewProjPane.ProjectNameItemEdit; m_selectBillingTypePane = doc.PromxCreateNewProjPane.SelectBillingTypePane; m_OKButton = doc.PromxCreateNewProjPane.OKButton; m_itemPane1 = doc.UIPromx_create_new_proPane1.ProjectManagerItemPane; m_itemEdit1 = doc.ItemEdit; m_itemCustom = doc.ItemCustom; m_itemCustom1 = doc.ItemCustom1; m_userNamePane = doc.UserNamePane; m_addButton = doc.AddButton; m_expandProjectFirstLevel = doc.GanttBasePane.ExpandFirstLevelItemPane; m_expandProjectSecondLevel = doc.GanttBasePane.ExpandSecondLevelItemPane; m_task1Pane = doc.GanttBasePane.Task1Pane; m_deleteMenuPane = doc.DeleteCustom.DeletePane; }
public void PasswordTests() { HtmlDiv bodyContainerDiv = new HtmlDiv(this.window); bodyContainerDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "layoutBodyContainer"); // no fieldset available HtmlControl fieldset = new HtmlCustom(bodyContainerDiv); fieldset.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "fieldset"); HtmlEdit passwordInput = new HtmlEdit(fieldset); passwordInput.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "passwordInput"); Assert.IsTrue(passwordInput.TryFind()); try { passwordInput.EnsureClickable(); } catch { } Point p; Assert.IsTrue(passwordInput.TryGetClickablePoint(out p), "There should be a point on screen for the disabled input."); passwordInput.Text = "myPassword"; }
public void GivenNewUser() { window = BrowserWindow.Launch($"{TestConfig.UrlBase}/DecomposingPageObjects/Change1"); // demo: this code is duplicated in all test initialize methods // and here it is extended // demo: what happens if the navigation changes? HtmlCustom nav = new HtmlCustom(window); nav.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "nav"); HtmlButton registerButton = new HtmlButton(nav); registerButton.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, "Register"); Mouse.Click(registerButton); RegistrationControlPageObject registrationControl = new RegistrationControlPageObject(window); this.newUsername = Guid.NewGuid().ToString("N"); this.newPassword = "******"; registrationControl.SetFormValues(this.newUsername, this.newPassword, this.newPassword); // demo: using the expsed button here // even though this page's tester created page objects which expose click methods Mouse.Click(registrationControl.RegisterButton); // demo: different style here, too // the page object is created in the iniailize instead of in each test this.accountSettingsPageObject = new AccountSettingsPageObject(window); }
/// <summary> /// Searches for the control on the page /// </summary> private HtmlCustom FindControlOnPage(string tabId) { var list = this.UIXeroDashboardInterneWindow.UIXeroDashboardDocument; var customControl = new HtmlCustom(list); customControl.SearchProperties.Add(HtmlCustom.PropertyNames.Id, tabId, PropertyExpressionOperator.Contains); return customControl; }
public virtual void Start() { try { Trace.WriteLine("Opening Internet Explorer"); var fileName = new Uri(new Uri(SimpleWebServer.HostUrl, UriKind.Absolute), "Default.aspx"); BrowserWindow = BrowserWindow.Launch(fileName); var document = new HtmlDocument(BrowserWindow) { FilterProperties = { { HtmlControl.PropertyNames.Title, "ApplicationUnderTest" } }, WindowTitles = { "ApplicationUnderTest" } }; var controlHostDiv = new HtmlDiv(document) { SearchProperties = { { HtmlControl.PropertyNames.Id, "silverlightControlHost" } }, FilterProperties = { { HtmlControl.PropertyNames.ControlDefinition, "id=silverlightControlHost" } }, WindowTitles = { "ApplicationUnderTest" } }; var controlHost = new HtmlCustom(controlHostDiv) { SearchProperties = { { "TagName", "OBJECT" } } }; MainPage = new SilverlightControl(controlHost) { SearchProperties = { { UITestControl.PropertyNames.ControlType, MainPageTypeName } } }; MainPage.Find(); MainPage.WaitForControlReady(); } catch (Exception) { Close(); throw; } }
/// <summary> /// Find the control on the page based on the name /// </summary> private HtmlCustom FindControlOnPage(string textboxName) { var list = this.UILoginXeroAccountingSWindow.UILoginXeroAccountingSDocument; var customControl = new HtmlCustom(list); customControl.SearchProperties.Add(HtmlCustom.PropertyNames.Name, textboxName, PropertyExpressionOperator.Contains); return customControl; }
public void GivenNewUser() { window = BrowserWindow.Launch($"{TestConfig.UrlBase}/DecomposingPageObjects/Change5"); HtmlCustom nav = new HtmlCustom(window); nav.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "nav"); HtmlButton registerButton = new HtmlButton(nav); registerButton.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, "Register"); Mouse.Click(registerButton); RegistrationControlPageObject registrationControl = new RegistrationControlPageObject(window); this.newUsername = Guid.NewGuid().ToString("N"); this.newPassword = "******"; registrationControl.SetFormValues(this.newUsername, this.newPassword, this.newPassword); registrationControl.ClickRegister(); HtmlButton ordersButton = new HtmlButton(nav); ordersButton.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, "Orders"); Mouse.Click(ordersButton); //this.ordersPageObject = new OrdersPageObject(window); this.ordersPageModel = new OrdersPageModel(window); }
public InstructorsPage VerifyPageIsValid(string title) { HtmlCustom titlePage = new HtmlCustom(BrowserManager.Instance.Browser); titlePage.SearchProperties.Add(HtmlCustom.PropertyNames.InnerText, title); titlePage.SearchProperties.Add(HtmlCustom.PropertyNames.TagName, "H2"); titlePage.WaitForControlExist(); return this; }
public void CodedUITestMethod1() { HtmlCustom brandAmazon = new HtmlCustom(br); brandAmazon.SearchProperties.Add(HtmlCustom.PropertyNames.TagName, "LI"); brandAmazon.SearchProperties.Add(HtmlCustom.PropertyNames.Class, "refinementImage"); //brandAmazon.DrawHighlight(); System.Drawing.Point myPoint = new System.Drawing.Point(100, 100); Mouse.Move(brandAmazon, myPoint); HtmlHyperlink bAmazonLink = new HtmlHyperlink(brandAmazon); bAmazonLink.SearchProperties.Add(HtmlHyperlink.PropertyNames.InnerText, " Amazon (1,156) "); bAmazonLink.SearchProperties.Add(HtmlHyperlink.PropertyNames.TagName, "A"); bAmazonLink.DrawHighlight(); Mouse.Click(bAmazonLink); HtmlSpan facebookOption = new HtmlSpan(br); facebookOption.SearchProperties.Add(HtmlSpan.PropertyNames.TagName, "SPAN"); facebookOption.SearchProperties.Add(HtmlSpan.PropertyNames.Class, "bestLink"); facebookOption.SearchProperties.Add(HtmlSpan.PropertyNames.InnerText, "Facebook"); Mouse.Click(facebookOption); HtmlCustom searchSortForm = new HtmlCustom(br); searchSortForm.SearchProperties.Add(HtmlCustom.PropertyNames.TagName, "FORM"); searchSortForm.SearchProperties.Add(HtmlCustom.PropertyNames.Class, "sortByForm"); searchSortForm.DrawHighlight(); HtmlComboBox sort = new HtmlComboBox(searchSortForm); sort.SearchProperties.Add(HtmlComboBox.PropertyNames.Id, "sort"); sort.SearchProperties.Add(HtmlComboBox.PropertyNames.Name, "sort"); sort.SearchProperties.Add(HtmlComboBox.PropertyNames.Class, "sortByDropdown"); sort.SelectedIndex = 4; for (int i = 1; i <= 24; i++) { HtmlCustom giftTitle = new HtmlCustom(br); giftTitle.SearchProperties.Add(HtmlCustom.PropertyNames.TagName, "H3"); giftTitle.SearchProperties.Add(HtmlCustom.PropertyNames.InnerText, "Amazon.com Gift Cards - Facebook Delivery "); giftTitle.SearchProperties.Add(HtmlCustom.PropertyNames.TagInstance, "'" + i + "'"); giftTitle.DrawHighlight(); HtmlHyperlink giftTitle1 = new HtmlHyperlink(giftTitle); giftTitle1.SearchProperties.Add(HtmlHyperlink.PropertyNames.InnerText, "Amazon.com Gift Cards - Facebook Delivery"); giftTitle1.SearchProperties.Add(HtmlHyperlink.PropertyNames.TagName, "A"); giftTitle1.SearchProperties.Add(HtmlHyperlink.PropertyNames.ClassName, "HtmlHyperlink"); string s = HtmlHyperlink.PropertyNames.FriendlyName; if (s == "Amazon.com Gift Cards - Facebook Delivery") { Console.WriteLine("Mathced!"); } } }
public OrderRowPageObject FindOrderByOrderId(string orderId) { HtmlCustom matchingItem = new HtmlCustom(this.OrderListCustom); matchingItem.SearchProperties.Add(HtmlCustom.PropertyNames.TagName, "li", PropertyExpressionOperator.EqualTo); matchingItem.SearchProperties.Add(HtmlCustom.PropertyNames.ControlDefinition, $"data-order-id=\"{orderId}\"", PropertyExpressionOperator.Contains); return(new OrderRowPageObject(matchingItem)); }
/// <summary> /// AssertLoginFaliureMessage - Use 'AssertLoginFaliureMessageExpectedValues' to pass parameters into this method. /// </summary> public void AssertLoginFaliureMessage() { #region Variable Declarations HtmlCustom uITheusernameorpassworCustom = this.UIHomeDiamondCircleIntWindow.UILoginDiamondCircleDocument.UILoginFormCustom.UITheusernameorpassworCustom; #endregion // Verify that the 'InnerText' property of 'The user name or password provided is in' custom control equals 'The user name or password provided is incorrect.' Assert.AreEqual(this.AssertLoginFaliureMessageExpectedValues.UITheusernameorpassworCustomInnerText, uITheusernameorpassworCustom.InnerText, "Warning message did not appear."); }
public InstructorsPage VerifyPageIsValid(string title) { HtmlCustom titlePage = new HtmlCustom(BrowserManager.Instance.Browser); titlePage.SearchProperties.Add(HtmlCustom.PropertyNames.InnerText, title); titlePage.SearchProperties.Add(HtmlCustom.PropertyNames.TagName, "H2"); titlePage.WaitForControlExist(); return(this); }
public BasePage(BrowserWindow browser) { _browser = browser; navbar = new HtmlCustom(_browser); navbar.SearchProperties.Add(HtmlCustom.PropertyNames.TagName, "UL"); navbar.SearchProperties.Add(HtmlCustom.PropertyNames.TagInstance, "1"); mainpage = new HtmlCustom(_browser); mainpage.SearchProperties.Add(HtmlCustom.PropertyNames.Id, "MainBody"); mainpage.SearchProperties.Add(HtmlCustom.PropertyNames.ControlType, "Pane"); }
public void TableClick(string tagid, string Buttonid) { HtmlCustom UIN = new HtmlCustom(Doc); UIN.SearchProperties["Id"] = tagid; HtmlTable button = new HtmlTable(UIN); button.FilterProperties[HtmlTable.PropertyNames.Id] = Buttonid; Mouse.Click(button); }
public FilterWindow(MicrosoftDynamics365Window bw) { m_bw = bw; // m_projectselectPane = this.m_bw.MicrosoftDynamics365Document.MainContentAreaFrame.ProjectGanttDocument.ProjectSelectPane; m_selectPane = this.m_bw.MicrosoftDynamics365Document.MainContentAreaFrame.ProjectGanttDocument.SelectPane; m_accountCustom = this.m_bw.MicrosoftDynamics365Document.MainContentAreaFrame.ProjectGanttDocument.AccountCustom; m_geveePane = this.m_bw.MicrosoftDynamics365Document.MainContentAreaFrame.ProjectGanttDocument.GeveePane; m_addButton = this.m_bw.MicrosoftDynamics365Document.MainContentAreaFrame.ProjectGanttDocument.AddButton; m_refreshPane = this.m_bw.MicrosoftDynamics365Document.MainContentAreaFrame.ProjectGanttDocument.RefreshButton.RefreshPane; }
//public void HyperLinkClick(string tagid, string tagName, string link) public void HyperLinkClick(string parenttagid, string link) { ////UINVCustom:HtmlCustom /////////// HtmlCustom UIN = new HtmlCustom(Doc); UIN.SearchProperties["Id"] = parenttagid; //UIN.SearchProperties["TagName"] = tagName; HtmlHyperlink HLink = new HtmlHyperlink(UIN); HLink.FilterProperties[HtmlHyperlink.PropertyNames.Id] = link; Mouse.Click(HLink); }
private static void VerifyThatTheUserIsInRole(HtmlDocument page, string roleName) { // Verify that the users has a role of Approver HtmlCustom ul = new HtmlCustom(page); ul.SearchProperties["TagName"] = "UL"; HtmlCustom li = new HtmlCustom(ul); li.SearchProperties["TagName"] = "LI"; Assert.IsTrue(li.InnerText.Contains(roleName), string.Format("the About box should show that the user has the '{0}' role", roleName)); }
public void RegistrationButtonEnabledOnlyWhenFormValid() { var window = BrowserWindow.Launch($"{TestConfig.UrlBase}/DecomposingPageObjects/InitialRequirements"); HtmlCustom nav = new HtmlCustom(window); nav.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "nav"); HtmlButton registerButton = new HtmlButton(nav); registerButton.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, "Register"); Mouse.Click(registerButton); HtmlDiv registerDiv = new HtmlDiv(window); registerDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "registerControl", PropertyExpressionOperator.EqualTo); HtmlDiv usernamePasswordDiv = new HtmlDiv(registerDiv); HtmlEdit username = new HtmlEdit(usernamePasswordDiv); username.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "username", PropertyExpressionOperator.Contains); username.Text = ""; HtmlEdit password = new HtmlEdit(usernamePasswordDiv); password.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "password", PropertyExpressionOperator.Contains); password.Text = ""; HtmlEdit confirmPassword = new HtmlEdit(registerDiv); confirmPassword.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "confirmPassword", PropertyExpressionOperator.Contains); confirmPassword.Text = ""; HtmlButton submitRegisterButton = new HtmlButton(registerDiv); Assert.IsTrue(submitRegisterButton.TryFind()); // demo: what do you suppose this check does? Assert.IsFalse(submitRegisterButton.Enabled); username.Text = "mike"; Assert.IsFalse(submitRegisterButton.Enabled); password.Text = "password"; Assert.IsFalse(submitRegisterButton.Enabled); confirmPassword.Text = "nomatch"; Assert.IsFalse(submitRegisterButton.Enabled); confirmPassword.Text = "password"; Assert.IsTrue(submitRegisterButton.Enabled); }
private static UITestControl FindSilverlightContainer(UITestControl control) { BrowserWindow browserWindow = FindBrowserWindow(control); if (browserWindow != null) { var custom = new HtmlCustom(browserWindow); custom.SearchProperties["TagName"] = "OBJECT"; return(custom); } return(control.GetParent()); }
public void selectExistingBookRefPACS(HtmlCustom clickExistingSavedPACS) { try { Mouse.Click(clickExistingSavedPACS); WriteLogs("PASS : Clicked on the Existing Saved PACS Icon from Main Menu Page - " + clickExistingSavedPACS.InnerText + " : VERIFICATION"); } catch (Exception ex) { WriteLogs("FAIL : Not able to Click on the Existing Saved PACS Icon from Main Menu Page : VERIFICATION"); WriteLogs("----------" + ex.Message.ToString()); } }
/// <summary> /// ViewHomePage - Use 'ViewHomePageExpectedValues' to pass parameters into this method. /// </summary> public void ViewHomePage() { #region Variable Declarations HtmlCustom uIItemCustom = this.UIDemoWorldHomePageWinWindow.UIDemoWorldHomePageDocument.UIOuterContainerPane.UIItemCustom; HtmlCustom uISiteWelcomeCustom = this.UIDemoWorldHomePageWinWindow.UIDemoWorldHomePageDocument.UISiteWelcomeCustom; #endregion // Verify that the 'TagName' property of custom control equals 'HEADER' Assert.AreEqual(this.ViewHomePageExpectedValues.UIItemCustomTagName, uIItemCustom.TagName, "In correct value"); // Verify that the 'Id' property of 'SiteWelcome' custom control equals 'SiteWelcome' Assert.AreEqual(this.ViewHomePageExpectedValues.UISiteWelcomeCustomId, uISiteWelcomeCustom.Id, "In correct text"); }
public void Launch_ObjectRepositoryTempHtmlFile_CanFindUnorderedListsByTagAndClassName() { // Arrange using (var tempFile = new TempFile( @"<html> <head> <title>test</title> </head> <body> <div id=""feed_tabs"" class=""ui-tabs""> <ul class=""dataFeedTab ui-tabs-nav""> <li data-bind-iterate=""."" class=""ui-tabs-selected ui-state-active""> <a href=""#ui-tabs-1"" data-bind=""createTabLink"" data-bind-type=""function"" class=""JQtab"">Attack Correlation Details</a> </li> <li data-bind-iterate="""" iterate-limit="""" class=""""> <a href=""#ui-tabs-2"" data-bind=""createTabLink"" data-bind-type=""function"" class=""JQtab"">Common Details</a> </li> <li data-bind-iterate="""" iterate-limit="" class=""> <a href=""#ui-tabs-3"" data-bind=""createTabLink"" data-bind-type=""function"" class=""JQtab"">Exposure Details</a> </li> <li data-bind-iterate="" iterate-limit="" class=""><a href=""#ui-tabs-4"" data-bind=""createTabLink"" data-bind-type=""function"" class=""JQtab"">IP Reputation Feed</a> </li> </ul> </div> </body> </html>")) { // Act HtmlTestPageFeeds window = WebPage.Launch <HtmlTestPageFeeds>(tempFile.FilePath); var cus = new HtmlCustom(window.divFeedTabs.UnWrap()); cus.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "ul", PropertyExpressionOperator.EqualTo); cus.SearchProperties.Add(HtmlControl.PropertyNames.Class, "dataFeedTab ui-tabs-nav", PropertyExpressionOperator.EqualTo); Assert.IsTrue(cus.Exists); EnhancedHtmlCustom cusDataFeedTabsNav = window.Get <EnhancedHtmlCustom>("Class=dataFeedTab ui-tabs-nav;TagName=ul"); Assert.IsTrue(cusDataFeedTabsNav.Exists); // Assert Assert.IsTrue(window.cusDataFeedTabsNav.Exists); Assert.IsTrue(window.cusdatafeedtabsnav1.Exists); Assert.IsTrue(window.cusDataFeedTabsNav2.Exists); Assert.IsTrue(window.cusDataFeedTabsNav3.Exists); window.Close(); } }
public void GivenRegistrationPage() { window = BrowserWindow.Launch($"{TestConfig.UrlBase}/DecomposingPageObjects/Change1"); HtmlCustom nav = new HtmlCustom(window); nav.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "nav"); HtmlButton registerButton = new HtmlButton(nav); registerButton.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, "Register"); Mouse.Click(registerButton); }
public void AfterRegisteringNewUser_AccountSettingsIsShown() { var window = BrowserWindow.Launch($"{TestConfig.UrlBase}/DecomposingPageObjects/InitialRequirements"); HtmlCustom nav = new HtmlCustom(window); nav.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "nav"); HtmlButton registerButton = new HtmlButton(nav); registerButton.SearchProperties.Add(HtmlButton.PropertyNames.DisplayText, "Register"); Mouse.Click(registerButton); HtmlDiv registerDiv = new HtmlDiv(window); registerDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "registerControl", PropertyExpressionOperator.EqualTo); HtmlDiv usernamePasswordDiv = new HtmlDiv(registerDiv); HtmlEdit username = new HtmlEdit(usernamePasswordDiv); username.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "username", PropertyExpressionOperator.Contains); username.Text = Guid.NewGuid().ToString("N"); HtmlEdit password = new HtmlEdit(usernamePasswordDiv); password.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "password", PropertyExpressionOperator.Contains); password.Text = "pass"; HtmlEdit confirmPassword = new HtmlEdit(registerDiv); confirmPassword.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "confirmPassword", PropertyExpressionOperator.Contains); confirmPassword.Text = "pass"; HtmlDiv accountSettingsDiv = new HtmlDiv(window); accountSettingsDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "accountSettingsControl"); // demo: what is this *actually* asserting Assert.IsTrue(accountSettingsDiv.Width == 0 && accountSettingsDiv.Height == 0); HtmlButton submitRegisterButton = new HtmlButton(registerDiv); Mouse.Click(submitRegisterButton); Assert.IsFalse(accountSettingsDiv.Width == 0 && accountSettingsDiv.Height == 0); }
public HtmlControl[] GetWhatYouCanDoList() { var elements = new List <HtmlControl>(); var listelement = new HtmlControl(mainpage); listelement.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "OL"); listelement.SearchProperties.Add(HtmlControl.PropertyNames.TagInstance, "2"); for (var index = 1; index <= listelement.GetChildren().Count; index++) { var element = new HtmlCustom(listelement); element.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "LI"); element.SearchProperties.Add(HtmlControl.PropertyNames.TagInstance, index.ToString()); elements.Add(element); } return(elements.ToArray()); }
public static void Referal2eRegistration() { //Create BrowserWindow BrowserWindow Browind = new BrowserWindow(); //wait for control ready Browind.WaitForControlReady(1000); // Referral pane Browind.SearchProperties[UITestControl.PropertyNames.Name] = "Referrals"; //Progress Meter HtmlCustom progress = new HtmlCustom(Browind); progress.SearchProperties[HtmlCustom.PropertyNames.Id] = "progressmeter"; bool availabilty = (bool)progress.GetProperty(HtmlCustom.PropertyNames.Exists); string workflowEvent = PersonalInformation1.ReadData(1, "WORKFLOW"); if (workflowEvent == "S1PROSPECT") { Assert.IsTrue(availabilty, "Progress Meter is not showing"); HtmlSpan bar = new HtmlSpan(Browind); bar.SearchProperties[HtmlSpan.PropertyNames.Id] = "meterlabel"; string percentage = (string)bar.GetProperty(HtmlSpan.PropertyNames.InnerText); Assert.AreEqual(percentage, "60%"); } else { Assert.IsFalse(availabilty, "Progress Meter is showing"); } //Save And Continue button HtmlControl SaveCont = new HtmlControl(Browind); SaveCont.SearchProperties[HtmlButton.PropertyNames.Id] = "ForwardButton_button"; //Click button Save And Continue Assert.IsTrue(SaveCont.Enabled); Mouse.Click(SaveCont); Browind.WaitForControlReady(1000); }
public static void SelfIdentificationSurvey1() { //Create browserwindow BrowserWindow browind = new BrowserWindow(); browind.SearchProperties[UITestControl.PropertyNames.Name] = "Self-Identification Survey"; Mouse.MoveScrollWheel(-120); //Button "Save And Continue" HtmlInputButton SaveNContinue = new HtmlInputButton(browind); SaveNContinue.SearchProperties[HtmlButton.PropertyNames.Id] = "ForwardButton_button"; // Progress Meter HtmlCustom progress = new HtmlCustom(browind); progress.SearchProperties[HtmlCustom.PropertyNames.Id] = "progressmeter"; bool availabilty = (bool)progress.GetProperty(HtmlCustom.PropertyNames.Exists); string workflowEvent = PersonalInformation1.ReadData(1, "WORKFLOW"); if (workflowEvent == "S1PROSPECT") { Assert.IsTrue(availabilty, "Progress Meter is not showing"); HtmlSpan bar = new HtmlSpan(browind); bar.SearchProperties[HtmlSpan.PropertyNames.Id] = "meterlabel"; string percentage = (string)bar.GetProperty(HtmlSpan.PropertyNames.InnerText); Assert.AreEqual(percentage, "70%"); } else { Assert.IsFalse(availabilty, "Progress Meter is showing"); } //Click Save and Continue button Mouse.Click(SaveNContinue); browind.WaitForControlReady(2000); }
public void TestDisabledInput() { HtmlDiv bodyContainerDiv = new HtmlDiv(this.window); bodyContainerDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "layoutBodyContainer"); // no fieldset available HtmlControl fieldset = new HtmlCustom(bodyContainerDiv); fieldset.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "fieldset"); HtmlEdit disabledInput = new HtmlEdit(fieldset); disabledInput.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "disabledInput"); Assert.IsTrue(disabledInput.TryFind(), "Disabled text box should be able to be found."); try { disabledInput.EnsureClickable(); } catch { } Point p; Assert.IsTrue(disabledInput.TryGetClickablePoint(out p), "There should be a point on screen for the disabled input."); Assert.IsFalse(disabledInput.Enabled); Assert.IsTrue(StringComparer.OrdinalIgnoreCase.Equals("testValue", disabledInput.Text)); try { disabledInput.Text = "Other Value"; Assert.Fail("Attempting to set text of a disabled input should throw an exception."); } catch (ActionNotSupportedOnDisabledControlException) { } Assert.IsTrue(StringComparer.OrdinalIgnoreCase.Equals("testValue", disabledInput.Text)); }
// To click HTML Custom accepting two property of which one property with property expression operator contains [Using TryGetClickablePoint Method] public void clickHTMLCustomCollectionTwoProp(string strControl) { Keywords KeyFound = reader.FindControlinList(strControl); BrowserWindow _browser = new BrowserWindow(); HtmlCustom _htmlCustom = new HtmlCustom(_browser); _htmlCustom.SearchProperties[KeyFound.PropertyName1] = KeyFound.PropertyValue1; _htmlCustom.SearchProperties.Add(KeyFound.PropertyName2, KeyFound.PropertyValue2, PropertyExpressionOperator.Contains); int c = _htmlCustom.FindMatchingControls().Count; var matchingControls = _htmlCustom.FindMatchingControls(); for (int i = 0; i < c; i++) { if (matchingControls[i].TryGetClickablePoint(out pt)) { Mouse.Click(matchingControls[i]); break; } } }
/// <summary> /// Gets the custom control on the screen based on the ID provided /// </summary> internal HtmlCustom FindControlOnPageWithinDiv(string innerText) { var list = this.UIXeroSalesWindowsInteWindow.UIXeroSalesDocument; var customControl = new HtmlCustom(list); customControl.SearchProperties.Add(HtmlCustom.PropertyNames.InnerText, innerText, PropertyExpressionOperator.EqualTo); return customControl; }
public void Launch_ObjectRepositoryTempHtmlFile_CanFindUnorderedListsByTagAndClassName() { // Arrange using (var tempFile = new TempFile( @"<html> <head> <title>test</title> </head> <body> <div id=""feed_tabs"" class=""ui-tabs""> <ul class=""dataFeedTab ui-tabs-nav""> <li data-bind-iterate=""."" class=""ui-tabs-selected ui-state-active""> <a href=""#ui-tabs-1"" data-bind=""createTabLink"" data-bind-type=""function"" class=""JQtab"">Attack Correlation Details</a> </li> <li data-bind-iterate="""" iterate-limit="""" class=""""> <a href=""#ui-tabs-2"" data-bind=""createTabLink"" data-bind-type=""function"" class=""JQtab"">Common Details</a> </li> <li data-bind-iterate="""" iterate-limit="" class=""> <a href=""#ui-tabs-3"" data-bind=""createTabLink"" data-bind-type=""function"" class=""JQtab"">Exposure Details</a> </li> <li data-bind-iterate="" iterate-limit="" class=""><a href=""#ui-tabs-4"" data-bind=""createTabLink"" data-bind-type=""function"" class=""JQtab"">IP Reputation Feed</a> </li> </ul> </div> </body> </html>")) { // Act HtmlTestPageFeeds window = WebPage.Launch<HtmlTestPageFeeds>(tempFile.FilePath); var cus = new HtmlCustom(window.divFeedTabs.UnWrap()); cus.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "ul", PropertyExpressionOperator.EqualTo); cus.SearchProperties.Add(HtmlControl.PropertyNames.Class, "dataFeedTab ui-tabs-nav", PropertyExpressionOperator.EqualTo); Assert.IsTrue(cus.Exists); EnhancedHtmlCustom cusDataFeedTabsNav = window.Get<EnhancedHtmlCustom>("Class=dataFeedTab ui-tabs-nav;TagName=ul"); Assert.IsTrue(cusDataFeedTabsNav.Exists); // Assert Assert.IsTrue(window.cusDataFeedTabsNav.Exists); Assert.IsTrue(window.cusdatafeedtabsnav1.Exists); Assert.IsTrue(window.cusDataFeedTabsNav2.Exists); Assert.IsTrue(window.cusDataFeedTabsNav3.Exists); window.Close(); } }
public HtmlCustom PrintToWord() { WinControl IES = new WinControl(); IES.SearchProperties[WinControl.PropertyNames.ClassName] = "Internet Explorer_Server"; IES.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString())); Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument Doc = new Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument(IES); Doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Id] = null; Doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.RedirectingPage] = "False"; Doc.SearchProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.FrameDocument] = "False"; Doc.FilterProperties[Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlDocument.PropertyNames.Title] = "Beam Analysis Report"; Doc.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString())); HtmlCustom PrintWordButton = new HtmlCustom(Doc); PrintWordButton.SearchProperties["TagName"] = "A"; PrintWordButton.SearchProperties["Id"] = "btnPrint"; PrintWordButton.SearchProperties[UITestControl.PropertyNames.Name] = null; PrintWordButton.FilterProperties["Class"] = "clsTabBtn"; PrintWordButton.FilterProperties["ControlDefinition"] = "style=\"COLOR: darkblue\" id=btnPrint clas"; PrintWordButton.FilterProperties["TagInstance"] = "3"; PrintWordButton.WindowTitles.Add((new PropertyExpression(WinWindow.PropertyNames.Name, "LOWIS:", PropertyExpressionOperator.Contains).ToString())); return PrintWordButton; }