脚本成功运行后,错误显示在Chrome&的命令提示符中歌剧

时间:2012-05-29 06:22:45

标签: watir watir-webdriver selenium-chromedriver

我运行脚本进行简单登录 &安培;在chrome上运行该脚本 它正常运行,允许登录但在脚本完成后显示一些错误,如下所示

D:\>ruby mz1.rb
C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.0.9-x86-mingw32/lib/ffi/platform.rb:27
: Use RbConfig instead of obsolete and deprecated Config.
Started ChromeDriver
port=50378
version=20.0.1133.0
log=D:\chromedriver.log
Login successfull
C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:141:in `read_nonblock': An existing co
nnection was forcibly closed by the remote host. (Errno::ECONNRESET)
        from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill'
        from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
        from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_r
equest'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1293:in `request'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1064:in `head'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.21.2/lib/s
elenium/webdriver/chrome/service.rb:62:in `block in stop'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:745:in `start'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:557:in `start'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.21.2/lib/s
elenium/webdriver/chrome/service.rb:58:in `stop'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.21.2/lib/s
elenium/webdriver/chrome/service.rb:52:in `block in start'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.21.2/lib/s
elenium/webdriver/common/platform.rb:124:in `block in exit_hook'

当我在Opera上运行脚本时,它也允许登录,但在登录后它会关闭浏览器。 我无法理解该问题,因为它没有在cmd提示中显示任何错误,它直接关闭了Opera浏览器。

D:\>ruby mz1.rb
C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.0.9-x86-mingw32/lib/ffi/platform.rb:27
: Use RbConfig instead of obsolete and deprecated Config.
Login successfull

脚本代码如下

$b = Watir::Browser.new :opera
$b.goto("url")      
$b.text_field(:id=> 'txtLoginId').set 'user'
sleep 02
$b.text_field(:id=>  'txtPwd').set 'password'
$b.button(:id=> 'btnSubmit').click
puts "Login successfull"
sleep 05

0 个答案:

没有答案