![]()
3 ways to use keyboard input in QuickTest Professional: Type, SendKeys and Device Replay
There
are three ways to use keyboard input in QuickTest Professional: Type, SendKeys
and Device Replay. Why, you might ask, use the Type or Sendkeys method
at all? While you wouldn’t want to automate a whole script using SendKeys
only, sometimes you may, on occasion, need to automate a section of an
application where there is no object recognition. For example, some
unsupported grids or treeviews in Quick Test Pro can be navigated using a
combination of the HOME, END and arrow keys. Also — I’ve seen
applications where some fields need to have a keyboard event occur to trigger
some other behavior (like tabbing of a field) using the objects standard Set
method –- which would not work in this case.
1. QTP’s TYPE METHOD
Most
objects support the TYPE method. Type will enter the specified string
into an object or perform a certain keyboard combination against an
application. For example:
To
tab off an object you would use the following syntax:
SwfObject(“swfname:=Blank”).Type
micTab
To
enter text:
SwfObject(“swfname:=Blank”).Type “This is my string”
To
send an enter keystroke:
SwfObject(“swfname:=Blank”).Type “
“
You
can also send a combination of keystrokes at one time. The following holds down
the CTRL and the Shift Keys, then presses the “L” key and releases the CTRL and
Shift keys:
SwfObject("swfname:=Blank").Type micCtrlDwn + micShiftDwn +
"L" + micShiftUp + micCtrlUp
*Important
to remember: If you send a down keystroke, be sure to follow it with its
corresponding up stroke, as seen in the above example. Problems can arise
by sending a micCtrlDwn and forgetting to release it using micCtrlUp. So, rule
of thumb — if you are pressing a key, make sure to also release it.
2. VBScript SendKeys Method ( Also check out: QTP’s
VBscript SendKeys FAQ)
There
are instances in which QTP’s Type method does not trigger certain events, or is
unable to mimic certain keystrokes. In these cases, VBScript SendKeys
method can be used. To use the SendKeys you need to first set the WshShell
object:
Dim mySendKeys
set mySendKeys = CreateObject("WScript.shell")
mySendKeys.SendKeys(“{TAB}”)
To
send the text you would use:
mySendKeys.SendKeys(“This is my string”)
To
send an enter keystroke:
mySendKeys.SendKeys(“~”)
*A
few important tips: Unlike the QTP TYPE method, you will need to use
curly braces for arguments like a TAB or Up arrow key strokes. Also — SendKeys
has the following special characters: Alt(%), Ctrl(^), Shift(+) and
Enter(~) keys.
So,
to send a CTRL and press the A key you would send:
mySendKeys.SendKeys("^A")
If
you need to perform the same keystroke multiple times, you can create a
compound string argument. This will allow you to perform a specific keystroke
and repeat it any number of times. To select, say, the 10th row in a grid
control you might use:
mySendKeys.SendKeys(“{DOWN 10}”)
This
will send the down key ten times. (For a more detailed explanation of SendKeys
check out VBScript Programmer’s Reference.)
Important
–
You’ll need to make sure that the application or object you wish to receive the
keystroke has focus before sending the keystroke.
*Common
issues with this method:
(Sometimes
multiple keystrokes will not work. If this is the case, try executing each one
in a separate line.)
3. Device Replay
This
is an undocumented and unsupported QuickTest method, but can be used as a last
resort. To employ this method, you’ll need to create a Device Replay object.
To
tab off an object:
Dim myDeviceReplay
Set
myDeviceReplay = CreateObject(“Mercury.DeviceReplay”)
myDeviceReplay.PressKey
15
*Remember
that Device Replay uses ASCII characters
To send text you would use:
myDeviceReplay.SendString “This is
my string”
To
send an enter keystroke:
myDeviceReplay.PressKey 28 ‘ASCII
code for enter
From
The HP knowledge base:
|
The
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
Hope
this helps.
- All
- Agile Testing
- Bug/Defect
- Certification
- Conferences
- Database Testing
- Functional Test
- Integration Testing
- Interview
- Java Testing
- Magazine
- Manual Testing
- Methodology
- Mobile Testing
- Network Testing
- Performance Test
- Requirement
- Review
- Risk Management
- Security Testing
- Software Testing
- Standard
- System Testing
- Test Automation
- Test Case
- Test Data
- Test Environment
- Test Estimation
- Test Management
- Tester Career
- Testing News
- Test Plan
- Unit Testing
- Video Tutorial
- Web Testing
- Webinar
| Number | Title | Author | Date | Votes | Views |
| 20614 |
Best foreign films to start with?
Bobbytrern
|
2026.07.10
|
Votes 0
|
Views 10351128
|
Bobbytrern | 2026.07.10 | 0 | 10351128 |
| 20613 |
SileniusStor is specialized in reselling Cheap Aquafadas software online.
Softwareces
|
2022.09.15
|
Votes 0
|
Views 69105191
|
Softwareces | 2022.09.15 | 0 | 69105191 |
| 20612 |
CSStore is specialized in reselling Cheap Steinberg software online.
Softwareces
|
2022.09.04
|
Votes 0
|
Views 69077118
|
Softwareces | 2022.09.04 | 0 | 69077118 |
| 20611 |
Software Tester Community Website
ItSeTsQtBer
|
2021.04.11
|
Votes 0
|
Views 69695871
|
ItSeTsQtBer | 2021.04.11 | 0 | 69695871 |
| 20610 |
SoapUI Certification Course Content
Steveskok
|
2021.02.08
|
Votes 0
|
Views 70155700
|
Steveskok | 2021.02.08 | 0 | 70155700 |
| 20609 |
JavaScript Course Content
Steveskok
|
2021.02.08
|
Votes 0
|
Views 69823903
|
Steveskok | 2021.02.08 | 0 | 69823903 |
| 20608 |
Why most mobile testing is not continuous?
(TestExpert)
|
2021.02.04
|
Votes 0
|
Views 69986167
|
(TestExpert) | 2021.02.04 | 0 | 69986167 |
| 20607 |
8 Common Mistakes When Planning and Documenting Your Tests
(TestExpert)
|
2021.02.04
|
Votes 0
|
Views 71513280
|
(TestExpert) | 2021.02.04 | 0 | 71513280 |
| 20606 |
Types of Performance Testing
Jamessmith
|
2021.01.17
|
Votes 0
|
Views 70628674
|
Jamessmith | 2021.01.17 | 0 | 70628674 |
| 20605 |
How to Build E2E Test Cases (1)
tanthanh
|
2020.05.28
|
Votes 0
|
Views 69932157
|
tanthanh | 2020.05.28 | 0 | 69932157 |
| 20604 |
[White Paper] Delivering better software using Test Automation
tanthanh
|
2020.05.28
|
Votes 0
|
Views 70460697
|
tanthanh | 2020.05.28 | 0 | 70460697 |
| 20603 |
[Whitepaper] How to choose the right API Testing Solution
tanthanh
|
2020.05.28
|
Votes 0
|
Views 70288646
|
tanthanh | 2020.05.28 | 0 | 70288646 |
| 20602 |
[Whitepaper] How to choose the right API Testing Solution
tanthanh
|
2020.05.28
|
Votes 0
|
Views 69968244
|
tanthanh | 2020.05.28 | 0 | 69968244 |
| 20601 |
TestOps Introduction
VTB
|
2020.03.23
|
Votes 0
|
Views 68661143
|
VTB | 2020.03.23 | 0 | 68661143 |
| 20600 |
TestOps Implementation Case Study
VTB
|
2020.03.23
|
Votes 0
|
Views 69940224
|
VTB | 2020.03.23 | 0 | 69940224 |
| 20599 |
Selenium Automation Tester Certification Sample Exam Set 3
(TestExpert)
|
2020.02.03
|
Votes 0
|
Views 70180892
|
(TestExpert) | 2020.02.03 | 0 | 70180892 |
| 20598 |
Selenium Automation Tester Certification Sample Exam Set 2
(TestExpert)
|
2020.02.03
|
Votes 0
|
Views 70401970
|
(TestExpert) | 2020.02.03 | 0 | 70401970 |
| 20597 |
Selenium Automation Tester Certification : Sample Exam Set 1
(TestExpert)
|
2020.02.03
|
Votes 0
|
Views 69628561
|
(TestExpert) | 2020.02.03 | 0 | 69628561 |
| 20596 |
What is agile testing? why is agile testing? and what is the benefits? (20)
oishichip
|
2019.12.26
|
Votes 0
|
Views 69079385
|
oishichip | 2019.12.26 | 0 | 69079385 |
| 20595 |
Crowd Testing — Vantagens para testadores, plataformas e clientes [pt-br]
soikmd2
|
2019.12.14
|
Votes 0
|
Views 69134266
|
soikmd2 | 2019.12.14 | 0 | 69134266 |
| 20594 |
Software Testing Industry Report (Turkey) 2018-2019 (2)
ItSeTsQtB
|
2019.08.08
|
Votes 0
|
Views 69960371
|
ItSeTsQtB | 2019.08.08 | 0 | 69960371 |
| 20593 |
How to bypass security in integration tests in ASP.Net Core
ItSeTsQtB
|
2019.08.08
|
Votes 0
|
Views 71042690
|
ItSeTsQtB | 2019.08.08 | 0 | 71042690 |
| 20592 |
For agile testing, fail fast with test impact analysis
ItSeTsQtB
|
2019.08.08
|
Votes 0
|
Views 70400224
|
ItSeTsQtB | 2019.08.08 | 0 | 70400224 |
| 20591 |
Career Path in Software Testing
^Software^
|
2019.07.28
|
Votes 0
|
Views 69929795
|
^Software^ | 2019.07.28 | 0 | 69929795 |
| 20590 |
Challenges in Big Data Testing
^Software^
|
2019.07.22
|
Votes 0
|
Views 70661600
|
^Software^ | 2019.07.22 | 0 | 70661600 |
| 20589 |
Essential Necessities In Big Data Testing
^Software^
|
2019.07.22
|
Votes 0
|
Views 68794892
|
^Software^ | 2019.07.22 | 0 | 68794892 |
| 20588 |
5 Test Data Generation Techniques
^Software^
|
2019.07.22
|
Votes 0
|
Views 69988682
|
^Software^ | 2019.07.22 | 0 | 69988682 |
| 20587 |
CI and CD for ETL (Extract-Transform-Load) testing.
^Software^
|
2019.07.22
|
Votes 0
|
Views 69758780
|
^Software^ | 2019.07.22 | 0 | 69758780 |
| 20586 |
Quest for Quality Conference : 5-6 Nov 2019 at Dublin, Ireland
VTB
|
2019.07.08
|
Votes 0
|
Views 69528266
|
VTB | 2019.07.08 | 0 | 69528266 |
| 20585 |
TestBash Essentials Conference 2019
VTB
|
2019.07.08
|
Votes 0
|
Views 69783420
|
VTB | 2019.07.08 | 0 | 69783420 |
| 20584 |
UKSTAR Conference : 11-03-2019
VTB
|
2019.07.08
|
Votes 0
|
Views 68893505
|
VTB | 2019.07.08 | 0 | 68893505 |
| 20583 |
Testing in Context Conference Australia (TiCCA) 2019
VTB
|
2019.07.08
|
Votes 0
|
Views 69821800
|
VTB | 2019.07.08 | 0 | 69821800 |
| 20582 |
European Testing Conference 2019
VTB
|
2019.07.08
|
Votes 0
|
Views 70032657
|
VTB | 2019.07.08 | 0 | 70032657 |
| 20581 |
Automation Guild Online Conference 2019
VTB
|
2019.07.08
|
Votes 0
|
Views 70460156
|
VTB | 2019.07.08 | 0 | 70460156 |
| 20580 |
Software Quality Days 2019 : 15 Jan 2019 (1)
VTB
|
2019.07.08
|
Votes 0
|
Views 69508356
|
VTB | 2019.07.08 | 0 | 69508356 |
| 20579 |
Skills required to become a Software Tester (1)
IT-Tester
|
2019.07.08
|
Votes 0
|
Views 70495386
|
IT-Tester | 2019.07.08 | 0 | 70495386 |
| 20578 |
Automated Unit Testing with Randoop, JWalk and µJava versus Manual JUnit Testing
IT-Tester
|
2019.07.08
|
Votes 0
|
Views 68609214
|
IT-Tester | 2019.07.08 | 0 | 68609214 |
| 20577 |
Scrum Testing Guide Book (2)
IT-Tester
|
2019.06.26
|
Votes 0
|
Views 69235382
|
IT-Tester | 2019.06.26 | 0 | 69235382 |
| 20576 |
Acceptance Testing Definition in Testing vs Scrum
IT-Tester
|
2019.06.26
|
Votes 0
|
Views 69811032
|
IT-Tester | 2019.06.26 | 0 | 69811032 |
| 20575 |
User Acceptance Testing Checklist
VTB
|
2019.06.20
|
Votes 0
|
Views 70298713
|
VTB | 2019.06.20 | 0 | 70298713 |
| 20574 |
Firewalls and Types (1)
VTB
|
2018.11.14
|
Votes 0
|
Views 68649568
|
VTB | 2018.11.14 | 0 | 68649568 |
| 20573 |
Senior Test Engineer (1)
VTB
|
2018.11.05
|
Votes 0
|
Views 70078317
|
VTB | 2018.11.05 | 0 | 70078317 |
| 20572 |
Junior Test Analyst
kornadian2
|
2018.11.04
|
Votes 0
|
Views 70061579
|
kornadian2 | 2018.11.04 | 0 | 70061579 |
| 20571 |
Senior Test Engineer
kornadian2
|
2018.11.04
|
Votes 0
|
Views 69669615
|
kornadian2 | 2018.11.04 | 0 | 69669615 |
| 20570 |
Programme Test Manager, 12m, Immed Start, $NEG
kornadian2
|
2018.11.04
|
Votes 0
|
Views 70971730
|
kornadian2 | 2018.11.04 | 0 | 70971730 |
| 20569 |
Junior Test Analyst
kornadian2
|
2018.11.04
|
Votes 0
|
Views 70351960
|
kornadian2 | 2018.11.04 | 0 | 70351960 |
| 20568 |
Dev & Test Manager
kornadian2
|
2018.11.04
|
Votes 0
|
Views 70609687
|
kornadian2 | 2018.11.04 | 0 | 70609687 |
| 20567 |
Senior Test Analyst (Performance Tester)
kornadian2
|
2018.11.04
|
Votes 0
|
Views 70743644
|
kornadian2 | 2018.11.04 | 0 | 70743644 |
| 20566 |
QA Automation Test Analyst
kornadian2
|
2018.11.04
|
Votes 0
|
Views 69536388
|
kornadian2 | 2018.11.04 | 0 | 69536388 |
| 20565 |
Software/Field Testing Engineer
kornadian2
|
2018.11.04
|
Votes 0
|
Views 69761141
|
kornadian2 | 2018.11.04 | 0 | 69761141 |