getGlobal returned NULL error after upgrade
Using OCR capability provided via Intelligent Quality add-on to test a LabView application. TestComplete python scripts were working fine on TestComplete ver. 15.69. Upgraded to ver. 15.73 and am now intermittently hitting the following error: Run test script 1 - this automatically invokes application and script is run successfully. Application is left running. Run test script 2 - script begins but then immediately hits "Python runtime error. SystemError: <built-in function getGlobal> returned NULL without setting an exception. The error occurs on a simple variable assignment (e.g., "map_sel_pref": spNone) within a python dictionary. The problem appears to be in identifying the spNone (which is one of the SelectionPreference constants associated with the OCR BlockByText() method). If I shut down the application and then re-run test script 2, the test script will invoke the application and test script 2 will be successful. This does not happen consistently -- there are cases where steps 1 and 2 above run fine without error. In cases where I hit the error, I can successfully access the NameMapping objects -- that is, TestComplete can identify the application after test script 1 completes and the application is left running. Since the SelectionPreference parameter is simply an integer, I could change my code from "map_sel_pref": spNone to something like "map_sel_pref": -1 if I knew the constant values, but I don't believe that is documented anywhere. More importantly, not sure why this has become a problem with the latest update. Any suggestions on fixing/resolving this?28Views0likes1CommentCan TC automation be done through remote desktop connection of Windows?
Hi there: My case is as below: 1 Use TC open remote desktop connection of Windows, then input IP, click connect 2 Switch to remote desktop of target server, then do some operation on target app of target server 3 back to local server do next step operation Can TC do thin kind of work like I said? If so, how can I write the script to do like this? I really appreciate any help you can provide.Solved56Views0likes7CommentsRuntimeErrors after upgrading to 15.68.8.7
Hello, I recently upgraded to the latest version of TestComplete, and unfortunately, I'm experiencing issues. I'm still facing a RuntimeError originating from TestComplete's native functions (I'm using it with Python scripts). The errors occur with functions like Log.Message, Log.AppendFolder, and others. However, the problem is quite random, as it's not always the same line of code that fails. As a result, I'm unable to execute any tests at the moment and will need to downgrade to the previous version. Is anyone facing this problem as well?270Views2likes12CommentsHow to read a range of excel cells as List or List of List Python using Excel OLE Objects?
I am migrating the existing vba code to py. so we are using the ole object to read excel like below. can someone help to read range of cells, the documentation points to read only a single value instead of range. https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/sys/oleobject-property-sys-object.html Even i tried to download additional samples and that also don't have any range function. i need a good documentaion for excel using ole Excel = Sys.OleObject["Excel.Application"] Excel.Workbooks.Open("C:\\MyFile.xlsx") RowCount = Excel.ActiveSheet.UsedRange.Rows.Count ColumnCount = Excel.ActiveSheet.UsedRange.Columns.Count for i in range(1, RowCount + 1): s = ""; for j in range(1, ColumnCount + 1): ## Is there anyway to read range or all content of the sheet to list of list? s = s + VarToString(Excel.Cells.Item[i, j]) + '\r\n' Log.Message("Row: " + VarToString(i), s); Excel.Quit();1.2KViews0likes8CommentsHow To: Read data from the Windows Registry
Hello all, I have recently learned how to retrieve data from the Windows registry in JavaScript test units. I am using this to return the OS information and application path information. This is very useful when added to the EventControl_OnStartTest event code. This will allow you to return OS information and other needed data at each test run. Some test management systems may provide this information for you or it may be logged in the in data produced in a pipeline run. This will embed the information directly into your test log. SmartBear KB Links: Storages Object Storages Object Methods Storages.Registry Method Section Object Get SubSection Method This bit of code will return the Product Name and Current Build from the registry. This location may vary between OS's so you will want to check this with RegEdit. let Section = Storages.Registry("SOFTWARE\\Microsoft\\Windows NT", HKEY_LOCAL_MACHINE); let regKeyString = Section.GetSubSection("CurrentVersion").Name; let productIdString = Storages.Registry(regKeyString, HKEY_LOCAL_MACHINE, 1, true).GetOption("ProductName", ""); let currentBuildString = Storages.Registry(regKeyString, HKEY_LOCAL_MACHINE, 1, true).GetOption("CurrentBuild", ""); Log.Message("Windows Version: " + productIdString + " Build: " + currentBuildString ) I have also found the need to find and set an application path and work folder in the project TestedApp for running through a pipeline because the pipeline deploys the application to a non-standard path. let Section = Storages.Registry("SOFTWARE\\WOW6432Node\\<_yourSectionName>\\", HKEY_LOCAL_MACHINE); let regKey = Section.GetSubSection(<_yourSubSectionName>).Name; let Path = Storages.Registry(regKey, HKEY_LOCAL_MACHINE, 0, true).GetOption("", ""); let WorkFolder = Storages.Registry(regKey, HKEY_LOCAL_MACHINE, 0, true).GetOption("Path", ""); let appIndex = TestedApps.Find(<_yourAppName>); if (appIndex >= 0){ if(TestedApps.Items(<_yourAppName>).Path != Path){ TestedApps.Items(<_yourAppName>).Path = Path } if(TestedApps.Items(<_yourAppName>).WorkFolder != WorkFolder){ TestedApps.Items(<_yourAppName>).Params.ActiveParams.WorkFolder = WorkFolder; } } else{ Log.Error("TestedApp " + <_yourAppName> + " does not Exist.") Runner.Stop(true); } I hope you find these links and code examples as useful as I have! Have a great day!59Views0likes0CommentsHow cant I define a param using in different testcase?
Hi there, I have a TC project which has several testcase (wrote by JaveScript), I need to init a big Object before my Project, It only should be inited once, I know TC has a Event named OnTestStart executing before each testcase run, which is not suitable for my case, Does TC have a Event only trigger once like JUnit "BeforeAll" annotation?Solved138Views0likes10CommentsHow to perform certain actions for a specific amount of time in a loop
I want to perform certain action inside a Do Loop statement, in this case i want to ensure that i get out of the loop after ten minutes have elapsed. What should be the MaxDelay+X value ? Sub Test MaxDelay = 0 Do Call aqUtils.Delay(1,"Reports are being signed..") MaxDelay=MaxDelay+ X Loop Until MaxDelay > 600000 End Sub ThanksSolved68Views0likes4Commentshow can I invoke function between different project in one projectSuit?
Hi there, Here is my case, There one projectSuit name TestSuite, I created ProjectOne and ProjectTwo in it, Then created Unit1 in ProjectOne, created Unit1 in ProjectTwo, Is there anythy that I invoke a function of Unit1 in ProjectTwo from a function of Unit1 in ProjectOne? Thanks in adcanced。Solved33Views0likes2CommentsSE Tip : Drag-and-drop one object to another
Hi all, A common challenge in automation is achieving precise drag-and-drop actions, especially when dealing with dynamic or responsive user interfaces. This question comes up regularly in different ways - how do I refine the drag-and-drop action in TestComplete? TestComplete's built-in Drag action is designed to drag a specific Alias object from a given point to another point, but at a pixel offset (i.e. drag Alias....Button by X/Y pixels). While useful as a "jumping off point", this approach can be problematic for obvious reasons (Dynamic UIs, changing screen resolutions, inconsistent offsets) leading to brittle tests. Fortunately, TestComplete method parameters offer a high degree of customisation. By evaluating and utilising exposed properties like ScreenTop/ScreenLeft, we can create more robust and adaptable drag-and-drop actions. This allows us to instead dynamically reference the coordinates of a target object, or better still use exposed values in simple calculations, like figuring out the offset value for the Drag action. This Python script example calculates the offset using the common ScreenTop and ScreenLeft positions of both objects then passes the difference to the Drag action, allowing us to drag one given object to another given object with much more flexibility : def dragToObject(clientObj, targetObj): # Using ScreenLeft property to drag horizontally; ScreenTop for vertical fromObjectTop = aqObject.GetPropertyValue(clientObj, "ScreenTop") fromObjectLeft = aqObject.GetPropertyValue(clientObj, "ScreenLeft") toObjectTop = aqObject.GetPropertyValue(targetObj, "ScreenTop") toObjectLeft = aqObject.GetPropertyValue(targetObj, "ScreenLeft") dragY = toObjectTop-fromObjectTop dragX = toObjectLeft-fromObjectLeft Log.Message("Dragging "+aqConvert.IntToStr(dragX)+"px horizontally and"+aqConvert.IntToStr(dragY)+"px vertically") clientObj.Drag(-1, -1, dragX, dragY) You can then even utilise this in your KeywordTests, by changing the input parameter Mode to Onscreen Object, which enables the Object Picker : Now you have a way to drag one object to another - for example a value into a table? Hope this gets the creative juices going - can you think of other ways you might handle dynamic values in other Action methods? Regards, Mike TestComplete Solutions Engineer95Views5likes2CommentsChecking until a window doesn't exist
Is there any way to check until a window doesn't exist. An inverse .WaitWindow()? Alternatively, is there a version of .Exists() that just returns bool? I've looked around forums and tried implementing this myself, but haven't found anything that works. I'm using TC with Python. I set exceptions to not panic/exit early in TC, but .Exists() still does for some reason, even when caught.132Views0likes8Comments