This is a migrated thread and some comments may be shown as answers.

[Solved] UI testing for RadTree - Click on context menu

2 Answers 30 Views
ASP.NET AJAX RadControls Translators
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Atomstodin.is
Top achievements
Rank 1
Atomstodin.is asked on 29 Jul 2009, 10:01 AM

Hi,

I'm trying to simulate the clicking on a context menu item.  I have been using the following code.

_Manager.ActiveBrowser.NavigateTo("http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/contextmenu/defaultcs.aspx");
RadTreeView tree = _Manager.ActiveBrowser.Find.ById<RadTreeView>("RadTreeView1");
RadTreeNode node1 = tree.FindNodeByText("Drafts (2)");

node1.ShowContextMenu();

HtmlAnchor link = _Manager.ActiveBrowser.Find.ByXPath<HtmlAnchor>("/html/body/form/div/ul/li[4]/a");
link.MouseHover();
link.Click();
//MouseClick()
;

I have also tried this code with a HtmlSpan.   The code runs fine highlights and even clicks on the item but then nothing happens.

Do you have any suggestions on how to accomplish this action?

Thanks,
Oli


2 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 29 Jul 2009, 10:29 AM
Hi Oli,

You seem to simulate clicking on the separator represented by the fifth 'li' element. You can try with the next index (5) instead.

You can also get the RadMenu WebAii control and automated this test case using its API. Something like:

            Manager.ActiveBrowser.NavigateTo("http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/contextmenu/defaultcs.aspx"); 
            RadTreeView tree = Manager.ActiveBrowser.Find.ById<RadTreeView>("RadTreeView1"); 
            RadTreeNode node1 = tree.FindNodeByText("Drafts (2)"); 
 
            node1.ShowContextMenu(); 
 
            RadMenu contextMenu = Manager.ActiveBrowser.Find.ById<RadMenu>("MainContextMenu"); 
            // contextMenu.RootItems[5].Click();  
            contextMenu.FindItemByText("Mark All as Read").Click(); 
 

BTW, do you run WebUI Test Studio or the WebAii Testing Framework? Although the WebAii controls API matches the tools differ by the WebAii version as their core.

Sincerely yours,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Atomstodin.is
Top achievements
Rank 1
answered on 29 Jul 2009, 11:42 AM


Hi,

Thanks for quick reply.  I'll try the code you posted and I'm using the WebAii Testing Framework.  

Oli
Tags
ASP.NET AJAX RadControls Translators
Asked by
Atomstodin.is
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Atomstodin.is
Top achievements
Rank 1
Share this question
or