SCRIPTING RECIPE Search Engine Sites Flow(Google)

Prev Next

Objectives

This article provides you an example of searching any string on Google website.

The typical purchase flow on a search engine is given below.

  • Open Google homepage
  • Type anything in the search bar
  • Hit go/search button

Prerequisites

  • Access to Catchpoint portal with Create/Modify tests permission

Process

  1. Log in to the Catchpoint Portal and create a Transaction test

1.png

  1. Copy the script below:
// Step - 1 open("http://www.google.com")
waitForNoRequest("3000")
setStepName("1. Google Page")
var string = ${RandomList('book', 'pen', 'phone', laptop, football)}
typeKeys("//*[@name='q']", "${var(string)}")
// Step - 2 clickAndWait(//*[@name="btnG"])
waitForNoRequest("3000")
setStepName("2. Search")

3. Paste the script into the Script Editor and modify the settings accordingly

Google_Search_1.png

4. Hit Save and your Transaction test with login script is ready!
Google_search_2.png