Contributions
How Do I Find A Mapped Object When It's Values Change
I have mapped an object on the screen, but every time I launch the desktop application and want to click on the object it can't find it because its WPFControlText string changes everytime. The object is mapped the following way: function ReceiveAllSettings() { var btn = Aliases["Architect"]["HwndSource_ShellView"]["ShellView"]["RibbonWindowContentHost"]["MousePanningDecorator"]["NewPaneNotifyingXamDockManager"]["SplitPane"]["TabGroupPane"]["MultiSelectTreeView"]["TreeviewitemIdVenuecollectionkey8275cba680"]["StackPanel"]["StackPanel"]["Button"]["Image"]; btn["Click"](); } The property that always changes is "TreeviewitemIdVenuecollectionkey8275cba680" specifically the numbers I highlighted in red and everything else stays the same. How would I go about finding this particular object every time I launch my application? Any guidance will be appreciated.1.2KViews0likes2CommentsRe: How to Reload CLR Bridge Assembly Programmatically
Well, I am not really testing the assembly I am just trying to use some features from it in my scripts so I don't have to re-write code that already does what I want it to. The problem I have is that after I close all threads the next go around If I want to re run the script it won't it won't work because TestComplete still holds the old reference in memory and only releases them when I close it. It would be a nice feature to have to be able to do this. Anyways, thanks for your reply.1.7KViews0likes2CommentsHow to Reload CLR Bridge Assembly Programmatically
I have reference an assembly in CLR Bridge and I want to be able to reload/refresh the assembly without having to close TestComplete. Is there any way I can do this programmatically? Its a custom DLL I wrote, but it seems that once I run my program once and then try to execute it again it fails because the reference is still in memory after the initial run.1.7KViews0likes4CommentsCreating C# List Using dotNET
Hello, I want to create a script using TestComplete to test a C# API one of my colleagues wrote. How would I go about creating a C# list with TestComplete since it requires all arguments to be passed to a C# function, even though all arguments have a default value. I am using the CLR Bridge to load the DLL for the API. I want to use dotNET in order to call these functions. // Here are two C# functions I want to call: 1) public short SendRequest(List<IP> ipList, double timeout =2.0) 2) public void RefreshWindow(List<Devices> deviceList = null, int maxAttempts = 3, double timeout=2.0) //So Far all I got to work is this but that just creates a list of 'Sytem.Object' not a list of the class I want. // I found this examplehere var typeListOf = dotNET.System.Type.GetType("System.Collections.Generic.List`1"); var paramTypes = dotNET.System.Array.CreateInstance(dotNET.System.Type.GetType("System.Type"), 1); var objType = dotNET.System.Type.GetType("System.Object"); paramTypes.SetValue(objType, 0); var typeListOfString = typeListOf.MakeGenericType(paramTypes); var list = dotNET.System.Activator.CreateInstance_3(typeListOfString); Any help would be greatly appreciated.1.6KViews0likes4CommentsRe: Event Handler(s)
Thanks for the post guys. Looks like from what I read that I will need to try a combination of the try.. Catch.. Finally... inside my main if run error occurs & use the event handler to close connection before I post to the error. I will try this tomorrow and see if it works.1.5KViews0likes0CommentsEvent Handler(s)
Hello, How would I go about creating an event handler that will cover all my bases such as window not recognize, engine failure, posting an error to the event log, etc...? The problem I have is that is that I need to open a TCP connection with a device under test and need to run through all my scripts, but when they do fail I want to be able to close the TCP connection before the error is posted on the event log. This would allow me to establish the connection again when I restart my scripts. I have tried using a try, catch, finally, but this does not cover errors posted to the event log, and I want to be able to just handle anything that went wrong with one event handler..is it possible? If I don't close the connection after a test(s) fail or pass then next time around I want to rerun something the connection is still open therefore I can't establish connection with the device and have to remove the ethernet cable and reinsert it after each run. this is what I have which assumes it will pass all critira on test, but we all know that won't happen all the time..... function main() { EstablishConnection(); Test1(); Test2(); ...... CloseConnection(); }1.7KViews0likes5CommentsEvent Handler(s)
Hello, I am trying to figure out if there is ONE event handler that covers all the bases such as window not recognize, unable to find object, or manually posting an error to the log (for me it stops execution), or an actual engine error occur, etc.. The problem I have is that in my main function the first thing I do is open a TCP connection to the device under test and then run through all my test scripts, but when they fail I want to be able to close the connection and then post the error. So next time I can start the main function again and reopen the TCP connection and so forth. For example function main() { EstablishConnection(); }831Views0likes1CommentRe: Crop Picture with Excel 2007 via COM Server
Thanks for your help this is what I came up with.... function CropImageFromFile(Location, SheetName, Height, Width) { //Select WorkSheet SelectWorkSheet(SheetName); //Insert Picture MsExcel["ActiveSheet"]["Pictures"]["Insert"](Location); //Crop Image MsExcel["Worksheets"](SheetName)["Pictures"]["ShapeRange"]["Height"] = Height; MsExcel["Worksheets"](SheetName)["Pictures"]["ShapeRange"]["Width"] = Width; } function MovePicture(row, column) { var TargetCellLeft, TargetCellTop; var ImageCount; //Select Target Cell Function to select working Cell ActivateCell(row, column); //Get Cordinates for target Cell TargetCellLeft = MsExcel["ActiveCell"]["Left"]; TargetCellTop = MsExcel["ActiveCell"]["Top"]; //Set Current Image Postion to Reference 0 base on image count ImageCount = MsExcel["ActiveSheet"]["Shapes"]["Count"]; MsExcel["ActiveSheet"]["Shapes"]("Picture " + ImageCount)["Left"] = 0; MsExcel["ActiveSheet"]["Shapes"]("Picture " + ImageCount)["Top"] = 0; //Move Image to Target Cell MsExcel["ActiveSheet"]["Shapes"]("Picture " + ImageCount)["Left"] = TargetCellLeft; MsExcel["ActiveSheet"]["Shapes"]("Picture " + ImageCount)["Top"] =TargetCellTop; }962Views2likes0Comments