为什么脚本在Firefox中运行,而不是IE8?

时间:2013-10-11 09:15:19

标签: watir watir-webdriver

我有一个在Firefox中运行正常的脚本。

该脚本无法在Internet Explorer中运行。我很感激你的帮助。

以下是前几行:

require 'rubygems'
require 'watir'
require 'watir-webdriver'
require 'test/unit'

URL = "http://google.com/"

class TestGoogle < Test::Unit::TestCase
  def setup
    #@browser = Watir::Browser.new :firefox
    @browser = Watir::Browser.new :ie
  end

  def testSignInLink
    @browser.goto URL

以下是选定的错误消息:

C:\Ruby193\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)     C:/RubymineProjects/ditto/Google_01_TU_03.rb
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.7.0/lib/watir-classic/version.rb:3:             warning: already initialized constant VERSION
...
...
  1) Error:
testSignInLink(TestGoogle):
TypeError: superclass mismatch for class UnknownObjectException
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.7.0/lib/watir-    classic/exceptions.rb:12:in `<module:Exception>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.7.0/lib/watir-    classic/exceptions.rb:2:in `<module:Watir>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.7.0/lib/watir-classic/exceptions.rb:1:in `<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.7.0/lib/watir-classic.rb:6:in `require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.7.0/lib/watir-classic.rb:6:in `<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-4.0.2-x86-mingw32/lib/watir/loader.rb:48:in `require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-4.0.2-x86-mingw32/lib/watir/loader.rb:48:in `load_driver'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-4.0.2-x86-mingw32/lib/watir/loader.rb:40:in `load_driver_for'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-4.0.2-x86-mingw32/lib/watir/loader.rb:8:in `new'
C:/RubymineProjects/ditto/Google_01_TU_03.rb:11:in `setup'

第11行是:

@browser = Watir::Browser.new :ie

1 个答案:

答案 0 :(得分:0)

基于@abe评论,我做了以下事情。

仅限IE,我删除了“require'watir'”。这很好。

恢复“require'watir'”。删除“require'watir-webdriver'”。这很好。

这就是我的问题的答案。但我不明白。听起来好像这两个API是可以互换的:)