Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Microsoft.Dynamics365.UIAutomation.Api.UCI.WebClient.TrySetValue fails to find optionset in Quick Create #1425

Open
4 of 12 tasks
altman-medline opened this issue Jul 27, 2024 · 0 comments
Labels

Comments

@altman-medline
Copy link

Bug Report

EasyRepro Version

  • Microsoft Dynamics 365 Online Version 8.2 (8.2.x) (DB 8.2.x) online
  • Microsoft Dynamics 365 Online Version 9.0 (9.0.x) (DB 9.0.x) online
  • Microsoft Dynamics 365 Online Version 9.0.2 (9.0.2) (DB 9.0.2) online
  • Microsoft Dynamics 365 Online Version 9.1 (9.1.x) (DB 9.1.x) online

UCI or Classic Web

  • UCI (XrmApp)
  • Classic Web (XrmBrowser)

Online or On Premise

  • Online
  • On Premise

Browser

  • Chrome
  • Firefox
  • IE
  • Edge

Describe the bug
Exception:

Optionset field 'med_customergroupdesc' exists on Quick Create form, however this library does not find it. XPaths seem wrong here for this type of field or do not properly support Quick Create optionset fields.
System.InvalidOperationException : OptionSet Field: 'med_customergroupdesc' does not exist
   at Microsoft.Dynamics365.UIAutomation.Browser.BrowserCommand`1.Execute[T1,T2,T3,T4,T5,T6,T7,T8,T9](IWebDriver driver, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9)
   at Microsoft.Dynamics365.UIAutomation.Browser.BrowserPage.Execute[TResult](BrowserCommandOptions options, Func`2 delegate)
   at Medline.Crm.UIAutomation.Core.EasyRepro.Fields.QuickCreateBodyFormField.SetOptionSetField(OptionSetValue value) 

HTML of control on quick create form:

<button type="button" aria-expanded="false" role="combobox" tabindex="0" aria-label="Customer Group" data-id="med_customergroupdesc.fieldControl-option-set-select" title="---" aria-required="true" class="fui-Dropdown__button ___19fe7ry f122n59 f1c21dwh fre7gi1 f1358rze fqdk4by f1rvrf73 f1ewtqcl fxc4j92 f14mj54c f1k6fduh f13qh94s fk6fouc f12nh0o2 f1869bpl f1o700av fly5x3f ftqa4ok fkhj508 figsok6 f1i3iumi f1sbtcvk f11gcy0p fdghr9 f1e60jzv">
    ---
    <span class="fui-Dropdown__expandIcon ___5y6ahy0 f1ewtqcl fxkbij4 ftgm304 fe5j1ua f12w6cgp f8bv1bt fvc9v3g f1h9en5y" style="visibility: hidden;">
        <svg fill="currentColor" class="___12fm75w f1w7gpdv fez10in fg4l7m0" aria-hidden="true" width="1em" height="1em" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
            <path d="M15.85 7.65c.2.2.2.5 0 .7l-5.46 5.49a.55.55 0 0 1-.78 0L4.15 8.35a.5.5 0 1 1 .7-.7L10 12.8l5.15-5.16c.2-.2.5-.2.7 0Z" fill="currentColor"></path>
        </svg>
    </span>
</button>

Method from library does not have any targeting code for a 'button' tag in this method or from any of the XPath dictionary values.

    private static void TrySetValue(IWebElement fieldContainer, OptionSet control)
    {
      string str = control.Value;
      IWebElement element;
      if (fieldContainer.TryFindElement(By.TagName("select"), out element))
      {
        fieldContainer.WaitUntilAvailable(By.TagName("select"));
        WebClient.SelectOption(element.FindElements(By.TagName("option")), str);
      }
      else
      {
        string name = control.Name;
        if (!fieldContainer.HasElement(By.XPath(AppElements.Xpath[AppReference.Entity.EntityOptionsetStatusCombo].Replace("[NAME]", name))))
          throw new InvalidOperationException("OptionSet Field: '" + name + "' does not exist");
        fieldContainer.ClickWhenAvailable(By.XPath(AppElements.Xpath[AppReference.Entity.EntityOptionsetStatusComboButton].Replace("[NAME]", name)));
        WebClient.SelectOption(fieldContainer.FindElement(By.XPath(AppElements.Xpath[AppReference.Entity.EntityOptionsetStatusComboList].Replace("[NAME]", name))).FindElements(By.TagName("li")), str);
      }
    }


XPath for Entity_OptionsetStatusCombo

      {
        "Entity_OptionsetStatusCombo",
        "//div[contains(@data-id, '[NAME].fieldControl-pickliststatus-comboBox')]"
      },

Expected behavior
Optionset value is able to be set on Quick Create form

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant