Tuesday, August 18, 2015

Accessing Google Page



#code

require 'watir-webdriver'

class AccessGoogle
  URL="https://www.google.com/"
  browser=Watir::Browser.new
  puts "Browser object created"

  browser.goto(URL)
  puts "---google page opened---"
  browser.driver.manage.window.maximize
  puts "---maximize the page---"
  title=browser.title
  x = "The page title is--> #{title} "
    puts x

  #browser.click(:id= => 'lst-ib')
  browser.text_field(:name, "q").set "Anadn Pasunoori" # "q" is the name of the search field

end

No comments:

Post a Comment