代码之家  ›  专栏  ›  技术社区  ›  Dave McNulla

运行rspec/watir脚本的异常终止

  •  1
  • Dave McNulla  · 技术社区  · 14 年前

    我使用的是Ruby1.8.6、Watir1.6.6和rspec 1.3.0。当我运行以下脚本时,它“终止”(eclipsePDT IDE中给出的术语),但没有列出任何错误。当我在Windows上从C-prompt运行它时也是一样,除了没有“终止”。浏览器永远不会打开。有人知道吗?如果我去掉描述、它和结束行,它就可以运行了。

    describe 'FaceBook' do
      before :all do
        @b = Watir::Browser.new
        @b = Watir::IE.start('http://www.facebook.com')
      end
    
      it 'Default Page links' do
        @b.link(:class, 'fbxWelcomeBoxName').text.should == 'Dave McNulla'
        @b.link(:href, 'http://www.facebook.com/?ref=home').text.should == 'Home'
        @b.link(:href, 'http://www.facebook.com/dave.mcnulla').text.should == 'Profile'
      end
      it 'Home Page links' do
        @b.link(:href, 'http://www.facebook.com/?ref=home').click
        @b.link(:href, 'http://www.facebook.com/?ref=home').text.should == 'Home'
        @b.link(:href, 'http://www.facebook.com/dave.mcnulla').text.should == 'Profile'
      end
      it 'Profile Page links' do
        @b.link(:text, 'Profile').click
        @b.link(:href, 'http://www.facebook.com/?ref=home').text.should == 'Home'
        @b.link(:href, 'http://www.facebook.com/dave.mcnulla').text.should == 'Profile'
      end
    
      after :all do
        @b.close
      end
    end
    
    4 回复  |  直到 14 年前
        1
  •  1
  •   Dave McNulla    14 年前

        2
  •  0
  •   Željko Filipin    14 年前

    @b = Watir::Browser.new
    @b = Watir::IE.start('http://www.facebook.com')
    

    @b = Watir::Browser.start('http://www.facebook.com')
    
        3
  •  0
  •   Željko Filipin    14 年前

    before :all

    require "rubygems"
    require "watir"
    

        4
  •  0
  •   Dave McNulla    14 年前

    require 'spec'
    
    puts "before strting"
    describe 'FaceBook' do
      require 'watir'
      require 'rubygems'
    
      puts "before all"
      before :all do
        puts "all"
        @b = Watir::Browser.start('http://www.facebook.com')
      end
    
      puts "before Default"
      it 'Default Page links' do
        puts "Default"
        @b.link(:class, 'fbxWelcomeBoxName').text.should == 'Dave McNulla'
        @b.link(:href, 'http://www.facebook.com/?ref=home').text.should == 'Home'
        @b.link(:href, 'http://www.facebook.com/dave.mcnulla').text.should == 'Profile'
      end
      puts "before Home"    
      it 'Home Page links' do
        puts "Home"
        @b.link(:href, 'http://www.facebook.com/?ref=home').click
        @b.link(:href, 'http://www.facebook.com/?ref=home').text.should == 'Home'
        @b.link(:href, 'http://www.facebook.com/dave.mcnulla').text.should == 'Profile'
      end
      puts "before Profile"
      it 'Profile Page links' do
        puts "Profile"
        @b.link(:text, 'Profile').click
        @b.link(:href, 'http://www.facebook.com/?ref=home').text.should == 'Home'
        @b.link(:href, 'http://www.facebook.com/dave.mcnulla').text.should == 'Profile'
      end
      puts "before after"    
      after :all do
        puts "All"
        @b.close
      end
    end
    

    before strting
    before all
    before Default
    before Home
    before Profile
    before after