SlideShare a Scribd company logo
1 of 10
VB Script basics – Data Types




1
    © Copyright GlobalLogic 2008
VB Script basics – Variables & Constants
     •     Declaring Variables
     •     Naming Restrictions
     •     Scope and Lifetime of Variables
     •     Assigning Values to Variables
     •     Scalar Variables and Array Variables
     •     Creating Constants




2
    © Copyright GlobalLogic 2008
VB Script basics - Operators




3
    © Copyright GlobalLogic 2008
VB Script basics – Conditions & Looping
      Conditional Statements
             – If...Then...Else statement
             – Select Case statement
      Looping
             – Do...Loop: Loops while or until a condition is true.

             – While...Wend: Loops while a condition is true.

             – For...Next: Uses a counter to run statements a specified number of
               times.

             – For each...Next: Repeats a group of statements for each item in a
               collection or each element of an array.




4
    © Copyright GlobalLogic 2008
VB Script basics – Functions




5
    © Copyright GlobalLogic 2008
Sample Script – QTP Functions

       •      ‘sample 1 - Capturing the snapshot of the combo box control
       •      Window("Flight Reservation").WinComboBox("Fly From:").CaptureBitmap "C:mybmp.bmp",true

       •      'sample 2 - Capturing the snapshot of the entire window
       •      Window("Flight Reservation").CaptureBitmap "C:mybmp.bmp"

       •      'sample 3 - Getting all the items from the combo box
       •      My_Cnt = Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount
       •      msgbox My_Cnt

       •      For i = 1 to My_Cnt
       •              ' the combo box item index will start from zero.
       •              My_item = Window("Flight Reservation").WinComboBox("Fly From:").GetItem(i-1)
       •              Msgbox My_item
       •      Next

       •      'sample 4 - Getting the entire content of the combo box
       •            Var_Content = Window("Flight Reservation").WinComboBox("Fly From:").GetContent
       •            Msgbox Var_Content




6
    © Copyright GlobalLogic 2008
Sample Script – QTP Functions
      •     'sample 5 - Selecting an item from the combo - Using Index
      •     Window("Flight Reservation").WinComboBox("Fly From:").Select(5)

      •     'sample 6 - Selecting an item from the combo - Using Value
      •     Window("Flight Reservation").WinComboBox("Fly From:").Select("London")

      •     'sample 7 - Selecting an item from the combo - Using Variable
      •     Var_Item = "Zurich"
      •     Window("Flight Reservation").WinComboBox("Fly From:").Select(Var_Item)

      •     'sample 8 - Getting the value of selected item
      •     Var_Sel = Window("Flight Reservation").WinComboBox("Fly From:").GetSelection
      •     Msgbox Var_Sel




7
    © Copyright GlobalLogic 2008
Sample Script – QTP Functions

      •     'sample 9 - Edit box functions
      •     Window("Flight Reservation").Activate
      •     Call wait(8)
      •     Window("Flight Reservation").WinEdit("Name:").Set "DasDas“
      •     Call wait(8)
      •     Window("Flight Reservation").WinEdit("Name:").Type "tryhard“
      •     Call wait(8)
      •     Window("Flight Reservation").WinEdit("Name:").Set "DasDas“
      •     Call wait(8)
      •     Window("Flight Reservation").Activate
      •     Call wait(8)
      •     Window("Flight Reservation").ActiveX("MaskEdBox").Set "111111“




8
    © Copyright GlobalLogic 2008
Sample Script – QTP Functions
              ' Some FUM's (Frequently Used Methods)

         •     'GetROProperty
         •     Var_Text = Window("Flight Reservation").WinEdit("Name:").GetROProperty("AttachedText")
         •     Msgbox Var_Text
         •     Var_Enab = Window("Flight Reservation").WinEdit("Name:").GetROProperty("Enabled")
         •     Msgbox Var_Enab

         •     'Exist
         •     If Window("Flight Reservation").WinEdit("Name:").Exist(5) Then
         •            Msgbox "The Editbox exists"
         •     Else
         •            Msgbox "The Editbox does not exist"
         •     End if

         •     'Wait
         •     Wait(10) ' The QTP will sleep for 10 seconds

         •     'Msgbox
         •     Msgbox "Hello QTP"




9
    © Copyright GlobalLogic 2008
Descriptive Programming
      •     Demo on descriptive programming

              – Entering Programmatic Descriptions Directly into Statements
                   Browser("Mercury Tours").Page("Title:=Mercury Tours").WebEdit("Name:=Author",
                   "Index:=3").Set "Mark Twain"


              – Using Description Objects for Programmatic Descriptions
                   Set MyDescription = Description.Create()
                   MyDescription("text").Value = "OK"
                   MyDescription("width").Value = 50
                   Window("Error").WinButton(MyDescription).Click




10
     © Copyright GlobalLogic 2008

More Related Content

Similar to Gl qtp day 3 1

Qtp Training Deepti 3 Of 44256
Qtp Training Deepti 3 Of 44256Qtp Training Deepti 3 Of 44256
Qtp Training Deepti 3 Of 44256Azhar Satti
 
MongoUK 2011 - Rplacing RabbitMQ with MongoDB
MongoUK 2011 - Rplacing RabbitMQ with MongoDBMongoUK 2011 - Rplacing RabbitMQ with MongoDB
MongoUK 2011 - Rplacing RabbitMQ with MongoDBBoxed Ice
 
JavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and KarmaJavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and KarmaChristopher Bartling
 
Scripting as a Second Language
Scripting as a Second LanguageScripting as a Second Language
Scripting as a Second LanguageRob Dunn
 
Java script Techniques Part I
Java script Techniques Part IJava script Techniques Part I
Java script Techniques Part ILuis Atencio
 
Best Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part IBest Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part IICS
 
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...CanSecWest
 
QTP Descriptive programming Tutorial
QTP Descriptive programming TutorialQTP Descriptive programming Tutorial
QTP Descriptive programming TutorialJim Orlando
 
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)James Titcumb
 
Jvm lecture
Jvm lectureJvm lecture
Jvm lecturesdslnmd
 
Xamarin & MvvmCross in depth
Xamarin & MvvmCross in depthXamarin & MvvmCross in depth
Xamarin & MvvmCross in depthNicolas Milcoff
 
How the HotSpot and Graal JVMs execute Java Code
How the HotSpot and Graal JVMs execute Java CodeHow the HotSpot and Graal JVMs execute Java Code
How the HotSpot and Graal JVMs execute Java CodeJim Gough
 
Security and Encryption on iOS
Security and Encryption on iOSSecurity and Encryption on iOS
Security and Encryption on iOSGraham Lee
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to JavascriptAmit Tyagi
 

Similar to Gl qtp day 3 1 (20)

Qtp Training Deepti 3 Of 44256
Qtp Training Deepti 3 Of 44256Qtp Training Deepti 3 Of 44256
Qtp Training Deepti 3 Of 44256
 
Qtp Training
Qtp Training Qtp Training
Qtp Training
 
MongoUK 2011 - Rplacing RabbitMQ with MongoDB
MongoUK 2011 - Rplacing RabbitMQ with MongoDBMongoUK 2011 - Rplacing RabbitMQ with MongoDB
MongoUK 2011 - Rplacing RabbitMQ with MongoDB
 
Qtp - Introduction to synchronization
Qtp -  Introduction to synchronizationQtp -  Introduction to synchronization
Qtp - Introduction to synchronization
 
JavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and KarmaJavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and Karma
 
IP Unit 2.pptx
IP Unit 2.pptxIP Unit 2.pptx
IP Unit 2.pptx
 
Scripting as a Second Language
Scripting as a Second LanguageScripting as a Second Language
Scripting as a Second Language
 
Java script Techniques Part I
Java script Techniques Part IJava script Techniques Part I
Java script Techniques Part I
 
Best Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part IBest Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part I
 
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
 
QTP Descriptive programming Tutorial
QTP Descriptive programming TutorialQTP Descriptive programming Tutorial
QTP Descriptive programming Tutorial
 
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
 
Jvm lecture
Jvm lectureJvm lecture
Jvm lecture
 
Nashorn
NashornNashorn
Nashorn
 
Xamarin & MvvmCross in depth
Xamarin & MvvmCross in depthXamarin & MvvmCross in depth
Xamarin & MvvmCross in depth
 
Qtp test
Qtp testQtp test
Qtp test
 
How the HotSpot and Graal JVMs execute Java Code
How the HotSpot and Graal JVMs execute Java CodeHow the HotSpot and Graal JVMs execute Java Code
How the HotSpot and Graal JVMs execute Java Code
 
Security and Encryption on iOS
Security and Encryption on iOSSecurity and Encryption on iOS
Security and Encryption on iOS
 
Jvm internals
Jvm internalsJvm internals
Jvm internals
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 

More from Pragya Rastogi (20)

Gl android platform
Gl android platformGl android platform
Gl android platform
 
Qtp questions
Qtp questionsQtp questions
Qtp questions
 
Qtp not just for gui anymore
Qtp   not just for gui anymoreQtp   not just for gui anymore
Qtp not just for gui anymore
 
Qtp tutorial
Qtp tutorialQtp tutorial
Qtp tutorial
 
Qtp4 bpt
Qtp4 bptQtp4 bpt
Qtp4 bpt
 
Get ro property outputting value
Get ro property outputting valueGet ro property outputting value
Get ro property outputting value
 
Bp ttutorial
Bp ttutorialBp ttutorial
Bp ttutorial
 
Gl istqb testing fundamentals
Gl istqb testing fundamentalsGl istqb testing fundamentals
Gl istqb testing fundamentals
 
Gl scrum testing_models
Gl scrum testing_modelsGl scrum testing_models
Gl scrum testing_models
 
My Sql concepts
My Sql conceptsMy Sql concepts
My Sql concepts
 
Oops
OopsOops
Oops
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
70433 Dumps DB
70433 Dumps DB70433 Dumps DB
70433 Dumps DB
 
70 433
70 43370 433
70 433
 
70562-Dumps
70562-Dumps70562-Dumps
70562-Dumps
 
70562 (1)
70562 (1)70562 (1)
70562 (1)
 
32916
3291632916
32916
 
70 562
70 56270 562
70 562
 
Mobile testingartifacts
Mobile testingartifactsMobile testingartifacts
Mobile testingartifacts
 
GL_Web application testing using selenium
GL_Web application testing using seleniumGL_Web application testing using selenium
GL_Web application testing using selenium
 

Recently uploaded

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Recently uploaded (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Gl qtp day 3 1

  • 1. VB Script basics – Data Types 1 © Copyright GlobalLogic 2008
  • 2. VB Script basics – Variables & Constants • Declaring Variables • Naming Restrictions • Scope and Lifetime of Variables • Assigning Values to Variables • Scalar Variables and Array Variables • Creating Constants 2 © Copyright GlobalLogic 2008
  • 3. VB Script basics - Operators 3 © Copyright GlobalLogic 2008
  • 4. VB Script basics – Conditions & Looping  Conditional Statements – If...Then...Else statement – Select Case statement  Looping – Do...Loop: Loops while or until a condition is true. – While...Wend: Loops while a condition is true. – For...Next: Uses a counter to run statements a specified number of times. – For each...Next: Repeats a group of statements for each item in a collection or each element of an array. 4 © Copyright GlobalLogic 2008
  • 5. VB Script basics – Functions 5 © Copyright GlobalLogic 2008
  • 6. Sample Script – QTP Functions • ‘sample 1 - Capturing the snapshot of the combo box control • Window("Flight Reservation").WinComboBox("Fly From:").CaptureBitmap "C:mybmp.bmp",true • 'sample 2 - Capturing the snapshot of the entire window • Window("Flight Reservation").CaptureBitmap "C:mybmp.bmp" • 'sample 3 - Getting all the items from the combo box • My_Cnt = Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount • msgbox My_Cnt • For i = 1 to My_Cnt • ' the combo box item index will start from zero. • My_item = Window("Flight Reservation").WinComboBox("Fly From:").GetItem(i-1) • Msgbox My_item • Next • 'sample 4 - Getting the entire content of the combo box • Var_Content = Window("Flight Reservation").WinComboBox("Fly From:").GetContent • Msgbox Var_Content 6 © Copyright GlobalLogic 2008
  • 7. Sample Script – QTP Functions • 'sample 5 - Selecting an item from the combo - Using Index • Window("Flight Reservation").WinComboBox("Fly From:").Select(5) • 'sample 6 - Selecting an item from the combo - Using Value • Window("Flight Reservation").WinComboBox("Fly From:").Select("London") • 'sample 7 - Selecting an item from the combo - Using Variable • Var_Item = "Zurich" • Window("Flight Reservation").WinComboBox("Fly From:").Select(Var_Item) • 'sample 8 - Getting the value of selected item • Var_Sel = Window("Flight Reservation").WinComboBox("Fly From:").GetSelection • Msgbox Var_Sel 7 © Copyright GlobalLogic 2008
  • 8. Sample Script – QTP Functions • 'sample 9 - Edit box functions • Window("Flight Reservation").Activate • Call wait(8) • Window("Flight Reservation").WinEdit("Name:").Set "DasDas“ • Call wait(8) • Window("Flight Reservation").WinEdit("Name:").Type "tryhard“ • Call wait(8) • Window("Flight Reservation").WinEdit("Name:").Set "DasDas“ • Call wait(8) • Window("Flight Reservation").Activate • Call wait(8) • Window("Flight Reservation").ActiveX("MaskEdBox").Set "111111“ 8 © Copyright GlobalLogic 2008
  • 9. Sample Script – QTP Functions  ' Some FUM's (Frequently Used Methods) • 'GetROProperty • Var_Text = Window("Flight Reservation").WinEdit("Name:").GetROProperty("AttachedText") • Msgbox Var_Text • Var_Enab = Window("Flight Reservation").WinEdit("Name:").GetROProperty("Enabled") • Msgbox Var_Enab • 'Exist • If Window("Flight Reservation").WinEdit("Name:").Exist(5) Then • Msgbox "The Editbox exists" • Else • Msgbox "The Editbox does not exist" • End if • 'Wait • Wait(10) ' The QTP will sleep for 10 seconds • 'Msgbox • Msgbox "Hello QTP" 9 © Copyright GlobalLogic 2008
  • 10. Descriptive Programming • Demo on descriptive programming – Entering Programmatic Descriptions Directly into Statements Browser("Mercury Tours").Page("Title:=Mercury Tours").WebEdit("Name:=Author", "Index:=3").Set "Mark Twain" – Using Description Objects for Programmatic Descriptions Set MyDescription = Description.Create() MyDescription("text").Value = "OK" MyDescription("width").Value = 50 Window("Error").WinButton(MyDescription).Click 10 © Copyright GlobalLogic 2008