For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
Course Name Date Time Duration Type Location
Qtp / UFT withVbscript 26th March 2020 9.00 PM IST to 10:30 PM IST 30 Days WeekDays Online

A book "Cracking the QTP interview" authored by Sudhakar.Read More. Buy From FlipKart

Sunday, August 29, 2010

All about Validation of Editbox – Part-3 - Verify ClipBoard Text Acceptance

This article is the continuation of my previous post All about Validation of Editbox – Part-2. This will discuss about verifying edit box clipboard text acceptance.

When testing some secured application we can observe some functionalities like blocking right click on the pages and disabling clipboard text acceptance for text fields.

We can automate these type of situations by using windows script host sendkeys method.

'Clipboard Text Rejection
Function VerifyClipBoardTextNotAcceptance(oTestObject)

 'Declare Variable
 Dim wShell
 'Set empty value in edit box
 oTestObject.Set ""
 'Hilight the edit box for entering text
 'Send Ctrl+v to edit box
 Set wShell=CreateObject("wscript.shell")
 wShell.SendKeys "^v",1
 'Verify for the empty value in edit box
 If oTestObject.GetROProperty("value")<>"" Then
  Reporter.ReportEvent micFail,"VerifyClipBoardTextNotAcceptance","TextBox Accepted Clipboard Text"
  Reporter.ReportEvent micPass,"VerifyClipBoardTextNotAcceptance","TextBox not Accepted Clipboard Text"
 End If

End Function

'Using Function in Script
Set EditObj=Browser("").Page("").WebEdit("")
VerifyClipBoardTextNotAcceptance EditObj


RegisterUserFunc "WebEdit","VerifyClipBoardTextNotAcceptance","VerifyClipBoardTextNotAcceptance"


UnregisterUserFunc "WebEdit","VerifyClipBoardTextNotAcceptance"

Please send your Suggestions and Doubts to my yahoo group http://in.groups.yahoo.com/group/qtpsudhakar

No comments :

Post a Comment