[ ] Microsoft Dynamics 365 Online Version 9.1 (9.1.x) (DB 9.1.x) online
UCI or Classic Web
[ ] UCI (XrmApp)
Online or On Premise
[ ] Online
Browser
[ ] Chrome
Describe the bug
Hi guys, seems like the GetValue command is not working. I have checked EasyRepro repo and it seems to be trying to find "input" or "textarea" tagname when using the GetValue command.
if (fieldContainer.FindElements(By.TagName("input")).Count > 0)
{
var input = fieldContainer.FindElement(By.TagName("input"));
if (input != null)
{
IWebElement fieldValue = input.FindElement(By.XPath(AppElements.Xpath[AppReference.Entity.TextFieldValue].Replace("[NAME]", field)));
text = fieldValue.GetAttribute("value").ToString();
// Needed if getting a date field which also displays time as there isn't a date specifc GetValue method
var timefields = driver.FindElements(By.XPath(AppElements.Xpath[AppReference.Entity.FieldControlDateTimeTimeInputUCI].Replace("[FIELD]", field)));
if (timefields.Any())
{
text = $" {timefields.First().GetAttribute("value")}";
}
}
}
else if (fieldContainer.FindElements(By.TagName("textarea")).Count > 0)
{
text = fieldContainer.FindElement(By.TagName("textarea")).GetAttribute("value");
}
else
{
throw new Exception($"Field with name {field} does not exist.");
}
Some of the LookupItems are now
or
so it is throwing "Field element {name} does not exist. This was working fine on Friday. We picked the issue yesterday, and we know that there was a Microsoft update during the weekend.
Code to reproduce
xrmApp.Entity.GetValue(new LookupItem { Name = "name"});
Expected behavior
LookupItem value should be found
Screenshots
If you can look into this ASAP should be great. Thanks
I work with @imartinflores and we are already doing the way you offer.
Our description was not entirely correct i must admit so good point from you :)
We will update the problem but even by using Lookup it doesn't work.
Like we said, our assumption so far is that something change on UI with the MS update because we didn't change anything on our code and it was working fine before.
I even checked in the Entity itself and the field id is there.
Yes, it doesn't works, because this the PR is not merged yet to 'develop' & released. But is the same Issue as #756?
To be sure you can run your code as I show in this comment.
or you can get the code from PR #764 & try with this.
That will call the "new" logic. After this PR get approved you will be able to work as usual, with ´GetValue(LookupItem)´ instead the ´GetValue(LookupItem[])´ which now is working fine in 'develop' branch.
Hi @AngelRodriguez8008 , thanks for the answer. Yes, that's ok, do you know when this will get merged ?
By the way, I think the Xpath is not correct for Lookups, we still have some failures when trying to find elements like this one:
From the implementation GetValue(LookupItem[]) I deduce that you get in HTML an when the field do not contains any value. I such case GetValue return am empty string. Is it your case?
Yes, before was returning "---" as it is the value that the field has. Now, even if it has "---" it returns empty, we can change that on our tests, but need to confirm we will always return empty in this case.
Bug Report
xrmApp.Entity.GetValue command not working.
EasyRepro Version
UCI or Classic Web
Online or On Premise
Browser
Describe the bug
Hi guys, seems like the GetValue command is not working. I have checked EasyRepro repo and it seems to be trying to find "input" or "textarea" tagname when using the GetValue command.
if (fieldContainer.FindElements(By.TagName("input")).Count > 0) { var input = fieldContainer.FindElement(By.TagName("input")); if (input != null) { IWebElement fieldValue = input.FindElement(By.XPath(AppElements.Xpath[AppReference.Entity.TextFieldValue].Replace("[NAME]", field))); text = fieldValue.GetAttribute("value").ToString();
Some of the LookupItems are now
so it is throwing "Field element {name} does not exist. This was working fine on Friday. We picked the issue yesterday, and we know that there was a Microsoft update during the weekend.
Code to reproduce
xrmApp.Entity.GetValue(new LookupItem { Name = "name"});
Expected behavior
LookupItem value should be found
Screenshots
If you can look into this ASAP should be great. Thanks
Hi @imartinflores,
Thanks for your feedback.
for a lookup value you should use the follow overload of GetValue
string lookupValue = xrmApp.Entity.GetValue(new LookupItem { Name = "primarycontactid" });
Can you check please that your bug is not the same that #756?
PR #764 should fix it.
br
Hi @AngelRodriguez8008,
I work with @imartinflores and we are already doing the way you offer. Our description was not entirely correct i must admit so good point from you :) We will update the problem but even by using Lookup it doesn't work.
Like we said, our assumption so far is that something change on UI with the MS update because we didn't change anything on our code and it was working fine before. I even checked in the Entity itself and the field id is there.
Hi @Haywaii,
Yes, it doesn't works, because this the PR is not merged yet to 'develop' & released. But is the same Issue as #756?
To be sure you can run your code as I show in this comment. or you can get the code from PR #764 & try with this.
That will call the "new" logic. After this PR get approved you will be able to work as usual, with ´GetValue(LookupItem)´ instead the ´GetValue(LookupItem[])´ which now is working fine in 'develop' branch.
Thanks & br
Hi @AngelRodriguez8008 , thanks for the answer. Yes, that's ok, do you know when this will get merged ? By the way, I think the Xpath is not correct for Lookups, we still have some failures when trying to find elements like this one:
EntityLookupFieldExistingValue: //*[@data-id='[NAME].fieldControl-LookupResultsDropdown[NAME]_selected_tag']
Seems like not all of the LookupItems have the same xpath, you are using it on the TryGetValue.
Thank you.
From the implementation GetValue(LookupItem[]) I deduce that you get in HTML an when the field do not contains any value. I such case GetValue return am empty string. Is it your case?
Yes, before was returning "---" as it is the value that the field has. Now, even if it has "---" it returns empty, we can change that on our tests, but need to confirm we will always return empty in this case.
Try this:
You should have already in your API:
You will never need to change your tests again :-)
Note: or you can implement your own IsEmptyLookupValue & you will be able to change it just in one place.
Hi @imartinflores,
The PR is merged can we close this Issue?
Thanks & br
Yes, very nice !
Thank you!
Sorry. I mean: Can you close it please? I'm not able to do it.
@AngelRodriguez8008 have you updated the nuget package ?
Sorry. I'm not able to do it. Probably the MS guys did it.
No worries, thanks for helping!