Hi I am very new to coding and also to WATIR. Can you please excuse and answer my stupid question which follows:
I am using combination of WATIR+webdriver+cucumber I am trying to use feature file with .feature extension as follows: @single Feature: View Google results I want to search with google Scenario: View google results Given I navigate to the website "http://www.gmail.com" Then I enter username "ragaz042" from the "a2" field Then I enter "abc123" from the "b2" field Then I click "signIn" Then I see "The username or password you entered is incorrect." Then I click "PersistentCookie" checkbox Then I click "link-forgot-passwd" link *An trying to execute below code in cmd:* require 'watir-webdriver' require 'win32ole' b = Watir::Browser.new :firefox, :profile => 'default' usingCode = String.new tempStr = String.new excel = WIN32OLE::new("excel.Application") workbook = excel.Workbooks.Open("C:\\RAGAMANJU\\cucumber\\data\\gmail2.xls") worksheet = workbook.WorkSheets(1) # get first workbook worksheet.Select # just to make sure macros are executed, if your sheet doesn't have macros you can skip this step. Given /^I navigate to the website "(.*?)"$/ do |websiteAdd| @websiteAdd = websiteAdd b.goto "http://www.gmail.com" end Then /^I enter username "(.*?)" from the "(.*?)" field$/ do |text, field| @text = text @field = field value = worksheet.Range("a2").Value b.text_field(:id => field).set text end Then /^I enter "(.*?)" from the "(.*?)" field$/ do |text1, field1| @text1 = text1 @field1 = field1 #password = worksheet.cells(rows, "B2") ['text'] value = worksheet.Range("a2").Value b.text_field(:id => field1).set text1 end Then /^I click "(.*?)"$/ do |clickMe| @clickme = clickMe b.button(:id => 'signIn').click end Then /^I see "(.*?)"$/ do |checktext| @checktext = checktext value = worksheet.Range("b2").Value b.span(:class => 'errormsg').text.should include (checktext) end Then /^I click "(.*?)" checkbox$/ do |checkbox1| @checkbox1 = checkbox1 b.checkbox(:id => 'PersistentCookie').set end Then /^I click "(.*?)" link$/ do |link| @link = link b.link(:id => 'link-forgot-passwd').click end I am not able to open gmail webpage also and I am trying to get value username and password to the respective fields from the excel sheet (gmail.xls), any help would be highly appreciable. King Rgds Rags -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected]
