Thanks! This works perfectly now :)

On Thu, May 3, 2012 at 12:01 PM, Tiffany Fodor <[email protected]> wrote:

> Hello!
>
> I haven't tried with Watir 3.0 yet, but when I upgraded my ruby
> version, I found I needed to supply the path to the Xls.rb file to
> require it.
>
> Try something like this:
>
> require 'c:\\folder_where_Xls_is\\Xls.rb'
>
> Hope this helps!
>
> -Tiffany
>
> On May 3, 10:35 am, Aarthi <[email protected]> wrote:
> > Hi,
> >
> > I have used the XLS class to read from an excel file. I had used it
> > with Watir 1.6.5 When I try to reuse the same with Watir 3.0.0, I get
> > a Load Error. Is there a way to use this in 3.0.0 or has this become
> > redundant?
> >
> > Error information:
> >
> > C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
> > `require': cannot load such file -- xls (LoadError)
> >         from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/
> > custom_require.rb:36:in `require'
> >         from Login_Suite.rb:11:in `<main>'
> >
> > My code:
> >
> > require "rubygems"
> > require "test/unit"
> > require "win32ole"
> > require "watir"
> > require "logger"
> > #require "watir/screen_capture"
> > require "xls"
> > require "site_login.rb"
> >
> > #include Watir::ScreenCapture
> > include Test::Unit::Assertions
> >
> > begin
> >     $inputFile = XLS.new("C:\\TestSetUp.xls")
> >     $setupInfo = $inputFile.getHash("B5:C8", "TestSetUp") #get test
> > setup information from the Setup tab in the spreadsheet
> >     $runTests = $inputFile.getHash("B12:C18", "TestSetUp") #get which
> > tests to run from the Setup tab in the spreadsheet
> >     ensure
> >     $inputFile.close
> > end
> >
> > #assign login data to variables
> > $url = $setupInfo["Website"]
> > $username = $setupInfo["User Name"]
> > $password = $setupInfo["Password"]
> > $browserSelected = $setupInfo["Browser"]
> >
> > #~ Creating LogFile
> > @time = Time.now.strftime("%m%d%Y")
> > fileName="C:\\ScriptLogs\\Log_" + @time + ".log"
> > $log = Logger.new(fileName)
> >
> > #~ Creating a new Browser Instance
> > Watir::Browser.default = $browserSelected
> >
> > #~ Navigating and signing in to the URL
> > $browser = Watir::Browser.start($url)
> > $browser.maximize
> >
> > class TestSuite < Test::Unit::TestCase
> >         def test01_Login
> >                 if $runTests["Login"] == "Yes"
> >                         puts "................> Executing Login Test."
> >
> >                         $loginStatus = site_login($username,$password)
> >                         if $loginStatus == "Pass"
> >                                 puts "Login Test successful"
> >                                 $log.info "Successfully completed Login
> test"
> >                         else
> >                                 puts "******** ERROR *********"
> >                                 puts "    Login Test FAILED   "
> >                                 puts "************************"
> >                                 puts "Check C:\\ScriptLogs\\ for Error
> log"
> >                         end
> >                 else
> >                         puts "...............> Bypassing login test"
> >                 end
> >         end
> > end
>
> --
> 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]<http://groups.google.com/group/watir-general%[email protected]>
>

-- 
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]

Reply via email to