Tuesday, 31 July 2018

Introduction to Automation Testing

Selenium for Automation Testing
------------------------------

Introduction to Automation Testing:
-----------------------------------
S/w Testing:
It is a combination of Verification and Validation
S/w testing will help to identify defects, when those are resolved then S/w quality improves
S/w Testing methods:
there are 2 types of approaches to validate applications
1. Manual Testing:
2. Automation testing:

1. Manual Testing:
Without using any automation tool TE directly interact with application to verify actual behavior while performing
operations is called manual testing
for manual testing we prepare test cases and those are used to validate application
Advantages:
-It is simple and easy to perform for small projects
-less cost compare to automation testing for small projects
Disadvantages:
-Time consuming
-Inconsistency (Focus)
-Lack of Reliability (Human Errors)
2. Automation Testing:
Any task or activity performed with help of tool/programs is called Automation
ex: Using Calculator to find multiplication of values is an example for Automation

**Automating human activities (i.e. Test Execution) in order to validate application is called Automation testing
Automation testing can be performed using programming languages (eg., C#) or scripting languages (eg., Perl script) or
using any one of the 3rd party automation tool like Selenium/QTP/Test Complete, etc.,

For Automation Testing we need to develop the automation test scripts

Advantages:
-Fast in Execution
-More Consistency
-More Reliability
-Automation test scripts are Reusable
-Automation test scripts are repeatable

Disadvantages:
-Automation testing is an expensive
-Skilled Automation TE's are required
-Some Technologies/Environments are not possible to automate

Selection Criteria for a project to perform Automation testing:
--------------------------------------------------------------
Following are the factors they check to confirm project is suitable for automation testing or not
-More resource required and time consuming to validate application
-Multiple Releases are expecting
-Application Environment supports automation tools
-Avilable budget


Some of the Common activities during Manual testing and Automation Testing:
-------------------------------------------------------------------------
1. Manual Testing:
Identify Test SCenarios
prepare test cases
perform test execution
Defect Reporting
Getting them fixed
2. Automation Testing:
Identify Automation Test scenarios
Develop the automation test scripts
Execution of Test scripts
Analyze results
Defect Reporting
Getting them fixed
============================================================================
SCenarios which are prefered for Automation testing:
In general scenarios which are complex to perform manually and more repeatable those are more suitable for
Automation testing
ex:
Build Verification Test Scenarios(BVT)
Re-Testing Scenarios
Regression Test Scenarios

Scenarios which are not preferable for Automation testing:
Scenarios which are not repeatable and easy to perform manually those are not suitable for automation testing
ex:
GUI Test Scenarios {Cosmetic, Look-N-Feel of the application}
Usability Test scenarios {User friendlyness/Ease of use}
One time testing activities
Informal testing activities such as exploratory testing, smoke testing, sanity testing etc.,
Note:  For one project, there can be Manual testing team and Automation testing team, for some of the
projects Automation testing is an optional

Note:  In general, Automation test scripts are designed/developed only once a stable build is available

Selenium Course Content

Selenium course content
1. Introduction to Automation Testing
2. Introduction to Selenium
3. Working with Selenium IDE
4. WebDriver Configuration
5. Java concepts-1
-Creating java program
-output functions
-using Scanner class
-Variable Declaration and Data types
-some String methods
6. Launching Web Browser and Browser Interaction commands
7. Addressing WebElements/Locators
8. Working on Multiple browsers
9. Java concpets-2
-Conditional statements
-Loop statements
-Array Declaration
-ArrayList Declaration
10. Working on WebElements
-Edit box/Text box
-Dropdowns
-checkboxes
-Radio buttons
-Links
-push buttons
11. working with WebTable
12. WD validation commands
-isSelected()
-isEnabled()
-isDisplayed()
13. Synchroniation in WD
14. Working on pupups
-Web based popups
-Windows based popups
-using Robot class
-using AutoIT
15. working on Frames
16. Working on Multiple windows
17. working with Actions class
18. TakesScreenshot
19. JavascriptExecutor
20. Java concepts-3 {OOPS concepts}
-class with multiple methods
-static methods
-non static methods
-method overloading
-Constructor and its overloading
-Inheritance
-Method overriding
21. Frameworks in Selenium
-Modular Framework
-Page Object Model Framework  (POM)
-TestNG framework
-Data Driven Framework
-Keyword Driven Framework
22. Working with Maven
23. Working iwth Jenkins
24. Appium
=========================================================

Friday, 31 January 2014

Yahoo Mail Test Automation



Testing to find out Number of Unread Mails, Number of Mails Replied, Number of Mails with Attachments, and Number of Mails Forwarded :-)  Try It Yourself

Note:  Please ensure you check the values of properties correctly as they will change according to the yahoo mail versions that you are using

Option explicit
Dim ieo, nomp, noum, nofm, norm, noma, i, x, y, z

'launch yahoo mail websiteSet ieo=createobject("internetexplorer.application")
ieo.visible=true
ieo.navigate"http://www.mail.yahoo.com"

'login to yahoo mail
With browser("title:=.*")
        With .page("title:=.*")
            .webedit("name:=login").set "Enter a mail ID"
            .webedit("name:=passwd").setsecure "52eb84c9b61269a00a33b5b390e3f67da3ecc4f15"
            .webbutton("name:=Sign In").click
        End With
End With

'Find number of unread mails, number of mails with attachments, number of forwarded mails, and number of replied mails from the mail box
Noum=0
Norm=0
Nofm=0
Noma=0
Do
With browser("title:=.*")
          With .page("title:=.*")
          Nomp=.webtable("name:=toggleAll").rowcount
For i = 2 to Nomp step 1
    x=.webtable("name:=toggleAll").getcelldata(i,1)
    y=.webtable("name:=toggleAll").getcelldata(i,3)
    z=.webtable("name:=toggleAll").getcelldata(i,7)
    if x= "Unread" then
             noum=noum+1
    end if
    if y= " You replied to this message" then
             norm=norm+1
    end if
    if y= " You forwarded this message" then
             nofm=nofm+1
    end if
    if z= " Attachments" then
             noma=noma+1
    end if
Next

'Go to next page
If .link("name:= >", "index:=0").exist then
    .link("name:= >", "index:=0").click
    wait (3)
Else
Exit do 'statement to terminate infinite loopEnd if
End with
End with
Loop while 2>1

'Do logout With browser("title:=.*")
          With .page("title:=.*")
                    .link("name:=sign out").click
           End with
End with
set ieo=nothing

'Display output
Reporter.reportevent micdone, "Mailbox Testing",  "Get"&noum&"mails"
Reporter.reportevent micdone, "Mailbox Testing",  "Get"&norm&"mails"
Reporter.reportevent micdone, "Mailbox Testing",  "Get"&nofm&"mails"
Reporter.reportevent micdone, "Mailbox Testing",  "Get"&noma&"mails"

Thursday, 30 January 2014

Data Migration with QTP


DATA MIGRATION from Word and Text File to Excel file

Option explicit
Dim mswo, doco, pro, fso, fo, exo, wbo, wso, i
'open word document using VBScriptSet mswo=createobject("word.application")
Set doco=mswo.documents.open("C:\Documents and Settings\qa\Desktop\QTP Practice\PATH FILES\Word Grammercheck.doc")
Set pro=doco.paragraphs
'Open text file
Set fso=createobject("scripting.filesystemobject")
Set fo=fso.OpenTextFile("C:\Documents and Settings\qa\Desktop\QTP Practice\PATH FILES\Data.txt", 1)
'open new excel file
Set exo=createobject("excel.application")
Set wbo=exo.Workbooks.Add
Set wso=wbo.Worksheets("sheet1")
wso.cells(1,1)="Names"
wso.cells(1,2)="Paras"
'copy data from doc file and text file into excel file
For i = 1 to pro.count step 1
Wso.cells (i + 1, 1) = fo.readline
Wso.cells (I + 1, 2) = pro(i).range.text
next
'Close Text file
Fo.close
'Close word file
Doco.close(false)
Mswo.quit
'Save and Close excel file
Wso.rows.autofit
Wso.columns.autofit
Wso.saveas("C:\Documents and Settings\qa\Desktop\Test1.xls")
Exo.quit
Set fo=nothing
Set fso=nothing
Set pro=nothing
Set doco=nothing
Set mswo=nothing
Set wso=nothing
Set wbo=nothing
Set exo=nothing

Yahoo Mail Automation Using Excel and Word

Yahoo Mail Automation Using Excel and Word

Option explicit
Dim exo, wbo, wso, nor, i, ieo, mswo, doco, pro, t, c, s, b, wsho

'exo for excel object
'wbo for work book object in excel
'wso for work sheet object in excel
'nor for number of rows in work sheet
'i for iteration or loop
'ieo for internet explorer object
'mswo for work object
'doco for document object in word
'pro for paragraph in document
't for to address from excel
'c for cc address from excel
's for subject from excel
'wsho for automating keyboard  to send the keys through automation

'open existing excel file using VBScript
Set exo= createobject("excel.application")
Set wbo= exo.workbooks.open ("C:\Documents and Settings\qa\Desktop\QTP Practice\PATH FILES\email list.xls")
Set wso= wbo.worksheets("sheet1")
Nor= wso.usedrange.rows.count
'open existing word document using VBScript Set Mswo= createobject("word.application")
Set Doco= mswo.documents.open("C:\Documents and Settings\qa\Desktop\QTP Practice\PATH FILES\Word Spellcheck.doc")
Set pro= doco.paragraphs
'launch yahoomail website using VBScript
Set ieo= createobject ("internetexplorer.application")
ieo.visible=true
ieo.navigate ("http://www.mail.yahoo.com")
'do login yahoo using QTPScript in DP
With browser ("title:=.*")
          With.page ("title:=.*")
    .webedit ("name:=login").set "prxxxxxxx"
    .webedit ("name:=passwd").setsecure "52ea325bd89a05e9260dad8411922dfe344ae65a"
    .webbutton("name:=Sign In").click
          End with
End with
For i = 2 to nor step 1
             T = wso.cells (i, 1)
             C = wso.cells (i, 2)
             S = wso.cells (i, 3)
             B = pro (i-1).range.text 'i=2 in this loop for excel cells, i-1 loop is for word of first paragraph
'go to mail compose page using QTPScript in DP
With browser ("title:=.*")
          With.page ("title:=.*")
    .webbutton ("name:=Compose", "index:=0").click
          End with
End with
'Fill mail compose page using QTPscript with DP
With browser ("title:=.*")
          With.page ("title:=.*")
    .webedit("name:=to").set T
    .webedit("name:=cc").set C
    .webedit("name:=Subj").set S
 'Automate Keyboard input for filling body using VBScript
    .webedit("name:=Subj").click
           Set wsho=createobject("wscript.shell")
           Wsho.sendkeys ("{TAB}")
           Wsho.sendkeys ("{TAB}")
           Wsho.sendkeys (B)
           Set wsho = nothing 'Keyboard automation completed and destroyed
.webbutton("name:=Send", "index:=0").click
Wait (5)
         End with
End with
With browser ("title:=.*")
          With.page ("title:=.*")
.link("name:=Back to Inbox").click
end with
end with
Next
'Do logout using QTPscript in DP
With browser("title:=.*")
          With.page("title:=.*")
    .link("name:=Sign Out").click
            End with
End with
'Close Yahoo website using VBScript
ieo.quit
'Close excel software using VBScript
Exo.quit
'close msword software using VBScript
Doco=close (False) 'False is for closing the document without saving
Mswo.quit
Set pro=nothing
Set doco=nothing
Set mswo=nothing
Set wbo=nothing
Set exo=nothing
Set ieo=nothing

QTP Charts


QTP CHARTS


Option explicit
Dim exo, wbo, wso, rngo, cho
'open new excel file sheet using VBScript
Set exo=createobject("excel.application")
Set wbo=exo.workbooks.open ("C:\Documents and Settings\qa\Desktop\QTP Practice\PATH FILES\Excel Charts Comparison1.xls")
Set wso=wbo.worksheets("sheet1")
Exo.visible=true
Set rngo= wso.range("B2", "C21")
'Create a new chart for selected data (“B2”, “C21”) using VBScript
Set cho= wbo.charts.add
Cho.name= "Run Rate"
Cho.charttype=65 'any number between 61-70
Cho.SetSourceData rngo, 2 '2 is the second component in sheet1, the 1st component is scores table
Cho.location 2, "sheet1"
'save excel file and close application
Wbo.save
Exo.quit
Set wso=nothing
Set wbo=nothing
Set exo=nothing
Set rngo=nothing
Set cho=nothing

Color Index in Excel with QTP

COLOR INDEX in Excel



HI Guyz, Hope you enjoy the below simple colourful program to get the COLOR INDEX in Excel

Note:  The default color index numbers are 1-56

Option explicit
Dim exo, wbo, wso, i
'open new excel file sheet using VBScriptSet exo=createobject("excel.application")
Exo.visible=true
Set wbo=exo.workbooks.add
Set wso=wbo.worksheets("sheet1")
 'perform getting color index using VBScript
For i = 1 to 56 step 1
        wso.cells(i,1)= "COLOR"
        wso.cells(i,1).font.colorindex= i
        wso.cells(i,1).font.bold=true   
        wso.cells(i,1).font.name="verdana"
        wso.cells(i,1).font.size=15
        wso.cells(i,2).interior.colorindex=i
        Next
'save excel file and close application
Wso.rows.autofit
Wso.columns.autofit
Wbo.saveas ("C:\Documents and Settings\qa\Desktop\cOLORiNDEX.XLS")
Exo.quit
Set wso=nothing
Set wbo=nothing
Set exo=nothing

Wednesday, 29 January 2014

EVAL Using QTP

EVAL 

The below program is to EVAL values using QTP Tool using VBScript Discriptive Language and Excel File

1.  Create an excel file, in the first column add more than one values in the first column using additions, multiplications, substractions .etc. Example:  6*2
2.  In the second column, input the correct results of the first column Example:  First column 6*2. Second column would be 12. (This is your expected results)

3.  Now compare the actual results in column three with expected results in coloumn two
4. If the results match it must show PASSED else FAILED in fourth column

Option explicit
Dim exo, wbo, wso, nor, i, x, y, z
'open excel file sheet using VBScriptSet exo=createobject("excel.application")
Set wbo=exo.workbooks.open("C:\Documents and Settings\qa\Desktop\QTP Practice\PATH FILES\Excel Evaluations.xls")
Set wso=wbo.worksheets("sheet1")
Nor=wso.usedrange.rows.count
Exo.visible=true
'perform reading and writing from columns using VBScript
For i = 2 to nor step 1
X= wso.cells (i, 1)
Y= wso.cells (i, 2)
Z= eval(x)
Wso.cells (i, 3)=z
    If z=y then
        Wso.cells(i, 4) = "Passed"
   Else
        Wso.cells (i, 4) = "Failed"
   End if
Next
'save excel file and close application

Wbo.save
Exo.quit
Set wso=nothing
Set wbo=nothing
Set exo=nothing

Adding Columns in Excel Using QTP

The below program is used to add coloum values using QTP tool, VBScript Discriptive Language and Excel

1. Create an excel file with first four columns and six rows, give some values
2. Add the four column values and show the results in fifth column
3. Save and Close the excel file

Option explicit
Dim exo, wbo, wso, nor, i, a, b, c, d,T
'open excel file sheet using VBScriptSet exo=createobject("excel.application")
Set wbo=exo.workbooks.open("C:\Documents and Settings\qa\Desktop\QTP Practice\PATH FILES\Addition.xls")
Set wso=wbo.worksheets("sheet1")
Nor= wso.usedrange.rows.count
Exo.visible=true
'perform reading and writing from the excel file using VBScript
For i = 2 to nor step 1
a=wso.cells (i,1)  '(Reading)
b=wso.cells (i,2)
c=wso.cells (i,3)
d=wso.cells (i,4)  '(Reading)
T=cint(a)+cint(b)+cint(c)+cint(d)
Wso.cells(i,5)=T  '(Writing)
Next
'Save excel file and close application
Wbo.save
Exo.quit
Set wso=nothing
Set wbo=nothing
Set exo=nothing

Sending Multiple Emails At One Click Using QTP

Multiple Emails At One Click

Please find the below progam for sending number of mails at one go using QTP Tool, VBscript Discriptive Language, and Excel Document....Hope you will enjoy this :-)

NOTE:  Object Properties may change based on browser versions and OS

Option explicit
Dim bro, url, wsho, exo, wbo, wso, nor, i, T, C, B, F
 'open excel file sheet using VBScript
'Bro for browser
'url for website
'wsho for keyboard object
'exo for excel application
'wbo for excel work book
'wso for excel work sheet
'nor for number of rows count
'i for looping
'T for to addresses from excel sheet
'C for CC addresses from excel sheet
'B for mail body from excel sheet
'F for file path from excel sheet

Set exo=createobject ("Excel.application")
exo.visible=true
set wbo=exo.workbooks.open ("C:\Documents and Settings\qa\Desktop\QTP Practice\PATH FILES\email list.xls")
set wso=wbo.worksheets("sheet1")
nor=wso.usedrange.rows.count
for i = 2 to nor step 1 '(2 is used because first row is given for headings)
T=wso.cells (i, 1)
C=wso.cells (i, 2)
B=wso.cells (i, 3)
F=wso.cells (i, 4)
'Launch Yahoomail website using VBscript
Bro= "C:\Program Files\Internet Explorer\iexplore.exe"
url= "http://www.yahoomail.com"
invokeapplication (bro&" "&url)
'Do login using QTPscript in DPWith browser ("title:=.*")
          With.page ("title:=.*")
    .webedit ("name:=login").set "prasadxxxxx"
    .webedit ("name:=passwd").setsecure "52e8ddowlf543cb5ec81f6e705d2ec5edc6f617883501c0445045f623"
    .webbutton("name:=Sign In").click
          End with
End with
With browser ("title:=.*")
          With.page ("title:=.*")
'Using analog i have avoided a dailogboxWindow("Microsoft Internet Explorer").RunAnalog "Track1"
end with
end with
'Go to compose a new message using QTPscript with DP
With browser ("title:=.*")
          With.page ("title:=.*")
    .webbutton("name:=Compose", "index:=0").click
          End with
End with
'Fill mail compose page using QTPscript with DP
With browser ("title:=.*")
          With.page ("title:=.*")
    .webedit("name:=to").set T
    .webedit("name:=cc").set C
    .webedit("name:=subj").set "QTP Automation Tool"
    .webbutton("name:=Attach Files").Click
    end with
    end with
With browser ("title:=.*")
          With.page ("title:=.*")
        .webfile("name:=uploadfile").set F
        .webbutton("name:=Attach Files").Click
        end with
        end with
With browser ("title:=.*")
          With.page ("title:=.*")
 'Automate Keyboard input for filling body using VBScript
    .webedit("name:=subj").click
           Set wsho=createobject("wscript.shell")
           Wsho.sendkeys ("{TAB}")
           Wsho.sendkeys ("{TAB}")
           Wsho.sendkeys (B)
'Keyboard automation completed
    .webbutton("name:=send", "index:=0").click          
            End with
End with
'Do logout using QTPscript in DP
With browser("title:=.*")
          With.page("title:=.*")
    .link("name:=Sign Out").click
            End with
End with
'Close Yahoo website using QTPscript in DP
Browser("title:=.*").close
next
'Close excel application
exo.Quit

Simple VB Script for QTP Beginners

A simple VB Script program for QTP beginners.

1. Open Yahoo mail
2. Insert your user name and password and click OK
3. Compose a new mail To yourself, CC yourself, BCC Yourself
4. Fill subject
5. Attach a file
6. Fill body as you wish
7. Click OK to send the mail
8. Signout
9. Close the browser

NOTE:  Properties of the objects might change based on the browser version and OS


Option explicit
Dim bro, url, wsho '(windows shell object)
'Launch Yahoomail website using VBscript
Bro= "C:\Program Files\Internet Explorer\iexplore.exe"
url= "http://www.yahoomail.com"
invokeapplication (bro&" "&url)
'Do login using QTPscript in DP
With browser ("title:=.*")
          With.page ("title:=.*")
    .webedit ("name:=login").set "mycompanysa"
    .webedit ("name:=passwd").setsecure "52e8d58e60e8ee8c73e9428a967f2c61dd45ba0da327a"
    .webbutton("name:=Sign In").click
          End with
End with
With browser ("title:=.*")
          With.page ("title:=.*")
'Using analog i have avoided a dailogbox
Window("Microsoft Internet Explorer").RunAnalog "Track1"
end with
end with
''Go to inbox link using QTPscript in Dp
With browser ("title:=.*")
          With.page ("title:=.*")
    .link("name:=inbox", "index:=0").click
          End with
End with
'Go to new message using QTPscript with DP
With browser ("title:=.*")
          With.page ("title:=.*")
    .webbutton("name:=Compose", "index:=0").click
          End with
End with
'Fill mail compose page using QTPscript with DP
With browser ("title:=.*")
          With.page ("title:=.*")
    .webedit("name:=to").set "prasadxxx@gmail.com"
    .webedit("name:=cc").set "prasadxxx@yahoo.com"
    .webedit("name:=subj").set "QTP Automation Tool"
    .webbutton("name:=Attach Files").Click
    end with
    end with
With browser ("title:=.*")
          With.page ("title:=.*")
        .webfile("name:=uploadfile").set "C:\Documents and Settings\qa\My Documents\Testfile.jpg"
        .webbutton("name:=Attach Files").Click
        end with
        end with
With browser ("title:=.*")
          With.page ("title:=.*")
 'Automate Keyboard input for filling body using VBScript
    .webedit("name:=subj").click
           Set wsho=createobject("wscript.shell")
           Wsho.sendkeys ("{TAB}")
           Wsho.sendkeys ("{TAB}")
           Wsho.sendkeys ("Hi There, How are you doing………")
'Keyboard automation completed
    .webbutton("name:=send", "index:=0").click          
            End with
End with
'Do logout using QTPscript in DP
With browser("title:=.*")
          With.page("title:=.*")
    .link("name:=Sign Out").click
            End with
End with
'Close Yahoo website using QTPscript in DP
Browser("title:=.*").close

Thursday, 17 January 2013

Web Links Testing (Internal Links & External Links)



The below is a very simple and interesting code for links count using QTP in DP(Descriptive Programming)  I hope you will find it exciting :-)

This will give you number of internal links, number of external links and number of total links :-)
-----------------------------------------------------------------------------------------------------------------------------
Option explicit
Dim Desco, Childso, I, Ieo, Ilc, Olc, Lc, It
'Launch webtours site
set ieo=createobject("internetexplorer.application")
ieo.visible=true
ieo.navigate ("http://site1.way2sms.com/content/help.html")
window("hwnd:="&ieo.hwnd).maximize
'Find number of links 
Set desco=description.create
Desco("micclass").value= "link"
With browser("creationtime:=0")
Set childso= .page("title:=Way2SMS").childobjects(desco)
End with
'Find number of internal and external links 
ilc=0
olc=0
Lc= childso.count
For i = 0 to Lc -1 step 1
it =childso(i).getroproperty("target")
if it = "_blank" then
    olc= olc+1
else ilc= ilc+1
end if
next
'display output and close site
Print ("Number of internal links are"&ilc)
Print ("Number of external links are"&olc)
Print ("Number of total links are"&Lc)
Ieo.quit
Set childso=nothing
Set desco=nothing
Set ieo=nothing
-----------------------------------------------------------------------------------------------------------------------------

Tuesday, 6 November 2012

QTP without using QTPScript



Write VBScript code without using QTPScript for below scenario
Ø  Launch google website
Ø  Enter a word in search box
Ø  Select third word in cache
Ø  Search the selected word
Ø  Close site

Option explicit
Dim bro, url, wsho, i
‘Launch google website
Bro= “C:\\Program Files\Internet Explorer\iexplore.exe
invokeapplication (bro&” “&url)
‘Keyboard automation using VBscript
Set wsho=createobject (“wscript.shell”)
Wait (10)
Wsho.sendkeys (“QTP”)
Wait (5)
For i= 1 to 3 step 1
Wsho.sendkeys(“{DOWN}”)
Wait (5)
Wsho.sendkeys(“{ENTER}”)
Wait (5)
‘closing google website
Wsho.sendkeys (“%{F4}”)

Yahoo Project on QTP



Write QTPScript along with VBScript code in QTP tool for below yahoo mail scenario

Ø  Launch Yahoo mail website
Ø  Do login
Ø  Click inbox link
Ø  Select “new mail” to compose a mail
Ø  Fill fields in compose page
Ø  Send a mail
Ø  Do logout
Ø  Close the yahoo site



Option explicit
Dim bro, url, wsho (windows shell object)
‘Launch Yahoomail website using VBscript
Bro= “C:\Program Files\Internet Explorer\iexplore.exe”
invokeapplication (bro&” “&url)
‘Do login using QTPscript in DP
With browser (“title:=.*)
          With.page (“title:=.*)
                .webedit (“name:=login”) .set “mindqtestingtools”
                .webedit (“name:=passwd”) .setsecure “509791ddb446a18e57e8cde98362f
    00483c1534594797788ed42”
                .webbutton(“name:=signin”) .click
          End with
End with
‘Go to inbox link using QTPscript in Dp
With browser (“title:=.*)
          With.page (“title:=.*)
                .link(“name:=inbox”, “index:=0”) .click
          End with
End with
‘Go to new message using QTPscript with DP
With browser (“title:=.*)
          With.page (“title:=.*)
                .webbutton (“name:=new”) .click
                .link (“name:=email message”).click
          End with
End with
‘Fill mail compose page using QTPscript with DP
With browser (“title:=.*)
          With.page (“title:=.*)
                .webedit(“name:=to”) .set mindq@yahoo.com
                .webedit(“name:=cc”) .set Johnatmindq@yahoo.com
                .webedit(“name:=subj”) .set “QTP Tool”
 ‘Automate Keyboard input for filling body using VBScript
                .webedit(“name:=subj”) .click
           Set wsho=createobject(“wscript.shell”)
           Wsho.sendkeys (“{TAB}”)
           Wsho.sendkeys (“{TAB}”)
           Wsho.sendkeys (“Hi Mindq, How are you doing………”)
‘Keyboard automation completed
                .webbutton(“name:=send”, “index:=0”) .click          
            End with
End with
‘Do logout using QTPscript in DP
With browser(“title:=.*”)
          With.page(“title:=.*”)
                .link(“name:=Signout”) .click
            End with
End with
‘Close Yahoo website using QTPscript in DP
Browser(“title:=.*”) .close


NOTE:  In above test script (VBScript and QTPScript), we automated yahoo mail compose page “body object” using keyboard automation indirectly because the body object is a webelement and visible as webedit.  For keyboard automation, we used “sendekeys” ( ) method along with “wscript.shell” components in the script.

This sendkeys ( ) method can take keyboard keys as input while automating misbehaving objects, and cache objects in webpages.  Cache means, a list of items depends on given text in an editbox.  Exp:  Google search box

SYNTAX:  set wsho=createobject(“wscript.shell”)
                 wsho.sendkeys(“send any keys”)

In above syntax, keyboard keys are two types, general keys and functional keys.  Functional keys must be enclosed by curly braces { }, and keys are case sensitive.

                                                KEYBOARD INPUTS
KEYNAME
SENDKEYS METHOD
BACK SPACE
{BACKSPACE} OR {BS} OR {BKSP}
BREAK
{BREAK}
CAPS LOCK
{CAPSLOCK}
DEL OR DELETE
{DEL} OR {DELETE}
DOWN ARROW
{DOWN}
END
{END}
ENTER
{ENTER} OR ~
ESC
{ESC}
HELP
{HELP}
HOME
{HOME}
INS OR INSERT
{INS} OR {INSERT}
LEFT ARROW
{LEFT}
NUM LOCK
{NUMLOCK}
PAGE DOWN
{PGDN}
PAGE UP
{PGUP}
PRINT SCREEN
{PRTSC}
RIGHT ARROW
{RIGHT}
SCROLL LOCK
{SCROLLLOCK}
TAB
{TAB}
UP ARROW
{UP}
F1 TO F16
{F1} TO {F16}
SHIFT
+
CONTROL
^
ALT
%
+
\+
^
\^
%
\%
~
\~
a-z
a-z
0-9
0-9
BLANK SPACE

OTHERS
OTHERS