Selenium Webdriver错误代码502

时间:2012-08-06 14:45:21

标签: cucumber watir-webdriver irb selenium-webdriver

从今天开始,我从我的黄瓜代码中得到以下错误 -

Selenium :: WebDriver :: Error :: WebDriverError:意外响应,代码= 502,content-type =“text / html” 然后是页面的整个HTML文本。

以下是完整的IRB控制台互动 -

C:\jruby-1.6.5\bin\jruby.exe --1.8 -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/jruby-1.6.5/bin/jirb - prompt simple
>> require "rubygems"
=> true

?> require "watir-webdriver"
=> true

?> @browser = Watir::Browser.new :ie
Started InternetExplorerDriver server (32-bit) 
2.25.2.0
Listening on port 5555
Selenium::WebDriver::Error::WebDriverError: unexpected response, code=502, content-type="text/html"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<!-- Page creation information:
   FileName: cannotconnect.html
   Language: [my] New Language Pack
Created with: Language Pack Designer 0.0.0.8
Creation date: 9/26/2011 10:19:48 AM
-->

<!--Head-->
<head>
  <title>Can

...然后是一个我没有粘贴的大型HTML转储

&安培;最后 -

</html>
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/http/common.rb:66:in `create_response'
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/http/default.rb:59:in `request'
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/bridge.rb:598:in `raw_execute'
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/bridge.rb:92:in `create_session'
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/ie/bridge.rb:43:in `initialize'
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/common/driver.rb:35:in `for'
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver.rb:65:in `for'
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/watir-webdriver-0.5.8/lib/watir-webdriver/browser.rb:35:in `initialize'
from (irb):7:in `evaluate'
from org/jruby/RubyKernel.java:1088:in `eval'
from C:/jruby-1.6.5/lib/ruby/1.8/irb.rb:158:in `eval_input'
from C:/jruby-1.6.5/lib/ruby/1.8/irb.rb:271:in `signal_status'
from C:/jruby-1.6.5/lib/ruby/1.8/irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1420:in `loop'
from org/jruby/RubyKernel.java:1192:in `catch'
from C:/jruby-1.6.5/lib/ruby/1.8/irb.rb:154:in `eval_input'
from C:/jruby-1.6.5/lib/ruby/1.8/irb.rb:71:in `start'
from org/jruby/RubyKernel.java:1192:in `catch'
from C:/jruby-1.6.5/lib/ruby/1.8/irb.rb:70:in `start'
from C:/jruby-1.6.5/bin/jirb:13:in `(root)'
from org/jruby/RubyKernel.java:1063:in `load'
from -e:1:in `(root)'>> 

这从今天早上开始突然发生,所以,我的问题是......错误代码= 502说什么?如果你看一下这个日志的顶部 - 它说

Selenium::WebDriver::Error::WebDriverError: unexpected response, code=502

那么,这是什么意思?问题出在哪儿?是代理问题还是其他问题? 我尝试过不同的浏览器并遇到同样的问题?

更新 -

这是有趣的事情 - 当我将我的SDK从JRuby 1.5.6更改为Ruby 1.87时,它工作得很好......问题只出现在JRuby上......与Ruby SDK相同的工作正常...我试过了各种版本的JRuby ..比如1.6.5和1.6.7,它抛出相同的错误,但是当我尝试1.8.7它工作正常 - 它打开浏览器没有错误 -

以下是Ruby 1.8.7的代码

C:\Ruby187\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)     C:/Ruby187/bin/irb --prompt simple
>> require "rubygems"
=> true

?> require "watir-webdriver"
=> true

?> @browser = Watir::Browser.new :ie
=> #<Watir::Browser:0x2e18b00 url="http://localhost:5555/" title="WebDriver">

?> @browser = Watir::Browser.new :ie
=> #<Watir::Browser:0x2ef07a0 url="http://localhost:5555/" title="WebDriver">

1 个答案:

答案 0 :(得分:3)

502是HTTP响应代码,它表示Bad Gateway - 问题是由于您的请求正在通过的其中一个上游服务器上的配置错误或错误。