Facebook

Course Name Start Date Time Duration Registration Link
No Training Programs Scheduled ClickHere to Contact
Please mail To sudhakar@qtpsudhakar.com to Register for any training

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
 oTestObject.Click
 
 '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"
  else
  Reporter.ReportEvent micPass,"VerifyClipBoardTextNotAcceptance","TextBox not Accepted Clipboard Text"
 End If

End Function

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

'OR

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

Browser("").Page("").WebEdit("").VerifyClipBoardTextNotAcceptance

UnregisterUserFunc "WebEdit","VerifyClipBoardTextNotAcceptance"

No comments :

Post a Comment