2013-05-07 118 views
0

我大約一年沒有使用過Watir或Watir-webdriver。我在電腦上安裝了全新的32x Windows 7映像。接下來,我使用安裝包版本2.0.0-p0安裝了Ruby。然後我更新了ruby gem到2.0.3版本。之後,我安裝了名爲DevKit-mingw64-32-4.7.2-20130224-1151-sfx的開發工具包,這正是網站所說的正確的。 Devkit安裝正確。現在,當我使用命令行安裝Watir時,出現錯誤。 Watir安裝一段時間,然後我得到這些代碼行。按照代碼建議,我去了nokogiri.org網站。該nokogiri網站說,安裝使用寶石install nokogiri,所以我做到了。然後我安裝了ffi,它工作。如果其他人遇到同樣的問題,我會留下下面的代碼。Watir安裝錯誤窗口

(....) 
Fetching: mini_portile-0.5.0.gem (100%) 
Successfully installed mini_portile-0.5.0 
Fetching: nokogiri-1.6.0.rc1.gem (100%) 
Temporarily enhancing PATH to include DevKit... 
Building native extensions. This could take a while... 
ERROR: Error installing watir: 
    ERROR: Failed to build gem native extension. 

C:/Ruby200/bin/ruby.exe extconf.rb 
checking for libxml/parser.h... no 
----- 
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokog 
iri.html for help with installing dependencies. 
----- 
*** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of necessary 
libraries and/or headers. Check the mkmf.log file for more details. You may 
need configuration options. 

Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=C:/Ruby200/bin/ruby 
    --with-zlib-dir 
    --without-zlib-dir 
    --with-zlib-include 
    --without-zlib-include=${zlib-dir}/include 
    --with-zlib-lib 
    --without-zlib-lib=${zlib-dir}/lib 
    --with-iconv-dir 
    --without-iconv-dir 
    --with-iconv-include 
    --without-iconv-include=${iconv-dir}/include 
    --with-iconv-lib 
    --without-iconv-lib=${iconv-dir}/lib 
    --with-xml2-dir 
    --without-xml2-dir 
    --with-xml2-include 
    --without-xml2-include=${xml2-dir}/include 
    --with-xml2-lib 
    --without-xml2-lib=${xml2-dir}/lib 
    --with-xslt-dir 
    --without-xslt-dir 
    --with-xslt-include 
    --without-xslt-include=${xslt-dir}/include 
    --with-xslt-lib 
    --without-xslt-lib=${xslt-dir}/lib 
    --with-libxslt-config 
    --without-libxslt-config 
    --with-pkg-config 
    --without-pkg-config 
    --with-libxml-2.0-config 
    --without-libxml-2.0-config 
    --with-pkg-config 
    --without-pkg-config 
    --with-libiconv-config 
    --without-libiconv-config 
    --with-pkg-config 
    --without-pkg-config 

Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/nokogiri- 
1.6.0.rc1 for inspection. 
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.0.rc1/ext/nok 
ogiri/gem_make.out 

現在已經安裝了watir。我跑了幾個測試腳本,看它是否工作,它是。所以現在我想安裝Watir-webdriver。我使用了代碼'gem install watir-webdriver和正確安裝的gem。但是,這是當我遇到問題。如果我從here下載最新的chrome驅動程序並將其放入我的路徑中的ruby bin中,則會出現此錯誤。

Microsoft Windows [版本6.1.7601] 版權所有(c)2009 Microsoft Corporation。版權所有。

C:\Users\kai.knutson>irb DL is deprecated, please use Fiddle 
irb(main):001:0> require "watir-webdriver" 
=> true 
irb(main):002:0> e = Watir::Browser.new :chrome Started ChromeDriver port=9515 version=0.8 
log=C:\Users\kai.knutson\chromedriver.log 
=> #<Watir::Browser:0x..fa558e0f6 url={"message"=>"no such session: url\n (Driv er 
info: chromedriver=0.8,platform=Windows NT 6.1 SP1 x86)"} title={"message"=>" no such 
session: title\n (Driver info: chromedriver=0.8,platform=Windows NT 6.1 SP1 x86)"}> 

如果我嘗試使用IE瀏覽器它的工作原理,但不是正確,我不能點擊鏈接,還有一些其他的東西出問題。我知道我運行的代碼是有效的,因爲它在使用watir classic或者只是正常watir時運行得非常好。所以我的問題是我怎麼能得到鉻工作,並且我從安裝丟失會導致watir webdriver不工作的東西。

+0

它是否生成chromedriver.log文件?這可能會有一些線索。我試圖模擬你在做什麼,但我現在主要使用一個mac,而我擁有的win7 vm是64位的,我家的win7系統也是如此。 – 2013-05-08 23:00:00

+0

至於無法點擊鏈接等問題,這可能是最好的新鮮的SO問題,有問題的網站鏈接和您正在嘗試使用的代碼。 (當然還有你得到的任何錯誤信息) – 2013-05-08 23:01:50

回答

0

新裝的Watir。我已經安裝了devkit。 我在watir安裝中遇到'libxml2 is missing'錯誤。寶石安裝nokogiri - 然後重新做watir安裝 - 現在一切正常(watir安裝)。環境:平臺Win 7 64位;紅寶石1.9.3; rubyGems 1.8.24。
我得到了Ruby 1.9.3在http://rubyinstaller.org/downloads。我只是假設它是32位,它應該在Win7 64位操作系統上運行正常 注意我沒有做gem update --system,因爲它將RubyGems更新爲2.0.3。檢查你的Rubygems版本,如果你有RubyGems 2.0.3,那麼也許這是問題所在。