microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
522 stars 289 forks source link

SetValue and ClearValue for Lookup field are throwing an error when the Lookup field already contains a value #791

Open ejfdejesus opened 4 years ago

ejfdejesus commented 4 years ago

Initial setting of value when the lookup is blank is working fine but when I tried to update to other lookup value or clear lookup value, it is failing the test.

Set Value: xrmApp.Entity.SetValue(new LookupItem { Name = "primarycontactid", Value = "test test" }); //When lookup is blank this is working fine xrmApp.Entity.SetValue(new LookupItem { Name = "primarycontactid", Value = "EasyRepro Test" }); //This is showing below error

ClearValue: xrmApp.Entity.SetValue(new LookupItem { Name = "primarycontactid", Value = "test test" }); xrmApp.Entity.ClearValue(new LookupItem { Name = "primarycontactid" }); //This is showing below error

Error message: Microsoft.Dynamics365.UIAutomation.Sample.UCI.SetValueUci.UCITestOpenLookupSetValue threw exception: OpenQA.Selenium.ElementNotInteractableException: element not interactable

ismail4u commented 4 years ago

What is the update on this bug ? any work around ?

VasanthChidambaram commented 4 years ago

We are also facing this issue from today morning. We have got workaround for this. Please click the Lookup field before entering value. It works for me.

image

xuejunh commented 4 years ago

I click the lookup field before setValue but I still got OpenQA.Selenium.ElementNotInteractableException : element not interactable

ejfdejesus commented 4 years ago

This is what I've done as a workaround.

//Click the lookup field WebDriver.FindElement(By.Xpath("//ul[@data-id='{field}.fieldControl-LookupResultsDropdown_{field}_SelectedRecordList']")).Click

//Click the "X" from the lookup value to remove the value WebDriver.FindElement(By.Xpath("//button[@data-id='{field}.fieldControl-LookupResultsDropdown_{field}_selected_tag_delete']")).Click

//Set value xrmApp.Entity.SetValue(new LookupItem { Name = "fieldname", Value = "textvalue" });