Contributions
How to read excel data into object and pass the values to calling routines (using scripts),
Hello All, --This is my test 1. go to www.amazon.com 2. place cursor on the "search" text field. 3. Read the excel first value "Phone Stand", and place it in the "Search" text field and click "search icon" 4. Repeat #2 and #3 with the other values fetched from excel. What I am looking is, how to read the below data into an object and pass it to the test using scripts ? , and I would appreciate if anyone could help here. I tired the example - https://support.smartbear.com/testcomplete/docs/reference/program-objects/excelsheet/cell.html, but cannot get to pass the data (Phone Stand, Bags, Bike) as a object. ---------------------- Name ---------------------- phone stand Bags BikeSolved727Views0likes1CommentTestcomplete - after logs are generated, how can i run another script ?
Hello, I am trying to find out how to run a test item (Summary Test Case) once all the other tests are executed and the logs for them are shown in the project panel. for example : Test case- 1 --- test item 1 ---test item 2 --- logout & close (end script)Solved1.3KViews0likes5CommentsRe: EvaluateXpath - using keyword test , can we use evaluateXpath.?
AlexKaras a) What line generates the exception? b) What is this NewValue parameter? Where and how it is defined and used? c) I am not sure, but I think that something must be returned from the Run Code Snippet operation in order LastResult variable to be assigned a value. What if you change your line of code to return Aliases.browser.pageXXXXXXXXXURL.panel.EvaluateXPath("//a[contains(@class, \'login-to-load ng-star-inserted\')]"); I am attaching the project file, can you please take a look. keyword test - Test2 Test case Steps Go to url : Maximize the browser Get the xpath of a button (which is the code snippet) , using "evaluateXpath" Process it to check how many are there on the page. Display the count as an output. Note : The same keyword when converted to a script, it works fine, I am curious to know why keyword test is not working.3.1KViews0likes0CommentsRe: EvaluateXpath - using keyword test , can we use evaluateXpath.?
AlexKaras a) What line generates the exception? Right now it is on Step 4 . b) What is this NewValue parameter? Where and how it is defined and used? I have no clue why testcomplete says "NewValue" as I had not configured it anyhwere. c) I am not sure, but I think that something must be returned from the Run Code Snippet operation in order LastResult variable to be assigned a value. What if you change your line of code to return Aliases.browser.pageXXXXXXXXXURL.panel.EvaluateXPath("//a[contains(@class, \'login-to-load ng-star-inserted\')]"); Even if I add "return", it says return type unknown or invalid. I am attaching the project. keyword test : test 2 script - unit 7 here is the steps 1) access the url 2) select the button and take its xpath. 3) use evaluatexpath function to get the total coupons who have the text 4) output message saying ("the total count of buttons whose valueis -" xx) Note : Rename the attahment to .zip.3.2KViews0likes2CommentsRe: EvaluateXpath - using keyword test , can we use evaluateXpath.?
Hi Tanya, Thank you so much for the information, I have created the keyword script for evaluatexpath, but the keyword test fails with the following exception " Unable to evaluate the operation's "NewValue" parameter. Error: ReferenceError: LastResult is not defined", please find the screenshot attached. I then converted the keyword test into a script and ran it, and it works fine. RunCode snippet used is :Aliases.browser.pageXXXXXXXXXURL.panel.EvaluateXPath("//a[contains(@class, \'login-to-load ng-star-inserted\')]"); tried with "QuerySelectorAll", same thing, keyword test fails, but convert to script and run it, it works. Why is the keyword script failing, can you please help here ?3.2KViews0likes7CommentsRe: EvaluateXpath - using keyword test , can we use evaluateXpath.?
Hi Alex, Thank you for the reply, after going thru the documentation (https://support.smartbear.com/testcomplete/docs/app-testing/desktop/windows-store/addressing-objects.html?q=evaluatexpath), I see where the problem is, EvaluateXPath(), this method returns SAFEARRAY that you can't assign to any existing type of KDT variables (you also mentioned the same). With TestComplete 14.0, internal casting allows assigning them to Tables. The resulting table has one column and one row per each object returned byEvaluateXPath(). So now the script fails when I try to get the resulting object into a variable.(see screeshot attached) If the Keyword test is converted to a script, it fails the same steps as that of keyword test. Any help in resolving this issue is appreciated, I would like to know what is wrong in the code below? Error observed in code var LastResult; LastResult = Aliases.browser.page.panel.EvaluateXPath("//a[contains(@class,)]"); Project.Variables.VarTemp.$set("Item", "", "", LastResult); if(Project.Variables.VarTemp != null) error thrown JavaScript runtime error. Error: Type mismatch. Error location: Unit: "TestProject1\TestProject1\Script\Unit3" Line: 12 Column: 30. TestCase Steps: Go to url :https://stopandshop.com/ get the xpath for the text "+ load to card" use the evaluatexpath method to get the total. count the total objects that have "+load to card" label display output message "Total found :" xx);3.1KViews1like0CommentsWhen an error happens, how to call the logout scripts.
Hello, I would like to know when error happens during execution , I would like to call the "Logout & Close Browser" script immediately, how to call it.? so in Test -1 , lets say ifkeyword action 2 fails for some reason, I would like to call the "logout script & Close Browser" immediately and then the control should move to Test -2., how can I do it.? for example: Test -1 --- Login --- keyword action 1 --- keyword action 2 --- script action 3 --- Logout --- close browser Test - 2 --- Login --- keyword action 5 --- keyword action 6 --- script action 1 --- script action 2 --- Logout. --- close browserSolved991Views0likes2Commentshow to create config file can call in test (keyword)
I would like to know how to create a config/property/environment file in testcomplete and call the approparite env url & username & password in keyword test, Or any other suggestions on how to create it.? I dont want to create three different env scripts . for example, if i want to run in QA env, then i should call QA url , QA username and QA password, similary for UAT and DEV env, in one single click. Any help is greatly appreciated. i) QA URL : https://QA.QAenv.com username : test@QA.com password : test@123 ii) UAT : https://UAT.UATenv.com username : test@uat.com password : test@123 iii) PROD : https://PROD.PRODenv.com username:test@prod.com password : test@123Solved2.3KViews0likes3Comments