hp-uft

QTP/UFT - Close all browsers except QC/ALM

那年仲夏 提交于 2019-12-20 04:45:14
问题 Currently I am using the below code to close all the browsers except the ALM browser from where I run the test suite from. However When I run the suite from ALM, the below code identifies 2 browsers - ALM browser and the test case browser. It first closes the test case browser and when it executes the iteration for the ALM browser, it says the browser is not identified when it tries to find the name of the browser. I am not sure why it counts it as a browser if it cant identify it later. Any

Retrieve only numbers and ignore alphabets from String

♀尐吖头ヾ 提交于 2019-12-20 03:07:22
问题 I have strings like 10A or 20B. I want 10 in 10A or 20 in 20B. How to split only numbers from string using VBScript or QTP internal commands? 回答1: I would use a regular expression: s = "20B" Set re = New RegExp re.Pattern = "^\d+" For Each m In re.Execute(s) num = CInt(m) Next WScript.Echo num 来源: https://stackoverflow.com/questions/39601885/retrieve-only-numbers-and-ignore-alphabets-from-string

What is descriptive programming (Programmatic Description) in QTP

本秂侑毒 提交于 2019-12-19 09:57:57
问题 What is descriptive programming in QTP? 回答1: Creating a test without using the object repository is known as descriptive programming since you describe the objects as part of the script. e.g. Browser("title:=Google").Page("title:=Google").Link("text:=Advanced Search").Click Note the := in the test objects' names, this is not a smiley it means that the property title has value Google (as a regular expression). You can also use the Description object via Description.Create . You can see more

How does UFT perform the Click method when using the Web Add In?

回眸只為那壹抹淺笑 提交于 2019-12-19 09:38:41
问题 I am testing a highly javascript based application on Internet Explorer 8.0 with UFT 11.50. I would like to know how UFT implements the "Click" method under the hood when using the Web Add In. Does UFT send a windows mouse event? Does it fire an event (onclick, onmousedown, onmouseup)? I have been seeing some mixed results with my application. 回答1: It can do either, by default UFT replays using DOM events but you can change the replay type to device in which case it queries the HTML element's

QTP/UFT - Adding comments to code in Editor view

為{幸葍}努か 提交于 2019-12-13 09:08:20
问题 How do I add comments in my code via the Editor view for my Actions? I know this is a simple question, but I haven't been able to figure it out, and this seems almost impossible to Google for. I've tried some of the standard commenting types, none of which have worked: // /* */ # -- I know I can add text to the Description attribute for an Action, but I'd like to be able to comment out specific lines in my code as needed. 回答1: Do you mean the expert view where you see the generated code? You

How to start reading from a specifc line in an XML file?

本小妞迷上赌 提交于 2019-12-13 05:49:27
问题 I have an XML file and I need to start reading from a specific line number. As if the previous lines don't exist. For example, if I need to count number of nodes starting from line # 23. This is to be done using VBScript in UFT (QTP). 回答1: You can skip lines in text (line orientated) files by using the SkipLine method. But XML documents are trees of nodes/elements. Whitespace out of elements has no meaning. So it may make sense to ask for the number of child nodes of a specific node (whether

Refresh system variable using vbscript/QTP

谁说胖子不能爱 提交于 2019-12-13 02:58:05
问题 I want to set system variable MQSERVER for connecting to MQ using QTP. Each time this value is changed from QTP, I need to restart QTP to reflect changes. E.g. in the system variables window, MQSERVER = ABCD change the variable using Set objWSH = CreateObject("WScript.Shell") Set objSystemVariables = objWSH.Environment("SYSTEM") objSystemVariables(MQVariableName) = MQVariableValue The variable is set correctly but does not reflect in QTP code when connecting to websphere MQ. Immediately when

Append vbCrLF to UCS-2 Little Endian

谁说胖子不能爱 提交于 2019-12-13 02:55:28
问题 I'm using vbscript via HP-UFT (former QTP). I'm facing with issue which looks pretty simple but I couldn't fix it. I have .CSV files exported from some system and there is no finished CRLF in this file. I need a simple fix to append new line to this file (I know that is possible write-to-another-file workaround) I'm using FileSystemObject like this: Set objFile = objFSO.OpenTextFile(outFile,8)' (outFile,8, true/false/default) objFile.Write "test string" & vbCrLf ' and other different

Database to Array

妖精的绣舞 提交于 2019-12-13 01:03:04
问题 I am trying to write a VBScript UFT test that gets a set of data from a table (it will be 100 records). I am only going to select one column as you can see from the query below. SELECT TOP 100 l_Name FROM lessee I was able to get the first record to display in a message box but I only did this as a test. What I'm trying to do now is add each record into an array so I can later loop through them to change the value of a WebEdit Textbox. The following is my current code but I'm having a little

UFT 12.02 QTP integration with TFS

落爺英雄遲暮 提交于 2019-12-12 04:10:29
问题 I am looking for UFT and TFS integration (Run test from TFS like we did with HPQC) I search on google but no help . If anyone know how to do this please let me know steps. Thanks 回答1: You can use Generic Test to call QTP during the testing in TFS. Make sure QTP is installed on the test agent. See the code here for reference: QTP TFS Generic Test Integration. One more link for reference: Executing remote QTP scripts via Test Agents and Test Controllers. 回答2: Take a look at a solution from