Hi,
i have written a script to collect menu paths from a menu in a silverlight application. The menus are shown\added on demand to the menu tree (when someone hovers or click the parent menu, only then sub menus are loading to the DOM tree), so i need to refresh the DOM tree at regular interval. One more thing to note that the size of DOM also getting increased as we going on opening new menus and their sub menus.
Below is the code i am using to collect the menu paths.
01./// <summary>02. /// Find all available menu paths.03. /// </summary>04. /// <returns>Returns collected menu paths.</returns>05. public override List<MenuPath> CollectPaths()06. {07. List<FrameworkElement> mainMenuItems = RootElement.Find.AllByExpression(new XamlFindExpression("xamltag=oatimiddleclickmenuitem")).ToList();08.List<MenuPath> menuPaths = new List<MenuPath>();09. menuPaths = CollectMenuPaths(filteredMenuItems, MenuPath.EmptyPath, 1);10. return menuPaths;11.}12. 13./// <summary>14. /// Collect menu paths by finding the controls inside the DOM tree.15. /// </summary>16. /// <param name="menuItems">Collection of main menu items.</param>17. /// <param name="currentPath">current path.</param>18. /// <param name="menuPaths">collection of collected menu paths.</param>19. /// <returns></returns>20. private List<MenuPath> CollectMenuPaths(List<FrameworkElement> menuItems, MenuPath currentPath, int level)21. {22. List<MenuPath> pathList = new List<MenuPath>();23. foreach (FrameworkElement menuListItem in menuItems)24. {25. FrameworkElement menuItemTextBlock = menuListItem.Find.ByExpression(new XamlFindExpression("xamlTag=grid", "|", "xamlTag=textblock"));26. if (menuItemTextBlock != null && !string.IsNullOrEmpty(menuItemTextBlock.TextLiteralContent))27. {28. if (menuItemTextBlock.TextLiteralContent == "MRTU")29. {30. Console.WriteLine("Mine");31. }32. MenuPath currentMenuPath = currentPath.Append(new MenuId(menuItemTextBlock.TextLiteralContent));33. FrameworkElement expandIcon = menuListItem.Find.ByExpression(new XamlFindExpression("xamlTag=path", "name=#ExpandIconBackground|ExpandIconForeground"));34. if (level == 1 || expandIcon != null)35. {36. menuListItem.EnsureClickable();37. menuListItem.User.HoverOver();38. Playback.Wait(100);39. Plugin.OwnerApp.RefreshVisualTrees(); //Refreshing silverlight visual tree.40. Playback.Wait(100);41. menuListItem.Refresh();42. }43. List<FrameworkElement> innerMenuItems = menuListItem.Find.AllByExpression(new XamlFindExpression("xamltag=oatimiddleclickmenuItem")).ToList();44. if (innerMenuItems.Count > 0)45. {46. pathList.AddRange(CollectMenuPaths(innerMenuItems, currentMenuPath, level + 1));47. }48. else49. {50. pathList.Add(currentMenuPath);51. }52. }53. }54. return pathList;55. }Its working fine for me when we have small menus (let say less then 500 menu paths under the main menu). But when we have larger menus (say more then 500 to 5000 menu paths under the main menu) ,
In that case in the start of the menu scraping it works fine, but as we progressing its performance getting worsts (as DOM tree size also increasing simultaneously) and at a certain point it throwing me : "OutOfMemoryException" in System.dll at line no - 41 (menuListItem.Refresh()).
I tried to copy the Visual Tree at the time of exception and found that the size of visual tree text is of 2.5MB file.
Note : I am runiing it on a dedicated automated system with 16GB of memory.so i have enough memory for this. This script is a part of our regression solution, so we have to run it over on any system whether large or small. i want to make it such that it can work on a large menu as well.
Please look into this ASAP.
Thanks & Regards
Vinay
I am sure that I am just missing a setting, but I need to be able to manually login to a website and it requires 2 factor authentication. When the screen pops up, it closes about 1 second later before I can select my active key. I tried just clicking on the About Internet Explorer button once the browser was launched and had the same results.
I am just using the lines of code used in the getting started lesson:
Settings mySettings = new Settings();
mySettings.Web.DefaultBrowser = BrowserType.InternetExplorer;
Manager myManager = new Manager(mySettings);
myManager.Start();
myManager.LaunchNewBrowser();
myManager.ActiveBrowser.NavigateTo("Http://www.google.com");
Once the browser is active, click on the gear and then the About Internet Explorer. The window pops up and immediately closes.
Thanks in advance for your help.
Kevin Stone
Lead Software Engineer
<div id="rightContainer" role="main"><section class="application-plugin using-bootstrap"></section><iframe scrolling="no" allowtransparency="true" class="application-plugin-iframe" allowfullscreen="true" style="width: 100%; overflow: hidden; height: 928px;" src="http://plugins/application...">#document<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml"><head></head><body><div id="PluginTarget" "></div><div class="plugin-landing-page "><div class="plugin-landing-page-tiles clearfix ">::before<div class="col-md-4 col-sm-4 plugin-program-container "><div class="plugin-program "></div>//I want to click at this element</div><div class="col-md-4 col-sm-4 plugin-program-container ">...</div></div> </body></html></iframe> </section><div style="display:none; "></div></div>Manager.ActiveBrowser.Frames.RefreshAllDomTrees();Manager.ActiveBrowser.RefreshDomTree();Manager.ActiveBrowser.Frames.WaitAllUntilReady();int framesNumber = Manager.ActiveBrowser.Frames.Count;Browser topFrame = Browser.Manager.ActiveBrowser.Frames["application-plugin-iframe"];topFrame.RefreshDomTree();topFrame is always null no matter how many times and in what sequence I’ve refreshed.
framesNumber is always null too.
2)
var topFrame = Manager.ActiveBrowser.Find.ByAttributes<HtmlControl>(string.Format("{0}={1}", "class", "application-plugin-iframe"));Predicate<HtmlControl> filter = new Predicate<HtmlControl>((control) => control.Attributes.Any(a => a.Name == "class=" && a.Value=="plugin-program"));var myBox =topFrame.Find.ByCustom<HtmlControl>(filter);Using this approach I’m able to get the iFrame as HtmlControl or HtmlContainerControl element but myBox element is always null.
3)
var iFrame1 = Browser.Find.ByExpression("tagname=iframe");var iFrameHtmlControl = new HtmlControl (iFrame1);IUiSearchable searchable = new SearchableUiContext<HtmlControl>(iFrameHtmlControl);searchable.Refresh();HtmlControl result = searchable.Find.ByAttributes<HtmlControl>(string.Format("{0}={1}", "class", "plugin-program"));var topFrame = Manager.ActiveBrowser.Find.ByAttributes<HtmlControl>(string.Format("{0}={1}", "class", "application-plugin-iframe"));allSubElements.AddRange(start.ChildNodes);5)
Manager.ActiveBrowser.Actions.InvokeScript("$('body /deep/ #PluginTarget .plugin-program.click();");This script worked when executed in Chrome Browser console but I need to click inside the Shadow DOM before. I still can’t do that from the test so executing JavaScript to click the desired element also failed.
As you can see I'm running out of ideas for this issue which is quite frustrating. Since the main logic of my app reside in that iFrame not being able to operate with it is a true deal breaker for me.
Thank you in advance for any help.
Kind regards,

I am facing an issue with Htmlspan clicking over a Menu Item. The issue is if I am using the below code (for example) it is working fine
HtmlSpan menu = manager.ActiveBrowser.Find.ByExpression<HtmlSpan>("tagname=span", "TextContent=~Management Process");
menu.Click(false);
But, when I am using this code it is not working
HtmlSpan menu = manager.ActiveBrowser.Find.ByExpression<HtmlSpan>("tagname=span", "TextContent=Management Process Dynamic");
menu.Click(false);
I am not able to understand why the exact TextContext is not working, I can't rely on the partial one, because multiple menu items can start with the same name (not now but may be in future). Please let me know if I need to change the Find Expression or I am missing something.
Regards,
Arvind Dhiman

Hi,
In my project I have two tests, one for 'Accounts' and another for 'Advanced Find'
The 'Accounts' test has a coded step..
public void SelectAccountTypeByName(String typeName, Browser xframe)
{
I would like to test a grid (ASP.NET) with batch editing by using testing framework. To trigger the batch editing function, a user activate this with the mouse up event. If I use MouseClick(MouseLeftClick) or MouseClick(MouseLeftUp), the editing was not activated. Thank you for your help.
I'd like to run my tests on a different server. Therefore I copied my project .exe along with all the .dll files to my server and started to run it.
Seeing as Firefox doesn't have the Telerik Test Studio Automation extension installed on my server the test just hang.
Therefore I'd like to install the extension, however where exactly does one download the extension? It doesn't seem to be available in the Firefox addon store nor any place else.
So my question is, from where do I download the Telerik Test Studio Automation extension for Firefox?

Hello,
I have an automation suite that takes a long time to fully run. It mainly consists of test-cases that take 30s-4m on average, but all add up to 2.5 hours total. As I run the automation, I notice that parsing text from pages seems to get slower and slower and then at some point telerik can't access pages anymore and all InternetExplorer shows is this error:
"PRXY0007: The request or the response message was incomplete or malformed. An existing connection was forcibly closed by the remote host"
Is there a known reason why this would happen? How is it prevented?
