Can't able to read the data from app.variableMap
Hi team, I am using the below code to read the data from variable map and it is working fine in normal browser. But, if I try to execute the same in the BitBar, I can't get the values from variable map. varpageObj =Sys.Browser().Page("*");//this line will get the object of current browser page, I need to get the object of the page which is in the bitbar. var lineItemsInCartArr = pageObj.contentDocument.Script.eval("app.variableMap.productLineItem");386Views0likes0CommentsJavascript for loop using date as counter
Hi. I'm trying to create a for loop using a date starting with 1/1/2021 and going to today's date as below: for(var d = aqDateTime.SetDateElements(2021, 01, 01); d <= aqDateTime.Now(); aqDateTime.AddDays(d, 1)) { ... } The var d is not incrementing by 1 day each time. It's staying constant at 01/01/2021. Can someone point me in the right direction? I had it working when I was using a javascript date object, but that creating other hurdles inside the for loop. I really want to use a DateTime (or Date) in TestComplete's native date format. Thanks!Solved1.2KViews0likes3Commentsnot able to use Drag method
Hi, I am trying to drag and drop an item from one panel to another. When i record and play the script, it works fine. But when i try to use the Drag method in my script (using javascript), it says Drag is not a function. What is possible wrong here ? Record script - let page = Aliases.pageShoppingPortal; page.panel.Drag(134, 23, 26, 182); Javascript - let memberdrag = page.contentDocument.getElementsByClassName("name cdk-drag"); memberdrag.item(1).Drag(134, 23, 26, 182);Solved2.9KViews0likes18CommentsJavascript: how to create a variant array of strings
From my TC project I want to pass an array of strings to my Delphi application from a JavaScript unit. If I have understood the matter, I need to pass this array as variant. To create the variant array I try to use theCreateVariantArray function using the following code: var varArray = BuiltIn.CreateVariantArray(0,1); varArray[0] = "value 1"; varArray[1] = "value 2"; Unfortunately this only creates the array but the elements remain empty: debugging inside TC shows the Locals panel with the array but it has two empty entries and inside the receiving function in my Delphi application the array also has two elements which are both empty. Searching this board and the internet did not reveal any hints. Many thanks in advance for any help.Solved1.3KViews0likes2CommentsEnum of possible options for TestComplete Element not showing up in Autocomplete / Code Completion
I have a question, I have a small script used to select values for different controls on a webpage. Because these values are finite, they are a perfect candidate for an Enum, so as to reduce the possibility of someone having a typo in text, and also to properly reference values in case they need to change in the future. Please see what I have below: const assuranceLevel = Object.freeze({ LOW: {value: 1, name: ' Low '}, MODERATE: {value: 2, name: ' Moderate '}, HIGH: {value: 3, name: ' High '}, VERY_HIGH: {value: 4, name: ' Very High '} }); function locateButtonGroup (buttonGroupTitleString) { return page.FindChildByXPath("//h4[text()='" + buttonGroupTitleString + "']/parent::div"); } function selectLevel(buttonGroupElement, assuranceLevel) { buttonGroupElement.FindChildByXPath("./descendant::label[contains(text(), '" + assuranceLevel.name + "')]").Click(); } function testPage() { selectLevel(locateButtonGroup("Overall SAL"), assuranceLevel.VERY_HIGH); selectLevel(locateButtonGroup("Confidentiality"), assuranceLevel.MODERATE); selectLevel(locateButtonGroup("Integrity"), assuranceLevel.VERY_HIGH); selectLevel(locateButtonGroup("Availability"), assuranceLevel.MODERATE); } This works as expected, and I can use one of the "assuranceLevel" options to constrain my choices to valid inputs. However, when typing assuranceLevel, when I hit the ".", I would expect an autocomplete window to come up, allowing me to select one of the viable options. That does not happen, and I have to type out the option. This defeats the entire purpose of using the enum in the first place, as the possibilities for typos still exist. It's frustrating that VSCode and sublime text editor can do this just fine, but TestComplete can't. Is there any way to get TestComplete to display options from enums in autocomplete?Solved1.7KViews0likes7CommentsInteracting with HTML DOM objects via javascript or Ajax in TC 14
I'm new to testcomplete. We have an area in our web app that is extremely difficult for testcomplete recorder to understand. We have a hidden ul that become un-hidden on a button click. Each list element has an input checkbox. I'm attempting to select all items in the list and check each item. The recorder is struggling so I thought we could just inject some javascript or ajax to make it happen. In our selenium/.NET C# solution I just executed some ajax like so:$("div[aria-checked*= 'false'] span.dx-checkbox-icon").click() I would like to execute something similar. Below is an example of the hidden ul. <ul class="dx-treeview-node-container" role="group"> <li class="dx-treeview-node dx-treeview-item-with-checkbox dx-treeview-node-is-leaf" data-item-id="0" role="treeitem" aria-label="Period Index" aria-expanded="true" aria-level="1" aria-selected="false"> <div role="checkbox" class="dx-checkbox dx-widget" aria-checked="false"> <input type="hidden" value="false"> <div class="dx-checkbox-container"> <span class="dx-checkbox-icon"></span> </div> </div> <div class="dx-item dx-treeview-item" aria-selected="false"> <div class="dx-item-content dx-treeview-item-content"> <span>Period Index</span> </div> </div> </li> <li class="dx-treeview-node dx-treeview-item-with-checkbox dx-treeview-node-is-leaf" data-item-id="1" role="treeitem" aria-label="Period Begin" aria-expanded="true" aria-level="1" aria-selected="false"> <div role="checkbox" class="dx-checkbox dx-widget" aria-checked="false"> <input type="hidden" value="false"> <div class="dx-checkbox-container"> <span class="dx-checkbox-icon"></span> </div> </div> <div class="dx-item dx-treeview-item" aria-selected="false"> <div class="dx-item-content dx-treeview-item-content"> <span>Period Begin</span> </div> </div> </li> </ul> There are about 45 items in the list. My goal is to add a short script snippet to a keyword test to set the inputs to 'checked'. Any help would be great. thanks!Solved1.4KViews0likes3CommentsHow to stop a scenario in scenario outlines when a step fail in cucumbe js?
In the scenario outline, I would like to skip steps when a step fails in a scenario and to continue on the following scenario. for example : Examples: |param 1| |scenario 1| |scenario 2| |scenario 3| If a step fails in scenario 1, I would like to continue directly to scenario 2 and not executing all the following steps in scenario 1 after the step fails. Thanks for the answers!1.3KViews0likes5CommentsProblem Implementing 0Auth 2.0 Authentication through Javascript Language
Hi . I am working on complex calculation project in Ready APi which has scripting language as"javaScript". We would need to implement Authentication in the Composite Project. Could anyone share the script to retrieve the token automatically through Javascript. I am able to retrieve the details automatically through Groovy but i wont be able to change the project language to groovy as it has more complex language which was implemented using Javascript. It would take more effort to change the language for this issue. Problem Statement: Need support for oAuth 2.0 Implementation using Javascript. Retrieving token automatically. So Please anyone share the code to retrieve the token automatically.2.1KViews0likes7CommentsTestComplete built-in tool for creating documentation (Javascript)
Hello! In our project we have already created a lot of scripts and there will be a lot more. And in the same time the amount of peolple working on that project is increasing, that's why we need to create documentation for our tests. Is there any tool in TestComplete for creating documentation for tests written in Javascript? Tool that will automatically generate JSDoc-files is needed. Any answer will be appreciated. Thanks.Solved1.3KViews0likes2CommentsHow to import a javascript class and extend it in another script unit
Hi I am trying to use two Javascript projects - and export a class defined in one to be extended (inherited) in another. The example herehttps://community.smartbear.com/t5/TestComplete-General-Discussions/how-to-import-a-javascript-class/m-p/149161#M27448 shows how to use require and create an instance of the class. However, I would like to inherit the class (ES6) and define or override the methods. I was able to do this using prototype based inheritance (ES3). But unable to do this using ES6 terms. The "import" keyword usage shows syntax error "Unexpected token import". If I use require, then I cannot actually use it with extends e.g. (Note that I have shared the Parent.js into the project) //In Parent.js class ParentApp { constructor(x) { this.name = x; } } module.exports = { ParentApp: ParentApp } //In Child.js var parent = require("Parent") class Child extends parent.ParentApp { constructor(y, z) { super(y); this.age = z; } } Here the "parent.Parent" is not working. And I can't use import keyword. (Note that sometimes having the script name same as class name seems to cause issues and that's why I use Parent and ParentApp to differentiate) So how do I do this? Is ES6 fully suppported in Test Complete 14?Solved16KViews0likes6Comments