Open srinu24k opened 4 years ago
@srinu24k you can set lookup value like this LookupItem LookupVeriable = new LookupItem { Name = LookupFieldName, Value = LookupFieldValue, Index = 0 }; global.xrmApp.Entity.SetValue(LookupVeriable);
@badarmunirr , the code doesn't work as it's no difference with the code i have shared
@srinu24k try this LookupItem LookupVeriable = new LookupItem { Name = "Customer", Value = "Lifetouch Inc", Index = 0 }; xrmApp.Entity.SetValue(LookupVeriable); if customer is your field name . it should work because I have just ran a follow with lookup and its working for me
@badarmunirr It wont works. the issue is not how you are using the SetValue() method.
Have debugged the method and came to know that this below piece of code in SetLookUpByValue(IWebDriver driver, LookupItem control, int index) method is not working where it should return an integer >0 but it's returning 0 only. Hence it is failing.
var dialogItems = OpenDialog(flyoutDialog).Value;
driver.WaitForTransaction();
if (dialogItems.Count == 0)
throw new InvalidOperationException($"List does not contain a record with the name: {control.Value}");
if (index + 1 > dialogItems.Count)
{
throw new InvalidOperationException($"List does not contain {index + 1} records. Please provide an index value less than {dialogItems.Count} ");
}
var dialogItem = dialogItems[index];
driver.ClickWhenAvailable(By.Id(dialogItem.Id));
Now Can you please provide a fix for this?
Below is the further investigation of the code, where title links are expected to return an integer > 0 but returns only 0.
@badarmunirr any update for the fix?
Any update on this. I am also facing the same issue
@nareshbak , try this piece of code once. It works for me. Let me know if you face any issue further.
public BrowserCommandResult<List
foreach (var dialogItem in dialogItems)
{
//var titleLinks = dialogItem.FindElements(By.XPath(".//label/span"));
var divLinks = dialogItem.FindElements(By.XPath(".//div"));
if (divLinks != null && divLinks.Count > 0)
{
//var title = titleLinks[0].GetAttribute("innerText");
var divId = divLinks[0].GetAttribute("id");
list.Add(new ListItem()
{
//Title = title,
Id = divId,
});
}
}
return list;
}
This is working for me @srinu24k . Thanks for this fix
Bug Report
EasyRepro Version
UCI or Classic Web
Online or On Premise
Browser
Describe the bug![image](https://user-images.githubusercontent.com/38425186/89856529-25544800-dbb7-11ea-95ea-51916c395bcc.png)
Lookup field is not accepting the value although its available in the list. Message: Test method Microsoft.Dynamics365.UIAutomation.abc.UCI.Entities.PSACases.Projects_17113_ValidateFieldsOnPlanBPFStage threw exception: System.InvalidOperationException: List does not contain a record with the name: Lifetouch Inc.
Special formatting / display
No Code to reproduce
string Customer = ConfigurationManager.AppSettings["EndCustomer"].ToString(); try { _xrmApp.ThinkTime(WaitTime.WaitFor_3_Sec);
Expected behavior![image](https://user-images.githubusercontent.com/38425186/89856793-e5419500-dbb7-11ea-9f96-325f2c666858.png)
It should accept the value into the lookup.