Contributions
Re: How to get IsSupported to return False for stub objects?
Helen, This is actually the code we were using until just recently. The issue with this code, though, is it takes extremely long to process when theAliases do not exist in the object tree. Every time "aqObject.GetProperties(obj, True)" gets called, TestComplete tries to find the Alias in the object tree. If the Alias does not exist in the object tree,thenTestComplete waitsfor the amount of time setup in Current Project Properties > Auto-wait timeout, which is 10 seconds by default, multiplied by however many parts of the Alias are not in the object tree. For example, if we are trying to validate Aliases.Browser.Div.Section.Panel.Form.Input, but "Div" does not exist, then we wait for 40-50 seconds to find out whether or not the Alias is a valid Alias. Since our tests perform this check on every Alias, this can waste a lot of time when our test fails due to missing objects on the screen. Reducing this timeout to 1 second or even 0 seconds would resolve this issue, but many of our tests rely on this timeout being in place. The simplest solution, we think, is to just modify the script to work around the Auto-wait timeout.1.3KViews0likes1CommentHow to get IsSupported to return False for stub objects?
Like the title says, I would like to have the IsSupported method (or some similar method) to return False when a stub object does not have a given property. The reason for this is we are trying to verify whether an Alias exists in our name mapping. Using the IsSupported method seems to work, up until we start dealing with stub objects (the objects are not in the object tree, but are in our name mapping file). I realize this is more of a feature request, so my reason for posting here is to just try and find a different way of doing this. Here is the script we are working with. This script works as long as "currObj" exists in the object tree. We get the error message that we want. The error message does not get posted, though, if we try running the function without our browser open. Every object becomes a stub object, which causes the IsSupported method to return True for everything. Function Validate 'Good alias 'name = "Aliases.Browser.Page.Section.Field" 'Bad alias name = "Aliases.Browser.Page.Field" arr = split(name, ".") If arr(0) <> "Aliases" Then Log.Error "Error. This is not an alias: " & name Exit Function End If objName = "Aliases." & arr(1) Set currObj = Eval(objName) For i = 1 to UBound(arr) - 1 If aqObject.IsSupported(currObj, arr(i + 1)) Then 'This always returns True for stub objects Log.Message "is supported" objName = objName & "." & arr(i + 1) Set currObj = Eval(objName) Else Log.Error "Aliases name does not exist." Exit Function End If Next End Function Is there any way to get IsSupported to return false for stub objects? Is there a different method we can use that would mimic this functionality?Solved1.3KViews0likes3Comments- 1.5KViews0likes0Comments
Using FindChildByXPath with apostrophe in XPath
TC11 Documentation: https://support.smartbear.com/viewarticle/72332/ Hello, We have used FindChildByXPath successfully in the past, but are having an issue when the XPath contains an apostrophe. We are using VBScript. Example: Function FindIcon Dim Field, Value, objField, TempStr, icon Field = "Aliases.Parent.Object" Value = "This doesn't work" Set objField = Eval(Field) TempStr = "//*[@title='" & Value & "']" Set icon = objField.FindChildByXPath(TempStr, False) 'Exception occurs! 'More code here... End Function I'm pretty sure the issue is caused by how we format our "TempStr". We use apostrophes to wrap the value of the element's Title, so including an apostrophe within our "Value" throws things off. (The apostrophes are not wrapping the value - sorry for the confusion.) Is there a better or alternate way to create the "TempStr" that will allow us to include apostrophes? Is there a way to just ignore the apostrophe and still have the majority of the initial "Value" be searched for? Edit: I've also tried using Replace() to find and replace the apostrophe with "?", "*", and "'" (minus the double quotes), but no luck. Again, I think one of these options may work, but not with how we are currently formatting the "TempStr".Solved1.5KViews0likes2CommentsRe: Object hierarchy not refreshed in "FindAll/FindAllChildren" methods
According to the documentation, the object hierarchy is only expected torefresh when no objects are found matching your criteria. If even one object is found, then the hierarchy does not get refreshed and you are stuck with the results from your cached version of the page. At least that's what the documentation says. I have no idea what is actually happeningbehind the scenes. http://support.smartbear.com/viewarticle/71244/ Refresh TestComplete performs the search in the cached copy of the object hierarchy, which may not correspond to the actual hierarchy of objects in the tested application. This may happen, for instance, if the actions that precede the search caused changes in the application state. TheRefreshparameter lets you specify what TestComplete should do if no objects matching the search criteria were found in the cached object tree. If it is True (default), TestComplete will refresh the cached object tree and perform the search once again. If it is False, TestComplete will not refresh the object tree and will return an empty array indicating that no objects were found.968Views1like1Comment[TC11.11] Mapped object moves during playback
This has happened 3 times now on 2 different days. During test playback, the test will fail to find an Alias that it's successfully found before. After looking in my NameMapping file, I see that the object in the "Mapped Objects" section has actually moved to a different location in the object tree. Has anyone else encountered this issue? I do work as part of a team, but everyone else had gone home for the day when this last happened (so this is not an issue of someone else overwriting or merging name mapping files). I've also checked several times to make sure my project has the "Update Name Mapping during test run" option disabled. Below: The objects in the highlighted area are in the correct position now, but I found them where I traced the red line (under the panelPageContent object). Below: This may have nothing to do with the issue, but before the objects were moved, I had run the same test and received the "Searching for a mapped object took too much time" warning. The warning is for the "panelPageContent" object in the highlighted area above, which at the time, had the "Extended Find" attribute enabled. After realizing we didn't need the attribute to be enabled, I disabled it. During the next test run the object got moved.683Views0likes1CommentInvalid Callee in Firefox
TC10 does not add empty span objects to the object browser, which means you can't add them to your NameMapping file. I am using the code below to click one of these empty span objects in order to work around this 'feature'. The code works fine in IE 11 and Chrome, but returns aVBScript runtime error when used in Firefox. VBScript runtime error: Invalid callee Any ideas on a work-around? Google isn't turning up anything useful. Field = "Aliases.App.SendEmailForm.EmailIconBar" Value = "Send Email" Set objField = Eval(Field) For i = 0 to objField.childElementCount - 1 Set ChildItem = objField.children.item(i) 'Firefox - Runtime error: Invalid Callee If ChildItem.nodeName = "SPAN" Then If ChildItem.Title = Value Then '# ChildItem.Click only works in IE. The Click method doesn't exist for this object in Chrome or FF 'ChildItem.Click '# Rect works for IE and Chrome. Set Rect = ChildItem.getBoundingClientRect() x = Rect.right - Rect.left + 1 y = Rect.bottom - Rect.top + 1 Call objField.Click(x, y) fClickEmptySpan = 1 Exit Function End If End If Next <div class="emailIconBar"> <span class="uIcon hover send" onclick="sendEmail(this)" title="Send Email"></span> <span class="uIcon hover saveDraft" onclick="SaveDraft(this)" title="Save as Draft"></span> <span class="EmailBranchSetupError"></span> <span class="DocumentSelect hide" style="display: none;"></span> </div> This recent topic covers the same kind of issue, but it didn't look like Firefox was being tested: http://community.smartbear.com/t5/Functional-Web-Testing/Click-method-not-accepted-in-chrome/m-p/100484#U100484Solved2.4KViews0likes2Comments