SystemUtil - QTP

QTP 11 adds two new methods to the SystemUtil object: BlockInput() and UnBlockInput().

The Blocklnput method allows you to blof k input from the keyboard and mouse while the script is running. This allows you to avoid any accidental keystrokes or mouse events which can disrupt the behavior of the executing test. This method should is suggested when using methods like Type or Set (with replay type set to mouse), etc. Input is blocked until one of the following events occur:

  • The UnBlocklnput method is called
  • CTRL + ALT + DEL key is presses
  • The test run ends
  • Any error is encountered during the test run
  • A Breakpoint is reached
  • A System error occurs

The code below shows typical use of these methods:

'Launch the calculator app
'Wait Max 10 seconds to calculator window to appear
bWait= Window("title;=Calculator").Exist(10)
With Window("title:Calculator")
'Block any user input

Activate the application
Type a event
Type "2"
Type "+"
Type "3"
Type "="
Type "-10="
Allow user inputs
'Display the output
End with

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

QTP Topics