diff --git a/Microsoft.Dynamics365.UIAutomation.Api.UCI/Controls/Field.cs b/Microsoft.Dynamics365.UIAutomation.Api.UCI/Controls/Field.cs index 6862c20b..8a3bd975 100644 --- a/Microsoft.Dynamics365.UIAutomation.Api.UCI/Controls/Field.cs +++ b/Microsoft.Dynamics365.UIAutomation.Api.UCI/Controls/Field.cs @@ -117,11 +117,11 @@ public bool IsRequired { get { - if (containerElement.HasElement(By.XPath(AppElements.Xpath[AppReference.Field.Required]))) + if (containerElement.HasElement(By.XPath(AppElements.Xpath[AppReference.Field.RequiredIcon]))) { - var required = containerElement.FindElement(By.XPath(AppElements.Xpath[AppReference.Field.Required])); + var required = containerElement.FindElement(By.XPath(AppElements.Xpath[AppReference.Field.RequiredIcon])); - if (required.GetAttribute("aria-required") == "true") + if (required != null) return true; } diff --git a/Microsoft.Dynamics365.UIAutomation.Api.UCI/DTO/AppElementReference.cs b/Microsoft.Dynamics365.UIAutomation.Api.UCI/DTO/AppElementReference.cs index 9e4a4f35..048b855e 100644 --- a/Microsoft.Dynamics365.UIAutomation.Api.UCI/DTO/AppElementReference.cs +++ b/Microsoft.Dynamics365.UIAutomation.Api.UCI/DTO/AppElementReference.cs @@ -236,6 +236,7 @@ public static class BusinessProcessFlow public static string BusinessProcessFlowFieldName = "BPF_FieldName_UCI"; public static string BusinessProcessFlowFormContext = "BPF_FormContext"; public static string TextFieldContainer = "BPF_TextFieldContainer"; + public static string FieldSectionItemContainer = "BPF_FieldSectionItemContainer"; public static string TextFieldLabel = "BPF_TextFieldLabel"; public static string BooleanFieldContainer = "BPF_BooleanFieldContainer"; public static string DateTimeFieldContainer = "BPF_DateTimeFieldContainer"; @@ -308,6 +309,7 @@ public static class Field { public static string ReadOnly = "Field_ReadOnly"; public static string Required = "Field_Required"; + public static string RequiredIcon = "Field_RequiredIcon"; } public static class PerformanceWidget { @@ -526,6 +528,7 @@ public static class AppElements { "BPF_NextStageButton_UCI" , "//button[contains(@data-id,'nextButtonContainer')]" }, { "BPF_SetActiveButton", "//button[contains(@data-id,'setActiveButton')]" }, { "BPF_FieldName_UCI" , "//input[contains(@id,'[NAME]')]" }, + { "BPF_FieldSectionItemContainer", ".//div[contains(@id, \'header_process_[NAME]-FieldSectionItemContainer\')]" }, { "BPF_FormContext" , "//div[contains(@id, \'ProcessStageControl-processHeaderStageFlyoutInnerContainer\')]" }, { "BPF_TextFieldContainer", ".//div[contains(@data-lp-id, \'header_process_[NAME]\')]" }, { "BPF_TextFieldLabel", "//label[contains(@id, \'header_process_[NAME]-field-label\')]" }, @@ -545,6 +548,7 @@ public static class AppElements //Field {"Field_ReadOnly",".//*[@aria-readonly]" }, {"Field_Required", ".//*[@aria-required]"}, + {"Field_RequiredIcon", ".//div[contains(@data-id, 'required-icon') or contains(@id, 'required-icon')]"}, //Dialogs { "AssignDialog_ToggleField" , "//label[contains(@data-id,'rdoMe_id.fieldControl-checkbox-inner-first')]" }, diff --git a/Microsoft.Dynamics365.UIAutomation.Api.UCI/Microsoft.Dynamics365.UIAutomation.Api.UCI.csproj b/Microsoft.Dynamics365.UIAutomation.Api.UCI/Microsoft.Dynamics365.UIAutomation.Api.UCI.csproj index a24d7dc3..89c15206 100644 --- a/Microsoft.Dynamics365.UIAutomation.Api.UCI/Microsoft.Dynamics365.UIAutomation.Api.UCI.csproj +++ b/Microsoft.Dynamics365.UIAutomation.Api.UCI/Microsoft.Dynamics365.UIAutomation.Api.UCI.csproj @@ -23,6 +23,7 @@ DEBUG;TRACE prompt 4 + 7.2 pdbonly @@ -31,6 +32,7 @@ TRACE prompt 4 + 7.2 @@ -113,6 +115,10 @@ + + {dfe2c141-f1aa-4d4b-8df8-0fb93023cf45} + Microsoft.Dynamics365.UIAutomation.Api + {c9748803-f3cb-4531-b313-bc24d4d0bf0c} Microsoft.Dynamics365.UIAutomation.Browser diff --git a/Microsoft.Dynamics365.UIAutomation.Api.UCI/WebClient.cs b/Microsoft.Dynamics365.UIAutomation.Api.UCI/WebClient.cs index 297c4bb7..ad187f0c 100644 --- a/Microsoft.Dynamics365.UIAutomation.Api.UCI/WebClient.cs +++ b/Microsoft.Dynamics365.UIAutomation.Api.UCI/WebClient.cs @@ -4742,7 +4742,10 @@ internal BrowserCommandResult BPFGetField(string field) { return this.Execute(GetOptions($"Get Field"), driver => { - var fieldElement = driver.WaitUntilAvailable(By.XPath(AppElements.Xpath[AppReference.BusinessProcessFlow.TextFieldContainer].Replace("[NAME]", field))); + + // Initialize the Business Process Flow context + var formContext = driver.WaitUntilAvailable(By.XPath(AppElements.Xpath[AppReference.BusinessProcessFlow.BusinessProcessFlowFormContext])); + var fieldElement = formContext.WaitUntilAvailable(By.XPath(AppElements.Xpath[AppReference.BusinessProcessFlow.FieldSectionItemContainer].Replace("[NAME]", field))); Field returnField = new Field(fieldElement); returnField.Name = field; diff --git a/Microsoft.Dynamics365.UIAutomation.Api/Microsoft.Dynamics365.UIAutomation.Api.csproj b/Microsoft.Dynamics365.UIAutomation.Api/Microsoft.Dynamics365.UIAutomation.Api.csproj index f039fea0..1a440f8a 100644 --- a/Microsoft.Dynamics365.UIAutomation.Api/Microsoft.Dynamics365.UIAutomation.Api.csproj +++ b/Microsoft.Dynamics365.UIAutomation.Api/Microsoft.Dynamics365.UIAutomation.Api.csproj @@ -23,6 +23,7 @@ DEBUG;TRACE prompt 4 + 7.2 pdbonly @@ -31,6 +32,7 @@ TRACE prompt 4 + 7.2 false diff --git a/Microsoft.Dynamics365.UIAutomation.Browser/Microsoft.Dynamics365.UIAutomation.Browser.csproj b/Microsoft.Dynamics365.UIAutomation.Browser/Microsoft.Dynamics365.UIAutomation.Browser.csproj index de12d089..0808752a 100644 --- a/Microsoft.Dynamics365.UIAutomation.Browser/Microsoft.Dynamics365.UIAutomation.Browser.csproj +++ b/Microsoft.Dynamics365.UIAutomation.Browser/Microsoft.Dynamics365.UIAutomation.Browser.csproj @@ -23,6 +23,7 @@ DEBUG;TRACE prompt 4 + 7.2 pdbonly @@ -31,6 +32,7 @@ TRACE prompt 4 + 7.2 false diff --git a/Microsoft.Dynamics365.UIAutomation.Sample/Microsoft.Dynamics365.UIAutomation.Sample.csproj b/Microsoft.Dynamics365.UIAutomation.Sample/Microsoft.Dynamics365.UIAutomation.Sample.csproj index 67ef669a..5aa7aa81 100644 --- a/Microsoft.Dynamics365.UIAutomation.Sample/Microsoft.Dynamics365.UIAutomation.Sample.csproj +++ b/Microsoft.Dynamics365.UIAutomation.Sample/Microsoft.Dynamics365.UIAutomation.Sample.csproj @@ -28,6 +28,7 @@ DEBUG;TRACE prompt 4 + 7.2 pdbonly @@ -36,6 +37,7 @@ TRACE prompt 4 + 7.2