2009-11-05 41 views
0

当我在Selenium模式下使用AJAX + Webrat时,我经常会有 指定真实域和子域。必然地,我会得到这个消息 很多:恼人的Webrat/Selenium更改域名时发出警告

14:00:45.222 WARN - 你似乎是 从 http://test.host:3001改变域 http://elabs.test.host:3001/dashboard 这可能会导致从 一个“不准”浏览器(除非它在运行 为* iehta或*铬,或者可替换地 硒服务器在 代理喷射模式运行)

虽然准确,它堵塞了我的输出,对我来说很没用。 有关如何在运行 Selenium模式时抑制此消息的任何想法?

回答

1

你可以和2个额外的配置参数,你webrat配置:

Webrat.configure do |config| 
    config.mode = :selenium 
    config.application_address = "elabs.test.host" 
    config.application_port = "3001/dashboard" 
    // other properties 
end 

的端口看起来怪异,但我知道webrat做简单的字符串连接(地址+端口)。

+0

我知道我可以将其设置在开始,但对于子域?我们的许多应用程序都有不同的子域名,所以在场景中您经常会从“test.host”移动到“elabs.test.host” – kfitzpatrick 2009-11-06 14:17:13

0

或者,你可以在config.application_address指定基本URL,并跳过application_port:

Webrat.configure do |config| 
    config.mode = :selenium 
    config.application_address = "elabs.test.host:3001/dashboard/" 
    // other properties 
end 
0

我有exctaly同样的问题,在它被访问的网址有误造成的。就像这样:

def path_to(page_name) 
    case page_name 

    when /home/ 
     url_for(:controller => 'admin/colaboracao', :action => 'show') 

这是它是如何解决:

def path_to(page_name) 
    case page_name 

    when /home/ 
     '/admin/colaboracao'