Facebook

For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
New Schedule in MindQ Systems, Madhapur By SUDHAKAR
Course Name Date Time Duration Type Branch
Selenium+Appium 16th October 2017 7.30 AM - 9.00 AM IST 45 Days ClassRoom + Online Mind Q Madhapur
Selenium+Appium 30th October 2017 9.30 AM - 11.00 AM IST 45 Days ClassRoom + Online Mind Q Madhapur

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
 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"

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

No comments :

Post a Comment