2012-08-06 54 views
1

不知怎的,从今天起,我正在从我的黄瓜代码下面的错误 -硒的webdriver错误代码502

硒:: webdriver的::错误:: WebDriverError:意外的响应,代码= 502,内容类型=” 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"> 
+0

以下是有趣的事情 - 当我将SDK从JRuby 1.5.6更改为Ruby 1.87时,它工作正常......问题仅在于JRuby ......与Ruby SDK相同的事情正常工作......我尝试过各种版本的JRuby ..就像1.6.5和1.6.7,它抛出了相同的错误,但是当我尝试1.8.7它工作正常 - 它打开浏览器没有错误 – 2012-08-06 15:29:10

回答

2

502的代码被HTTP响应代码,则意味着Bad Gateway - 问题是由于您的请求正在经过的上游服务器之一的配置错误或错误。

+0

所以,我的工作是弄清楚几件事情 - 首先我是否更改了我的代理密码..或是否有任何代理设置已更改。但是,这里有趣的是 - 当我将SDK从JRuby 1.56更改为Ruby 1.87时,它工作正常......问题仅在于JRuby ......与Ruby SDK相同的工作正常...... – 2012-08-06 15:26:43