Contributions
A cache mechanism to Find GUI objects
Hi all, I have implemented a cache mechanism (dictionary based) in order to improve performance in the way GUI objects are searched in the system when testing a web application by executing a battery of automated test cases. I am using the find function (eval function was not a solution as it didn't provide good response times in my case) and the automation code is done in c# script with TC 11. As it apparently works well in Chrome and automation is faster now, I am experiencing some issues in Firefox when executing the battery of automated test cases. I observe that Firefox consumes increasingly more memory up to a point where the web application behaviour becomes unstable. Below I show the basics of the cache mechanism along with an explanation (sorry if it's so long). A text file is attached too for indentation purposes. If someone can help I would be very appreciated. Thanks a lot in advance. //Variables are declared in a global script module that will be used everywhere //The cache mechanism is based on a dictionary object, and the search of the //GUI objects in the system is based on the "Fullname" unique property //dictionary (key, value) structure that contains the fullname of the //GUI object (key) and the object returned by the find function (value) var dict_GlobObjects; //Initialization section: before any test case is called the following //initialization code is executed. This code is placed in an initialization //script module. dict_GlobObjects = new ActiveXObject("Scripting.Dictionary"); //Working section: The following function is called many times during the test //battery execution each time an interaction is needed with a panel object type //the function LowLevel_Panel_Exec is called //Similar functions are defined for links, pages, etc function LowLevel_Panel_Exec(strAction, dict_Parameters, dict_TstCompl) { var myFullname; //the fullname property of the panel object to interact with myFullname = dict_TstCompl["Item"]("Fullname"); //local variable used to interact with the panel object var myPanelObject; if (dict_GlobObjects["Exists"](myFullname)) { myPanelObject = dict_GlobObjects["Item"](myFullname); if (!myPanelObject["Exists"]) { //If the object does not exist, it is searched again using the //find function dict_GlobObjects["Item"](myFullname) = myQuickFind(myFullname); myPanelObject = dict_GlobObjects["Item"](myFullname); } } //if (dict_GlobObjects["Exists"](myFullname)) else { //The object is not in the cache, put it into the cache, search it first //using the find function dict_GlobObjects["Add"](myFullname, myQuickFind(myFullname)); //local variable to work with is assigned the object content myPanelObject = dict_GlobObjects["Item"](myFullname); } ....here the function works with the myPanelObject accessing its methods and properties.... ....for example a piece of code is ... if (myPanelObject["VisibleOnScreen"]) myPanelObject["Click"](xCoord, yCoord, 0); ... but there is much more code not included as it's of no interest for the issue ... } // LowLevel_Panel_Exec() //The function myQuickFind is a function that searches the GUI object in the object hierarchy //of the system, it is an expensive function, so if it's possible to avoid it, use the values //in the cache. It is located in a module that can be accessed from the rest of the script modules //It consists of a particular use of the find function in which the hierarchy of each call //is just one (see third parameter below), it is a directed search from the parent to the last //child in the hierarchy. The results are better than a single call like //pParent["Find"]("FullName", strChildFullName, 100); function myQuickFind(FullName) { var pChild = null; .....Loop begins .... pChild = pParent["Find"]("FullName", stringChildFullName, 1); .... ..... Loop Ends return pChild; } //Ending section: once the whole battery has been executed the following code is //executed (resources are released) if (dict_GlobObjects.Count > 0) { dict_GlobObjects["RemoveAll"](); }839Views0likes1CommentRe: Objects nor recognized in Chrome v48
Hi Tanya, theUse legacy web testing features project option was the key. As I created the working project wit TC v8, the setting was activated. That had too other comsequences as well (for example the drop down combo lists didn't work well on my automation framework, as TC indicated me that VisibleOnScreen of the elements in the list was false when it wasn't, after clicking in the combo). Since I deactivated that option everything works perfect, so thank you very much. BR, Jose Luis.1.5KViews0likes0CommentsObjects nor recognized in Chrome v48
some days ago I reported a problem in Test Complete v11 to recognize the objects in a web application (with Chrome v48). I thought the problem was solved as I managed that the object browser to recongnize the objects of my application. The fact is that when I tried to execute the test battery against Chrome, the issue has come back again. I've checked that the conditions specified in the "Preparing Chrome for Web Testing" article are met in my laptop (Windows 7 Professional 64 bits). I've realized that when I open my automation project in Test Complete v11.20 the objects of the Chrome application are not recognized as such (I get Chrome Legacy Window instead) and six instances named Sys.Process("chrome"...) are shown in the object browser (I just started one instance of chrome manually). If I close the Test Complete project, the object browser shows just one Sys.Browser("chrome") instance and now I'm able to recognize the objects inside the web application (panels, headers, links, text boxes, ...) and the object spy highlights them individually. Can anyone help? Is there any project setting that affects this behaviour? It worked perfectly some time ago in Chrome, with previous versions of Chrome of course (the laptop is the same). Thank you very much.Solved1.6KViews0likes2CommentsRe: Is Chrome v48 supported by TC 11.20? Objects not recongnized.
Hi Tanya, thanks for your response. According to the document you referred, I had everything correctly configured. Now it works. What happened to me was that from the object spy tool no objects in the Chrome Web application were recognized (the outer frame was the only one that highlighted as I hovered the mouse over it), and then I tried it from the object browser and to my surprise I saw that the objects were perfectly recognized (right clicking on them the highlight feature worked). Since then, the object spy recognises all the application inner objects. Thank you. JL.1.3KViews2likes0CommentsIs Chrome v48 supported by TC 11.20? Objects not recongnized.
The extension 11.20.1491 is enabled inchrome://extensions/, when executing TC 11.20, objects of the Chrome application I'm testing are notrecongized, just the outer frame is. Is there any planned patch for this issue? My current Chrome version is "Version 48.0.2564.97 m" Thanks in advance.Solved1.3KViews0likes2CommentsRe: ToURL method seems not to work
Hi Tanya, thanks for the response. When I enter in my dowload area from Smartbear web page I dont see version 10.40.2018 of Test Complete, I only seeversion 10.40.2015 from 9/19/2014 (that is the one I downloaded some days ago). The only version 10.40.2018 that I see is from Test Execute product. Where can I get version 10.40.2018 of Test Complete? Thanks and regards, JL.1.5KViews0likes0CommentsToURL method seems not to work
Hi, I've upgraded from Test Complete 10.30 to 10.40, and in the new version I'm not able to execute the below simple program. Firefox is launched, but when executing ToUrl method a message "Unable to find the object ObjectIdentifier", any clue? function Launch_Firefox() { var firefox; TestedApps.firefox.Run(1, true); firefox = Aliases.firefox; firefox.ToUrl("http://localhost/vr-web-13.2/Authentication/Login"); } Regards.Solved2.2KViews0likes7CommentsRe: Issue with "Objects" whit chrome 34
I have the same problem with object recognition, so all my automatic test cases have stopped working. Really poor approach if each time that a new browser version is shipped we have to wait for a patch. Of course I will stop automatic updates for Chrome in the future after such these bad experiences.1.8KViews0likes0CommentsRe: Any performance issue in Find, FinChild ... funtions family in TC 10?
Hi again Hanya, I’ve been thinking about your suggestion. I understand that I can use the eval function to access an object even if I have not accessed it before, for example (considering I currently know already the fullname property of the object strChildFullName): ChildObject = eval(strChildFullName); if (ChildObject ["Exists"]) { //Any child object method or property would be accessible here pChildObject ["Click"](); } Else { //Object doesn’t exist } Here the key for me is the time it takes to perform the instruction: ChildObject = eval(strChildFullName); I’ll check if it works, and if so I’ll measure the time it takes. Thank you very much again for the idea. Regards, Jose Perez.1.1KViews0likes0Comments