Course Name Start Date Time Duration Registration Link
Python for Testers 15th July 2020 9.00 PM IST to 10:30 PM IST 10 days ClickHere
Please mail To sudhakar@qtpsudhakar.com to Register for 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
 '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"

No comments :

Post a Comment