Hi, The code that I have written is as shown below.When I try to run this script,No Method Error is shown at the line where '#Error shown here' is written.I have gone through various posts but am not able to figure out the exact cause for this error.Please can anybody help me with this.It is not able to figure out the 'jsclick' function when in fact I have defined the function in the program itself.
=begin This script is used to configure traps =end require 'watir/ie' require 'watir/WindowHelper' require 'test/unit' require 'win32ole' require 'watir\contrib\enabled_popup' require 'watir/assertions' #include Watir::Assertions $path='C:\Documents and Settings\chandrika.shenoy\Desktop\one.xls' def elapsed(f,s) time = (f-s).to_i hours = time/3600.to_i minutes = (time/60 - hours * 60).to_i seconds = (time - (hours * 3600 + minutes * 60)).to_i puts "Test Start "<<s.strftime("%H:%M:%S %m-%d-%y") puts "Test Finish "<<f.strftime("%H:%M:%S %m-%d-%y") puts "Test Time << #{hours}hr#{minutes}min#{seconds}sec" end s=Time.now #System Time def jsClick(a,button,k,user_input=nil) puts"function is called" waitTime=30 hwnd1 = $ie.enabled_popup(waitTime) # wait up to 30 seconds for a popup to appear puts "hwnd=#{hwnd1}" if (hwnd1) w = WinClicker.new popup_text = w.getStaticText_hWnd(hwnd1) puts "\n\nPOP TEXT =#{popup_text}\n\n" excel = WIN32OLE::new('excel.Application') workbook = excel.Workbooks.Open($path) worksheet = workbook.Worksheets(1) #get hold of the third worksheet puts popup_text worksheet.Range("i#{k}")['Value']=popup_text.to_s puts"pop_text is in field" workbook.save puts"workbook is saved" workbook.close #Close the worksheet puts"workbook is clsoed" excel.quit #Close Excel puts"Excel quit" if ( user_input ) w.setTextValueForFileNameField(hwnd1, "#{user_input}") end sleep 3 w.clickWindowsButton_hwnd(hwnd1, "#{button}") w=nil end end #Define a variable test_site = "mpxwebdemo.liebert.com" #Open a browser $ie=Watir::IE.new #increase the speed of execution $ie.speed = :zippy #Start of GXT Webcard testing puts "Start of GXT Webcard Testing" #Navigate to the website puts "Step 1: Navigate to the website" $ie.goto test_site #Click on configure tab puts "Step 2:Click on Configure Tab" $ie.frame(:index, 2).image(:id, 'imgConfigure').click #Click on Access link puts "Step 4:Click on Access tab" $ie.frame(:index, 3).frame(:index, 2).link(:text, 'Access').click_no_wait #=begin #Start login puts " Step 3: Begin Login" # The "Sleep's below are here to slow down the authentication/login just visibility Watir.autoit.WinWait('Connect to mpxwebdemo.liebert.com') Watir.autoit.Send('Liebert') #sleep 3 Watir.autoit.Send('{TAB}') sleep 1 Watir.autoit.Send('Liebert') sleep 1 Watir.autoit.Send('{ENTER}') sleep 3 sleep 3 #$ie.frame(:index, 2).image(:id, 'imgConfigure').click puts " Step 4: Login complete" #=end jsclick($ie,"OK") #Error shown here. #Click on Edit Button puts "Step 5:Click on Edit button" $ie.frame(:index, 3).frame(:index, 3).button(:id, 'editButton').click #Click on Clear Button puts "Step 6:Click on Clear Button1" #$ie.frame(:index, 3).frame(:index, 3).button(:name, 'tC?1').click $ie.frame(:index, 3).frame(:index, 3).button(:name, 'accessClear? 1').click #Enter value in the 1st row 2nd column puts "Step 7 :Enter the Network Name" #$ie.frame(:index, 3).frame(:index, 3).form(:name, 'configSnmpTraps').text_field(:name, 'tIpA?1').set('10.130.92.25') $ie.frame(:index, 3).frame(:index, 3).form(:name, 'configSnmpAccess').text_field(:name, 'accessIpAddress?1').set('') $ie.frame(:index, 3).frame(:index, 3).form(:name, 'configSnmpAccess').text_field(:name, 'accessIpAddress?1').set ('10.130.92.25') =begin Enter value in 1st row 3rd column puts "Step 8 :Enter the Port" $ie.frame(:index, 3).frame(:index, 3).form(:name, 'configSnmpTraps').text_field(:name, 'tP?1').set('162') =end #Enter value in 1st row 4th column puts "Step 9 :Enter the Community String" #$ie.frame(:index, 3).frame(:index, 3).form(:name, 'configSnmpTraps').text_field(:name, 'tCS?1').set('public') $ie.frame(:index, 3).frame(:index, 3).form(:name, 'configSnmpAccess').text_field(:name, 'accessCommunityString?1').set ('') $ie.frame(:index, 3).frame(:index, 3).form(:name, 'configSnmpAccess').text_field(:name, 'accessCommunityString?1').set ('public') #Click on the Save Button puts "Step 10:Click on the Save Button" $ie.frame(:index, 3).frame(:index, 3).button(:name,'Submit').click #Show test time information puts "Step 11:Show test time information" f = Time.now #elapsed finish time elapsed( f, s) #elapsed time summary puts "\n Step 12: Close IE " $ie.close --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~----------~----~----~----~------~----~------~--~---