Contributions
Re: Designing a for/while loop to expand varying objects within objects
Thanks for both of your replies! I was able to take your suggestions and utilize them in the following code: var RC, i; RC =WindowObject.RowCount; for (i = 0; i<RC; i++) WindowObject.Expand(i) Using that code enabled TC to expand each occurrence of "+" in the WindowObject grid! However, I ran into an issue where one of the test cases contained a parent row with expandable child rows (please see attached photo). I tried using the code above and it didn't work but when I included additional code to expand the child rows, the parent row expanded and the child rows remained collapsed. The amended code inbold is below: var RC, i; RC =WindowObject.wChildView(0, "Employees").RowCount; for (i = 0; i<RC; i++) WindowObject.wChildView(0, "Employees").Expand(i) Does that mean that in order to open those child rows, I would have to declare a child row within a child row? And since the first parameter of wChildView is asking for the row number, is there a way to iterate on this value within my loop to expand any additional rows? rraghvani, when reviewing a grid that contained 1 parent row and 2 child rows, ObjectSpy revealed a total of 1 rows. However, the ChildCount is 14 so I'm wondering if that figure includes the expandable rows I'm trying to open.830Views0likes1CommentRe: Designing a for/while loop to expand varying objects within objects
Thank you for your suggestions. When you say "get the number of rows of your grid control" are you saying I should know the number of rows in each of my test cases first or that there's a method in TestComplete that will count and return the number of rows?890Views0likes0CommentsDesigning a for/while loop to expand varying objects within objects
I'm trying to design a loop that will use the Expand method to open each "+" sign in the posted screenshot. Here are the issues I'm having: 1. I don't know how to teach TC to recognize the "+" sign as an Object. TC recognizes the overall window as an Object (which I'll refer to as WindowObject) but I want to focus specifically on the "+" signs within the window. Is there a way to select an object within an object? So far the closest I've gotten to identifying individual "+" signs is by calling out the window object's row (i.e. The first "+" will expand if I use WindowObject.Expand(0), the second will expand if I include an additional WindowObject.Expand(1) line, etc). 2. While I can successfully expand those "+" signs by specifically referencing each row of WindowObject, I plan on testing 100s of these windows and they all have different numbers of rows. Ideally, I want my loop to be able to break if there are no more "+" signs to expand but I'm struggling to design my loop in a way that won't generate errors. This is what I've come up with so far when attempting to finetune my test in Javascript var i = 0; while (i < 3); //The 3 is arbitrary, I just wanted to create a boundary to stop the loop WindowObject.Expand(i); i++; Running that test will successfully expand the three "+" signs in the screenshot but will also terminate on an error indicating that "Row 3 is out of bounds" since there isn't a 4th "+" to expand. I'm still fairly new to TestComplete so please let me know if there is anything I need to clarify or if I've left out some important information that could resolve this issue.977Views0likes7CommentsRe: Save a Screenshot of Application window
Success! Thank you for all of your help! Here is how I solved the issue: mypathstring = Project.Variables.Var1.Value("ConsumerID") +".jpg" Since the Data Driven Loop wizard converted my Excel file into the bolded value above, I was then able to successfully use that to reproduce Marsha_R's solution in the RenameFile method below: aqFileSystem.RenameFile(Log.Picture(Sys.Desktop.Picture(), "test1.jpg"), "C:\\Users\\MYNAME\\Desktop\\Test Docs\\Test Screenshots\\"+mypathstring) The test produced jpg files that were named according to the ID field in my Excel document as desired. Thank you again for your assistance!1KViews1like0CommentsRe: Save a Screenshot of Application window
Hi Marsha_R, Thank you for your help so far. I've set up the Data Driven Loop to pull the IDs from my Excel file but I'm not sure where to implement your variable solution. This is how I've interpreted your advice: var mypathstring = EXCELDATA + ".jpg" aqFileSystem.RenameFile(Log.Picture(Sys.Desktop.Picture(), "test1.jpg"), "C:\\Users\\MYNAME\\Desktop\\Test Docs\\Test Screenshots\\mypathstring") Would I just need to reference the name of the Excel file to create the variable and then call the variable as part of my file path in the RenameFile method as illustrated above? Or would I need to create a variable for each 5-digit ID in my file shown below: var mypathstring = "11111" + ".jpg" var mypathstring2 = "22222" + ".jpg" var mypathstring3 = "33333" + ".jpg"1KViews0likes2CommentsRe: Save a Screenshot of Application window
Thank you so much for the advice, the MoveFile method resolved the issue of downloading the screenshot to the folder of my choice! The new problem I have now is turning this script into a loop that renames each screenshot, ideally mapping the unique ID of each app window to the file name. I'm using the RenameFile method and this is how I've set up the script so far: Log.Picture(Sys.Desktop.Picture(), "test1.jpg"); aqFileSystem.RenameFile(Log.Picture(Sys.Desktop.Picture(), "test1.jpg"), "C:\\Users\\MYNAME\\Desktop\\Test Docs\\Test Screenshots\\test1.jpg") My loop is designed to pull ID numbers from an excel sheet to open an ID-specific app window, take a screenshot, and save it to the designated folder with the ID number as the file name. The code below is used to pull the IDs in the excel sheet: Aliases.MYAPP.frmMainMenu.SplitContainer1.SplitterPanel2.ctlMain.ucConsumerSearch.gcConsumers.TextEdit.SetText(Project.Variables.Var1.Value("ConsumerID")) Is it possible to insert that code into the NewPath argument for the Rename method? Or is there a better way to map the ID value in the excel sheet to the screenshot filename? Note: Apologies for the message formatting, my reply keeps getting blocked by an invalid HTML message error.1.1KViews1like4CommentsSave a Screenshot of Application window
Hello, I am fairly new to TestComplete and have been exclusively working with Keyword Tests. I'm trying to take a screenshot of an application window and then save that file to a folder on my computer. I've listed the attempts I've made below: 1. I tried incorporating the Snipping Tool app into my test recording. I received the following error: "The object 'ScreenClippingControl' does not exist" 2. I tried using the PrintScreen button in my test recording but it defaulted to the Snipping Tool app. Same problem as #1. 3. I tried using the Post Screenshot operation in my test but it only posts a picture to the test log. I want a .png or .jpeg of the screenshot downloaded to a folder on my computer. 4. I attempted to convert my Keyword Test into a script. After searching through this forum, I tried using the SaveToFile method. No file was generated in the folder I specified. My code is below (CAPS signifying placeholders for client-sensitive material): var pic = MYPHOTO.Picture(); pic.SaveToFile("C:\Users\MYNAME\Desktop\Test Docs\Test Screenshots") 5. I attempted to add another code solution I found on the forums. I received a "TypeError: This is not a function" when I entered the following code: Sys.Desktop.Picture.SaveToFile("C:\Users\MYNAME\Desktop\Test Docs\Test Screenshots\Desktop.jpg") In summary, I'm certain I'm missing a crucial step but I'm not sure what I'm doing wrong and what option is going to produce the desired outcome. Can any TestComplete experts help out this beginner?Solved1.2KViews0likes8Comments