Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Advanced UFT 12 for Test Engineers Cookbook
  • Table Of Contents Toc
Advanced UFT 12 for Test Engineers Cookbook

Advanced UFT 12 for Test Engineers Cookbook

4 (3)
close
close
Advanced UFT 12 for Test Engineers Cookbook

Advanced UFT 12 for Test Engineers Cookbook

4 (3)

Overview of this book

This advanced cookbook is designed for software testers and engineers with previous automation experience and teaches UFT (QTP) developers advanced programming approaches. Knowledge of software testing and basic coding (with VBScript in particular) and familiarity with programming concepts are prerequisites.
Table of Contents (13 chapters)
close
close
12
Index

Implementing a simple search class


In this recipe, we will see how to create a class that can be used to execute a search on Google.

Getting ready

From the File menu, navigate to New | Test, and name the new test SimpleSearch. Then, create a new function library by navigating to New | Function Library, or use the Alt + Shift + N shortcut. Name the new function library cls.Google.vbs and associate it with your test.

How to do it...

Proceed with the following steps:

  1. Define an environment variable as OPEN_URL.

  2. Insert the following code in the new library:

    Class GoogleSearch
      Public Function DoSearch(ByVal sQuery)
        With me.Page_
          .WebEdit("name:=q").Set sQuery
          .WebButton("html id:=gbqfba").Click
        End With  
        me.Browser_.Sync
        
        If me.Results.WaitProperty("visible", 1, 10000) Then
          DoSearch = GetNumResults()
        Else
          DoSearch = 0
          Reporter.ReportEvent micFail, TypeName(Me), "Search did not retrieve results until timeout"
        End If
      End Function
    
      Public...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Advanced UFT 12 for Test Engineers Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon