Contributions
Re: TestComplete not finding object using QuerySelector
Thanks for the reply Colin. 'WebApp' is actually part of the name map, and just refers to the actual web page. So I am then looking within the page for the drop down options. The drop down options I'm looking for are at the top of the DOM so that's why I limited the tree level to 2. The openDropdown is a separate function and this part works fine. The drop down options only appear in the DOM once the drop down is expanded. So I essentially am searching within the page for the element that contains the drop down options, which gets passed into a variable of the type object. This part seems to work as when I debug through the script I can see the variable has a object assigned to it. Manually looking through the object I can find the values I am expecting, so I know its found the correct element in the DOM. So once I have found the drop down options element and assigned it to the variable 'DropdownOptions', I then want to search this variable object using the QuerySelector funciton, which should find the individual drop down option I'm looking for. The issue with all of this really is that it was working. I'm not sure if the QuerySelector function is a little unreliable, or the element isn't being stored properly in the object variable, so I then can't find what I'm looking for.1.3KViews0likes1CommentTestComplete not finding object using QuerySelector
I seem to be having problems when trying to use QuerySelector. I've had this working in the past, but sometimes scripts that I have had working just seem to stop working, despite there being no changes to the html code. In this scenario I already have located an element in the DOM and passed this element to a variable. I am then trying to use QuerySelector on this variable to further refine what I am looking for. Here is the script I have which is written in Python: def selectFromDropdown(PropertyNameId,value): openDropdown(PropertyNameId) propNames = ["tagname","className"] propValues = ["DIV","lae-dropdown-options expanded "] DropdownOptions = Aliases.browser.WebApp.FindChild(propNames,propValues,2,True) DropdownOptions.QuerySelector('p[data-option-value="'+value+'"]').scrollIntoView() DropdownOptions.QuerySelector('p[data-option-value="'+value+'"]').Click() This code is opening a dropdown menu and then selecting a specific option from within that dropdown. The dropdowns being used are custom dropdowns so may work slightly differently to normal ones. Below is the section of the HTML code thats being searched: <div class="lae-dropdown-options expanded " style="left: 1547px; top: 387.22px; width: 324px; bottom: auto;"> <p class="lae-dropdown-option " data-ember-action="9443" data-option-value="default"> <!----> <span class="field ">Default</span> </p> <p class="lae-dropdown-option " data-ember-action="9439" data-option-value="Red"> <!----> <span class="field ">Red</span> </p> <p class="lae-dropdown-option " data-ember-action="9435" data-option-value="Green"> <!----> <span class="field ">Green</span> </p> <p class="lae-dropdown-option " data-ember-action="9431" data-option-value="Blue"> <!----> <span class="field ">Blue</span> </p> <div style="width: 0px; height: 0px; -ms-overflow-y: hidden;"> </div> </div> As you can see from the Python script I am first locating the DIV which has the className "lae-dropdown-options expanded " which gets passed into the variable DropdownOptions, this part works fine. I then want to use QuerySelector to find the elements within the object I passed into the variable, which has the attribute data-option-value, which is this part in the Python script DropdownOptions.QuerySelector('p[data-option-value="'+value+'"]').Click() This part just won't locate the object, so then obviously doesn't perform the click method. This has worked in the past but has just stopped working, and I have had similar occurrences like this with some other scripts. Does anyone know if this should work the way I have it, or if I should be approaching this in different way?1.3KViews0likes3CommentsRe: Find image in image fails
Thanks for the reply. I have tried changing tolerances but still haven't had any success. I have even tried increasing the tolerances to high numbers but it still won't find a match. I also tried creating some new images and saving them as bmp files as I believe that is what TestComplete use by default. I have tried to just use two saves images, rather than getting a picture image during the script execution and then using a saved image to search for. Even using two images and searching for one in the other I still can't get it to find the image. Does anyone know of any images I could use to try this with, that people have used successfully.1.2KViews0likes0CommentsFind image in image fails
I'm trying to use the Find Image within Image feature of TestComplete but it always seems to fail. I have tried this with some very basic images but still can't get it to work, and I'm wondering if I am doing something wrong. I have the following basic Python code for this: def FindImage(): PaintImage = Aliases.Sys.mspaint.wndMSPaintApp.Picture() Log.Picture(PaintImage) CompImage = 'C:\\tmp\\tmp.jpg' rect = Utils.Rect rect = Regions.Find(PaintImage,CompImage) if rect is None: Log.Message("Not Found") I originally tried to get this to work on a web application I am testing, but tried to revert to something very simple when that kept failing. I tried to just create a basic image in MS Paint and then took part of the image and tried to search for it. You can see the images here:http://imgur.com/a/uuz6F I have tried debugging it to make sure that both images are actually being loaded successfully, and I can see each of the objects have the correct values in the Locals Panel. However the rect object is always empty. Is there any reason that this should fail?1.3KViews0likes3CommentsRe: Parameterizing REST request from TestComplete
Thanks for the respone. You did understand correctly what I wanted to pass parameters to SOAPUI tests from within TestComplete, but looks like something that isn't possible, or at least not straight forward to do. Looking at the link you provided it seems an alternative is to use script to directly make rest requests from within TestComplete. I have tried this using python script, and whilst it seems to work, the import part of the script to import some python libraries is very slow. It takes a few minutes just to import the liburl.request library. I'm not sure if this is an issue with TestComplete or something I don't have setup right.2.3KViews0likes2CommentsParameterizing REST request from TestComplete
As part of my TestComplete test suite, I want to be able to make REST requests to avoid unecessary UI interaction. I have managed to get a REST request working using the SOAPUI intergration. However what I want to be able to do is pass values to this REST request from the tests in TestComplete. As an example I have the following json in the body of a SOAPUI REST request: {"username":"${#Project#username}","password":"${#Project#password}"} This allows me to change the project properties for the username and password that will be used as part of the login request. In TestComplete I can then change the project properties of the API call once I have added it to the TestComplete project. Ideally I don't want to have to set these as project properties in order to change their value. I want to be able to take values from the output of a keyword test or script, and use those values in the REST request when it makes the call. Is this possible and what is the best approach for this?Solved2.4KViews0likes4Comments