2012-08-06 73 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