private ApplicationPOMModel CreatePOMOnWizard(string POMName, string POMDescription, string targetApp, Agent agent, string URL, List <eElementType> elementTypeCheckBoxToClickList, List <ElementLocator> prioritizedLocatorsList) { WizardPOM wizard = WizardPOM.CurrentWizard; wizard.NextButton.Click(); ucAgentControl ucAgentControl = (ucAgentControl)wizard.CurrentPage["ucAgentControl AID"].dependencyObject; ucAgentControlPOM ucAgentControlPOM = new ucAgentControlPOM(ucAgentControl); ucAgentControlPOM.SelectValueUCAgentControl(agent); ucAgentControlPOM.UCAgentControlStatusButtonClick(); SleepWithDoEvents(10000); //Process AutoMap Element Locators Grid ucGrid ucElementLocatorsGrid = (ucGrid)wizard.CurrentPage["AutoMapElementLocatorsGrid AID"].dependencyObject; ucGridPOM ucElementLocatorsGridPOM = new ucGridPOM(ucElementLocatorsGrid); int locatorIndex = 0; foreach (ElementLocator elemLocator in prioritizedLocatorsList) { if (!elemLocator.Active) { ucElementLocatorsGridPOM.ClickOnCheckBox(nameof(ElementLocator.Active), nameof(ElementLocator.LocateBy), elemLocator.LocateBy.ToString()); } ucElementLocatorsGridPOM.ReOrderGridRows(nameof(ElementLocator.LocateBy), elemLocator.LocateBy.ToString(), locatorIndex); locatorIndex++; } //Process AutoMap Element Types Grid ucGrid ucElementTypesGrid = (ucGrid)wizard.CurrentPage["AutoMapElementTypesGrid AID"].dependencyObject; ucGridPOM ucElementTypesGridPOM = new ucGridPOM(ucElementTypesGrid); foreach (eElementType elementType in elementTypeCheckBoxToClickList) { ucElementTypesGridPOM.ClickOnCheckBox(nameof(UIElementFilter.Selected), nameof(UIElementFilter.ElementType), elementType.ToString()); } string html = TestResources.GetTestResourcesFile(URL); agent.Driver.RunAction(new ActBrowserElement() { ControlAction = ActBrowserElement.eControlAction.GotoURL, ValueForDriver = html }); SleepWithDoEvents(2000); wizard.NextButton.Click(); while (agent.Driver.IsDriverBusy) { SleepWithDoEvents(20000); } wizard.NextButton.Click(); SleepWithDoEvents(2000); wizard.CurrentPage["Name POMID"].SetText(POMName); wizard.CurrentPage["Description POMID"].SetText(POMDescription); wizard.FinishButton.Click(); SleepWithDoEvents(2000); ApplicationPOMModel POM = (from x in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ApplicationPOMModel>() where x.Name == POMName select x).SingleOrDefault(); return(POM); }
private Page AddVariable(string VariableDisplayName) { Task.Factory.StartNew(() => { Execute(() => { ucGrid grid = (ucGrid)FindElementByAutomationID <ucGrid>(mVariablesPage, "Variables Grid AID"); ucGridPOM gridPOM = new ucGridPOM(grid); gridPOM.EnhancedHeaderAddButton.Click(); }); }); Page addVaraiblePage = null; Stopwatch st = Stopwatch.StartNew(); while (addVaraiblePage == null && st.ElapsedMilliseconds < 10000) { SleepWithDoEvents(100); if (GenericWindow.CurrentWindow != null) { addVaraiblePage = CurrentGenericWindow.LoadedPage(); // return addVaraiblePage; Execute(() => { ucGrid ucGrid = (ucGrid)FindElementByAutomationID <ucGrid>(addVaraiblePage, "VariablesGrid AID"); ucGridPOM ucGridPOM = new ucGridPOM(ucGrid); ucGridPOM.GotoRow("VariableUIType", VariableDisplayName); }); Task.Factory.StartNew(() => { Execute(() => { CurrentGenericWindow.Buttons["Add Variable"].Click(); }); }); SleepWithDoEvents(100); Page p = null; Stopwatch st2 = Stopwatch.StartNew(); while (!(p is VariableEditPage) && st2.ElapsedMilliseconds < 10000) { SleepWithDoEvents(100); p = CurrentGenericWindow.LoadedPage(); return(p); } throw new Exception("timeout Error waiting for var edit page to load"); } } throw new Exception("timeout Error cannot find Add variable page"); }