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

SwitchView for Activities i.e Task is not Working #61

Closed
khushanki opened this issue Dec 15, 2017 · 6 comments
Closed

SwitchView for Activities i.e Task is not Working #61

khushanki opened this issue Dec 15, 2017 · 6 comments

Comments

@khushanki
Copy link

I tried to navigate to Task Views from Activities grid view. But not able to do so, I get error as view with "Task" doesn't exists and View with "My Tasks" doesn't exists. Please find my code below:-
xrmBrowser.Navigation.OpenSubArea("Sales", "Activities");
xrmBrowser.ThinkTime(2000);
xrmBrowser.Grid.SwitchView("Task");
xrmBrowser.Grid.SwitchView("My Tasks");

@j621z
Copy link
Member

j621z commented Dec 18, 2017

@khushanki Can you please paste in the stack trace, error message?

@khushanki
Copy link
Author

Hi,
Please find below error and stack trace:-
System.InvalidOperationException : No view with the name 'Task' exists.'

Stack Trace:-
at Microsoft.Dynamics365.UIAutomation.Api.XrmGridPage.<>c__DisplayClass2_0.b__0(IWebDriver driver)
at Microsoft.Dynamics365.UIAutomation.Browser.DelegateBrowserCommand1.ExecuteCommand(IWebDriver driver, Object[] params) 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)
at Microsoft.Dynamics365.UIAutomation.Browser.BrowserCommand1.Execute(IWebDriver driver) at Microsoft.Dynamics365.UIAutomation.Browser.BrowserPage.Execute[TResult](BrowserCommandOptions options, Func2 delegate)
at Microsoft.Dynamics365.UIAutomation.Api.XrmGridPage.SwitchView(String viewName, Int32 thinkTime)
at Medline.Crm.QAAutomation.KeywordToMethod.Test() in D:\Git-SourceCode\Medline.Crm\Medline.Crm.QAAutomation\KeywordToMethod.cs:line 32
at Medline.Crm.QAAutomation.Program.Main(String[] args) in D:\Git-SourceCode\Medline.Crm\Medline.Crm.QAAutomation\Program.cs:line 40

@khushanki
Copy link
Author

Hi,
I manage to click Task--> My Tasks view using below code:-
xrmBrowser.Driver.FindElement(By.LinkText("My Activities")).SendKeys(Keys.Enter);
xrmBrowser.Driver.FindElement(By.LinkText("Task")).Click();
xrmBrowser.Driver.ClickndWait(By.LinkText("My Tasks"), new TimeSpan(0, 0, 4));

However let me know if any other method I can use like SwitchView .

@TYLEROL
Copy link
Member

TYLEROL commented Mar 1, 2018

Thanks for sharing @khushanki

I have added a feature request to the backlog to expand upon the SwitchView method and add capabilities for Activity entities.

@TYLEROL
Copy link
Member

TYLEROL commented Mar 22, 2018

Closing this as an item is on the backlog tracking this work. We'll update at a later time to confirm this work has been completed.

Thanks,
Tyler

@TYLEROL TYLEROL closed this as completed Mar 22, 2018
@hasinthanagodavithana
Copy link

Hi,

In order to this to work in the Activities window, you need to switch the view first. The activity page is construct in an iframe. The filter is in that iframe and you need to change the driver focus the iframe first then you can identify the elements.

Try below code:

            xrmBrowser.Driver.SwitchTo().Frame(xrmBrowser.Driver.FindElement(By.Id("contentIFrame0")));

            xrmBrowser.Driver.FindElement(By.LinkText("My Activities")).SendKeys(Keys.Enter);
            xrmBrowser.Driver.FindElement(By.LinkText("All Activities")).Click();
            xrmBrowser.Driver.ClickndWait(By.LinkText("All Activities Created in Current Year"), new TimeSpan(0, 0, 4));

Regards,
Hasi

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

No branches or pull requests

4 participants