Contributions
Re: Dynamically verify object property in script via Keyword test
Thank you! That makes much more sense. Here's what I wound up with: function waitToRunExists(parent, childObj, attempts) { var theElement; //Prime the attempts variable if( typeof attempts == "undefined" || attempts == null ) { attempts = 1; } childObj = aqConvert.VarToStr(childObj); var theElement = parent.WaitNamedChild(childObj, 1 ); // Wait for the child object to exist or bail after 500 attempts/loops do{ theElement = parent.WaitNamedChild(childObj, 1 ); attempts++; if (attempts > 500) { Log.Error("Too many attempts. attempts = " + attempts + "."); } } while ( !theElement.Exists || attempts > 500); } This runs much quicker than the keyword test's equivalent method. It should also eliminate the need for arbitrary delays in our tests.2KViews1like0CommentsDynamically verify object property in script via Keyword test
For better or worse, I'm meshing scripts with keyword tests. I'm trying to pass into a function the on-screen object and then the property of said object, like "Exists" or "Enabled". function waitToRunExists(selector, prop, attempts) { var theElement; //Prime the attempts variable if( typeof attempts == "undefined" || attempts == null ) { attempts = 1; } var theElement = selector; // Wait for theElement/on-screen object to be true, or bail after X attempts do{ attempts++; if (attempts > 500) { Log.Error("Too many attempts. attempts = " + attempts + "."); } } while ( theElement.prop == false || attempts > 500); //attempts was 200 // || attempts > 200 } In the keyword test, I'm using the "Run Script Routine". For the prop variable, I've tried string, variant, code expression, etc. It seems like a type issue, but I can't find the correct type. Any suggestions?Solved2.1KViews0likes2CommentsRe: Different Variable Values For Different Workstations
If you haven't found this yet, you should take a peek athttps://community.smartbear.com/t5/TestComplete-General-Discussions/Code-Contest-Export-Importing-Project-Variables/td-p/123978 shiva_ranabhat wrote: Hi Alex, Could you please reference me to how option (b) is done? Best Regards, Shiva2KViews1like0CommentsRe: Calling a script from an Event Handler
UseUnit wasn't working for me, butit did lead me to this article (titled "USEUNIT Statement -- About" in the index help files): https://support.smartbear.com/testcomplete/docs/scripting/calling-routines/declared-in-another-unit/from-gui.html which accomplishes the same thing. My event handler script now looks like this: var EmailResults = require("EmailResults"); //EmailResults is the parent script that holds the PackResults() function. function GeneralEvents_OnLogError(Sender, LogParams) { Log.Picture(Sys.Desktop.Picture(), "Image of the whole screen", "", pmHigher); EmailResults.PackResults(); //This is the name of my email function. } Now I just need to ensure that the error that stops everything is included in the log that's emailed. Thank you so much,Tristaanogre!1.9KViews1like1CommentCalling a script from an Event Handler
So, I just learned about Event Handlers. What amazing things! However, I'd like to send an email from the OnLogError event. My handler script is as follows: function GeneralEvents_OnLogError(Sender, LogParams) { Log.Picture(Sys.Desktop.Picture(), "Image of the whole screen", "", pmHigher); PackResults(); //This is the name of my email function. } When my tests hit an error, I get a javascript error: ReferenceError PackResults is not defined Error location: Unit: "SmokeTest\SmokeTest\Script\SmokeTestScript" Line: 4 Column: 3. I'd imagine this is just a syntax and/or scope issue. How do I call my email function, PackResults()?Solved1.9KViews0likes3CommentsRe: Slow to Load On-Screen Actions for Edit
tristaanogre wrote: SarahEdwards wrote: In my experience, "As soon as I remove the extended find, any steps using that object are broken." I asked SmartBear technical support, "Is there a better way than remapping every object?" Yuriy Peshekhonov fromSmartBear Customer Care said: Unfortunately, there is no other way. TestComplete uses a different logic when recording a test using the "Extended Find" feature. It's not enough to uncheck the option for an object in the Name Mapping. You need to delete the existing Name Mapping scheme and map the object without using "Extended Find". TestComplete doesn't store the information on how to find the object with/without "Extended Find" at the same time, so it's not possible to quickly switch between using "Extended Find" and not using it. Correct... unchecking the option under NameMapping for an already mapped object won't "work" then because, as YuriPeshekhonovpoints out, you have changed, effectively, the method by which that specific object is found... But the option under Tools -> Options -> Engines -> NameMapping, if you uncheck it, won't impact anything you already mapped. Sure, but you'll still have performance issues any time you try to edit the extended-find-enabled name mapped objects. If those are in a test that you'll edit often, I'd imagine that would be less than ideal.4.7KViews0likes3CommentsRe: Slow to Load On-Screen Actions for Edit
In my experience, "As soon as I remove the extended find, any steps using that object are broken." I asked SmartBear technical support, "Is there a better way than remapping every object?" Yuriy Peshekhonov fromSmartBear Customer Care said: Unfortunately, there is no other way. TestComplete uses a different logic when recording a test using the "Extended Find" feature. It's not enough to uncheck the option for an object in the Name Mapping. You need to delete the existing Name Mapping scheme and map the object without using "Extended Find". TestComplete doesn't store the information on how to find the object with/without "Extended Find" at the same time, so it's not possible to quickly switch between using "Extended Find" and not using it.4.7KViews1like5CommentsRe: Slow to Load On-Screen Actions for Edit
I was having delays like this when my name mapping was using "extended find" on every object. That is a default setting. I had to scrap my project and remap everything. I really hope this isn't the case for you. vondie wrote: Hi everyone, I am currently on TestComplete 12.10 Build 602 and experiencing performance issues when trying to edit On-Screen actions in Keyword Tests. I am building an automation suite for Microsoft Dynamics CRM 2016 and have been experiencing performance problems in general, so that might be why I am having this issue. It really is making TestComplete unusuable because I need to edit many of the On-Screen actions that get recorded and it takes 5+ minutes to load the On-Screen edit box. Has anyone else had this problem and do you know what I need to do to solve it? Thanks! vondie4.8KViews1like9CommentsRe: TC runs browser on monitor left of main display
HKosova wrote: In addition towhat tristaanogresaid, you can use .Position() tochange the window position. function Test() { Browsers.Item(btChrome).Run(); var bw = Sys.Browser().BrowserWindow(0); // Move the browser window to (0, 0) and maximize bw.Restore(); bw.Position(0, 0, bw.Width, bw.Height); bw.Maximize(); } This is perfect. Because I use an incognito session in Chrome, my browser won't save any defaults. Thank you!1.9KViews1like0CommentsTC runs browser on monitor left of main display
On my PC where I'm developing my tests, TC always opens the browser window on the monitor to the left of the "main display" (as defined by Windows). Is there any way to specify another monitor? My left-most monitor is portrait instead of landscape, and this can cause some tests to fail, due to width issues.Solved2KViews0likes4Comments