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

Lookup doesn't work in v9.1 #371

Closed
SachchinAnnam opened this issue Feb 11, 2019 · 25 comments
Closed

Lookup doesn't work in v9.1 #371

SachchinAnnam opened this issue Feb 11, 2019 · 25 comments
Labels

Comments

@SachchinAnnam
Copy link

SachchinAnnam commented Feb 11, 2019

Hello @ggeiszle and @TYLEROL
I tried below snippet for lookup but it didn't worked:
xrmApp.Entity.SetValue({ Name = "language", Value = "English"});
Even SelectLookup isn't helping.
xrmApp.Entity.SelectLookup("language");

Where language is the field name.
Please help with some options.

@dnamrgrts
Copy link

Hello,
xrmApp.Entity.SelectLookup(string field, int index);
For Example-> xrmApp.Entity.SelectLookup("language", 0);
select the first record of your Look up

@SachchinAnnam
Copy link
Author

Hello @dnamrgrts
It give error as 'No overload for method 'SelectLookup' takes 2 arguments '

@SachchinAnnam
Copy link
Author

SachchinAnnam commented Feb 11, 2019

I modified my scripts:

            LookupItem language = new LookupItem { Name = "language", Value = "English" };
            xrmApp.Entity.SetValue(language);
          // **Above snippet works**

            LookupItem country = new LookupItem { Name = "im360_countryid", Value = "Brazil" };
            xrmApp.Entity.SetValue(country);
        // **Above snippet works**
            
            //xrmApp.ThinkTime(2000);
            LookupItem parentID = new LookupItem { Name = "parentcustomerid", Value = "LARSEN & TOUBRO INFOTECH LIMITED" };
            xrmApp.Entity.SetValue(parentID); // as per below exception - it fails on this line
        // **Above snippet doesn't work**

Here is the exception
Test Name: UCITestCreateContact
Test FullName: Microsoft.Dynamics365.UIAutomation.Sample.UCI.CreateContactUCI.UCITestCreateContact
Test Source: D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Sample\UCI\Create\CreateContact.cs : line 22
Test Outcome: Failed
Test Duration: 0:01:15.7415573

Result StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Remote.RemoteWebElement.Click() at Microsoft.Dynamics365.UIAutomation.Browser.SeleniumExtensions.Click(IWebElement element, Boolean ignoreStaleElementException) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Browser\Extensions\SeleniumExtensions.cs:line 41 at Microsoft.Dynamics365.UIAutomation.Api.UCI.WebClient.<>c__DisplayClass61_0.<SetValue>b__0(IWebDriver driver) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Api.UCI\WebClient.cs:line 1587 at Microsoft.Dynamics365.UIAutomation.Browser.DelegateBrowserCommand1.ExecuteCommand(IWebDriver driver, Object[] params) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Browser\DelegateBrowserCommand.cs:line 28
at Microsoft.Dynamics365.UIAutomation.Browser.BrowserCommand1.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) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Browser\BrowserCommand.cs:line 136 at Microsoft.Dynamics365.UIAutomation.Browser.BrowserCommand1.Execute(IWebDriver driver) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Browser\BrowserCommand.cs:line 36
at Microsoft.Dynamics365.UIAutomation.Browser.BrowserPage.Execute[TResult](BrowserCommandOptions options, Func`2 delegate) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Browser\BrowserPage.cs:line 182
at Microsoft.Dynamics365.UIAutomation.Api.UCI.WebClient.SetValue(LookupItem control, Int32 index) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Api.UCI\WebClient.cs:line 1567
at Microsoft.Dynamics365.UIAutomation.Api.UCI.Entity.SetValue(LookupItem control, Int32 index) in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Api.UCI\Elements\Entity.cs:line 302
at Microsoft.Dynamics365.UIAutomation.Sample.UCI.CreateContactUCI.UCITestCreateContact() in D:\EasyRepro\EasyRepro-releases-v9.1\Microsoft.Dynamics365.UIAutomation.Sample\UCI\Create\CreateContact.cs:line 47
Result Message:
Test method Microsoft.Dynamics365.UIAutomation.Sample.UCI.CreateContactUCI.UCITestCreateContact threw exception:
System.InvalidOperationException: unknown error: Element is not clickable at point (346, 64). Other element would receive the click: New
(Session info: chrome=72.0.3626.96)
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT 10.0.16299 x86_64)

@nlipkow
Copy link

nlipkow commented Feb 13, 2019

I'm running into similar issues here:

LookupItem item = new LookupItem { Name = "pricelevelid", Value = "de_sales_2016"};
xrmBrowser.Entity.SetValue(item);
xrmBrowser.ThinkTime(2000);

LookupItem item = new LookupItem { Name = "customerid", Value = "Nancy Anderson (sample)"};
xrmBrowser.Entity.SetValue(item);

The first instruction to set the value for "pricelevelid" works perfectly fine. The second however fails and I get the following exception:
System.InvalidOperationException: List does not contain a record with the name: Nancy Anderson (sample)

The image below though indicates that it does exist. I had for some reason also some undeterministic behaviour while debugging through this error and had the value "Nancy Anderson (sample)" accepted before but could not reproduce it. Maybe this is related to some sort of race condition between the WebClient and the query?

I'm also on the current branch releases/v9.1
image

@SachchinAnnam
Copy link
Author

@TYLEROL : Please help us with any workarounds as we are stuck with this lookup.

@markcunninghamuk
Copy link
Contributor

Any updates on this, not working for us either

@TYLEROL TYLEROL added bug and removed bug labels Mar 27, 2019
@SachchinAnnam
Copy link
Author

Hello @TYLEROL
Any workaround for this bug?

Appreciate your assistance on this.

@markcunninghamuk
Copy link
Contributor

markcunninghamuk commented Apr 10, 2019 via email

@SachchinAnnam
Copy link
Author

@markcunninghamuk: is your workaround related to selecting Account from lookup field?

@BillOwens
Copy link

I am having the same issue. Are there any updates as we are stuck now,

@BillOwens
Copy link

I was able to get my test to work. I added a ThinkTime afterwards and it worked. I beleive we are just not giving the control enough time to fully function.

LookupItem contact = new LookupItem { Name = "primarycontactid", Value = "User, UITesting" };
xrmApp.Entity.SetValue(contact);
xrmApp.ThinkTime(3000);

@ghost
Copy link

ghost commented Apr 23, 2019

i trying this in the V9.1 but Unified Interface doesn´t work... anyone with the same problem?

@markcunninghamuk
Copy link
Contributor

markcunninghamuk commented Apr 24, 2019 via email

@SachchinAnnam
Copy link
Author

It works well, when the lookup has relatively small number of items.. Like while selecting Language or Currency.
But it fails with the below error when we try to select Account where lookup has large number of items.
List does not contain a record with the name: abc_AccountName

@silverbrewer07
Copy link

I am also having this issue. I agree with Sachin it works great when you have a small list. The more frustrating issue for me is it was working fine and just stopped working - guess it could be as we have added more records. The more frustrating part is if you debug the test and get the error and continue it ends up setting the value. This has us stopped in automated testing in the UI.

Thanks!!

@silverbrewer07
Copy link

After some additional testing it actually types the field and the option is displayed in the lookup box but it just doesn't get selected. I have as a temporary work around just used javascript to set the field values but it does not support any conditional testing. This issue has gotten much worse since the latest update in UCI

@SachchinAnnam
Copy link
Author

Do we have any workaround as we are stuck with lookup selection in almost all the scripts?
@TYLEROL : Please help us.

@GowriRamanujapu
Copy link

I am having the same issue. Not able to select a value from look up . CRM FS version is 8.6.0.274

@SachchinAnnam
Copy link
Author

Do we have any updates, as most of us are facing the same issue and not able to proceed further due to the underline issue.

@jlattimer
Copy link
Contributor

@nlipkow your issue might be because of the way the lookup is set using XrmBrowser. Currently the behavior will open the dialog with the top X results and then attempt to do a case sensitive match on the results. So if Price Level only has a few values, it stands to reason it would be in the list of what is initially displayed before a search. In the case of the Contact lookup, is Nancy Anderson isn't in the initial list of records it will fail with the error you're seeing. Submitted PR 479 for this.

dtu11 pushed a commit that referenced this issue May 17, 2019
…tion to ensure the page is loaded to prevent issue with SetValue executing when the load is still happening. Added sleeps to make sure the elements get hovered & clicked properly (#480)
@jlattimer
Copy link
Contributor

Merged into 9.1 branch - closing

TYLEROL pushed a commit that referenced this issue May 22, 2019
…tion to ensure the page is loaded to prevent issue with SetValue executing when the load is still happening. Added sleeps to make sure the elements get hovered & clicked properly (#480)
TYLEROL added a commit that referenced this issue May 22, 2019
…tion to ensure the page is loaded to prevent issue with SetValue executing when the load is still happening. Added sleeps to make sure the elements get hovered & clicked properly (#480) (#497)
TYLEROL added a commit that referenced this issue May 22, 2019
* Merging alpha branch with new develop branch (#457)

* Adding support for Azure DevOps build testing

* Merging UCI Nav Changes (#453)

* Changes for Forcing UCI from Main.aspx

* Updates

* Committing

* Changes for Missing Switcher in SiteMap

* Remove project

* Delete Documentation.csproj

* Delete Program.cs

* Delete App.config

* Delete AssemblyInfo.cs

* Delete app.config

* Updated App.Config

* App.Config

* Revert "Merging UCI Nav Changes (#453)" (#454)

This reverts commit 88d60cd.

* Perf Enhancement to OpenSubArea (#458)

* Merging alpha branch with new develop branch (#457)

* Adding support for Azure DevOps build testing

* Merging UCI Nav Changes (#453)

* Changes for Forcing UCI from Main.aspx

* Updates

* Committing

* Changes for Missing Switcher in SiteMap

* Remove project

* Delete Documentation.csproj

* Delete Program.cs

* Delete App.config

* Delete AssemblyInfo.cs

* Delete app.config

* Updated App.Config

* App.Config

* Revert "Merging UCI Nav Changes (#453)" (#454)

This reverts commit 88d60cd.

* Adding WaitUntilAvailable to ensure the Timeline popout menu is both opened and clicked, allowing SetValue to work as expected. (#465)

* Update Grid.Search() method to match org sample data (#467)

* GitHub issues #404 and #380 Completing boolean Gets & Sets for all 3 field formats. Sorry this is a lot at once but I thought it made sense to keep it together (#483)

* GitHub issue #439 Fixed OpenEntity to open specified record instead of re-opening the current record (#484)

* GitHub issue #452 Added UCI  new method to use form selector to change forms (#486)

* Added support for remote execution (#475) (#493)

Added remote execution support for selenium grid for Firefox and Chrome web browsers. This is useful when you need to perform a large number of tests.

* Allows browser height & width to be set manualy to a larger size than the current resolution supports. (#476) (#494)

* Updated SetValue for lookup to use the parameter value to match in the dialog versus only looking at the immediate results. (#479) (#495)

Updated SelectLookup function to utilize previously unused parameter to prevent lookup dialog from opening after clearing the field.

* GitHub issues #394 & #7 Fixes issues with UCI fields not clearing or not removing previous value when updating (#481) (#496)

* GitHub issue #371 Updated SetValue for lookup. Added a WaitForTransaction to ensure the page is loaded to prevent issue with SetValue executing when the load is still happening. Added sleeps to make sure the elements get hovered & clicked properly (#480) (#497)

* Merge into v91
@sathya-devi
Copy link

@TYLEROL @jlattimer I am facing issues in these type of look up field for Contact and Account, Other Lookups(Country) are working. I tried with Current release v9.1.

image

@jlattimer
Copy link
Contributor

Pull request 515 adds the ability to use activity party fields

@ArvindBhat83
Copy link

I still don't see it working while creating cases in UCI. It doesn't set the lookup but the test case execution says it was successful

@rahiltg
Copy link

rahiltg commented Feb 6, 2020

I still don't see it working while creating cases in UCI. It doesn't set the lookup but the test case execution says it was successful

I agree as i am also facing the same problem. I have created a bug with more details.
#750

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