ContributionsMost RecentMost LikesSolutionsRe: FindAllChildren regex difficulties Well, after playing around with it for a while, it looks like I'm not good. I tried var rows = myElement.FindAllChildren("className", "regexp:^trip-details\s*(cancelled)*$", 5).toArray(); and this seems to only return anything containing trip-details instead of that AND trip-details cancelled if it is present. FindAllChildren regex difficulties I'm trying to capture several different forms of a grid's rows; if a row is enabled or disabled, the class name changes between "trip-details" and "trip-details cancelled". I had the regex pattern to use in conjunction with the FindAllChildren method: trip-details\s*(cancelled)* However, there's a stipulation that comes with the FindAllChildren method and regex: Patterns search for partial matches. For example, regexp:notepad matches both "notepad" and "notepad++". To search for an exact match, use the ^ and $ anchors, for example "regexp:^notepad$". - Documentationfor FindAllChildren How would I go about including the anchors? The regex breaks when I test the additions in a site like Regexr (the regex is available athttps://regexr.com/3vah8), but does the anchor placement in TestComplete differ enough from traditional regex in this regard that I can just slap the anchors at the start and end to prevent partial matches? Re: JScript, compile time, and FindChild: Using objects to organize namemappings, doin' it wrong? Ah, I see. Thanks for clarifying, I appreciate it. Re: JScript, compile time, and FindChild: Using objects to organize namemappings, doin' it wrong? a) TestComplete does not provide any intellisense or navigational means that display those internal functions; I noticed this, it's rather inconvenient even if I have that file commented thoroughly, because even with comments someone else would have to dive into the file instead of just being able to get some intellisense on it. b) Internal functions cannot be 'included' from another file and all their body must be provided inline. I don't understand; is this in regards to having to copy over this file if a related project is created? I thought this is what USEUNIT allowed for. Regardless, I'll keep these points in mind. Re: JScript, compile time, and FindChild: Using objects to organize namemappings, doin' it wrong? The problem is that the parentElement, being outside a function, is assigned immediately upon starting up the test run. So, if the application isn't running yet, that will have a "null" value or, if not null, at least be a "stub" object with no properties but the Exists property set to False. Ah, this is good to know. I'll use the wrapper you've suggested and see what that does for me, but I get the feeling this is what I needed. JScript, compile time, and FindChild: Using objects to organize namemappings, doin' it wrong? I asked a question recently about the usage of regex & wildcards in the FindChild method, and this is where that question came from. My workplace has a test project that hasn't been maintained and was quite a mess, so I went in and updated it, hoping to make the test not only more robust but more legible. My master plan was to create four classes that would represent the four different chunks of the UI that would be tested. Of course, JScript doesn't have "classes" like those who have programmed in langauges like C#, Python, Java, etc. are used to, but one can do something like function UIElement() { // Properties this.Property1 = "hello"; this.Property2 = 3; } var element = UIElement(); Now this seemed great at first glance, because I could represent some GUI element like an element with a grid inside of it like this var parentElement = Aliases.Program.InformationDisplay.InfoDisplayWindow; function InformationGrid() { this.Grid = parentElement.FindChild("className", "info_container", 3); this.GridRows = this.Grid.FindAllChildren("className", "info-details", 5); this.GetDogName = function(rowIndex) { var name = this.GridRows[rowIndex].FindChild("className", "name-panel", 3).contentText; Log.Message(name); } } which would reduce method size despite introducing more methods, introduce code clarity, and provide some level of abstraction for future usage; all pending code review. I wrote the four JScript classes I wanted in another script unit within the project.I had hoped I could go through the following chain of steps for the tests in question: Ensure that our software is running - if it isn't, open it (we have a method for this) Open the window in our software that we want to test (also have a method for this) Call an initializer method from the script unit I just wrote which uses a mix of aliases and FindChild to pointout where the UI elements are in the object hierarchy Run the test, which would then call the various classes and perform the tests Finish the test and close the window However, when I run the test, I get a JScript runtime error that the very first property of the very first class in the script unit that I've written to house my GUI representing classes is "null or not an object" function WorkSearchBar() { this.SearchTypeDropdown = schedDisplaySearchBar.FindChild("className", "dropdown", 6); // Errors out here this.DropdownButton = this.SearchTypeDropdown.FindChild("className", "btn btn-default dropdown-toggle ng-binding", 2); this.SubmitButton = schedDisplaySearchBar.FindChild(new Array("className", "idStr"), new Array("btn btn-default", "submitSearch"), 8); this.SetDropdown = function(item) { this.DropdownButton.DropDown(); this.SearchTypeDropdown.FindChild("contentText", item, 4).Click(); } } The error makes sense because the software isn't open yet (would more than likely be a null reference exception in C#/Java/etc), but this script unit shouldn't be hit yet. In the workflow above, I have the software set to open before anything else in the test method. Shouldn't this only come into play when its needed because of JIT compilation? Is JScript not JIT compiled? Is this "representing GUI elements as objects using a mix of aliases and FindChild" plan an unsupported approach? Regex/Wildcards in FindChild method One of the buttons in my company's program changes between "Show Items" and "Hide Items" when clicked - it's a toggle. I'd like to run some automation with this button, and I've been trying to use the FindChild method rather than a direct mapping sinceelements around it (not the button itself) are prone to change. In theremarkssection of the FindChild method's documentation, it says I can supply a TC regular expression. However, when I provide it, it's unable to find the element. When I provide the full name of the property I want to use instead of regex, it's able to find the element: FindChild(new Array("className", "ObjectLabel"), new Array("btn btn-xs ng-binding", "Show Items"), 4); Does FindChild support the regex method in the first place? Can I do something like "* Items" instead? SolvedRe: Loop through a jquery grid? Great, thanks! I got some discussion going internally and we're simply going to change what we verify on the web page itself, but this is good to know for the future since I doubt this is the last I'll see of this grid. Re: Loop through a jquery grid? Will this do? Re: Loop through a jquery grid? Sorry for the late response. It doesn't look like it; I only get a list of methods for Internet Explorer itself. Instead, I'm allowed to highlight each element of the grid with Object Spy as if it were its own static HTML element.