2011-02-05 71 views
0

我已經在黃瓜中設置了一個功能,並使用@javascript標籤讓它在硒中運行 在我的開發機器上硒運行良好,但因爲webdriver不支持本地事件在OSX但我需要把它掛到虛擬機運行Ubuntu遠程Selenium WebDriver沒有響應黃瓜測試

我有webdriver的服務器上運行我的Ubuntu機器

上攻擊我的水豚司機像這樣把它連接到像這樣的遠程服務器:

def browser 
    unless @browser 

    @browser = Selenium::WebDriver.for(:remote, :url => "http://192.168.1.69:4444/wd/hub", 
     :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.firefox) 
    #@browser = Selenium::WebDriver.for(options.delete(:browser) || :firefox, options) 
    at_exit do 
     @browser.quit 
    end 
    end 
    @browser 
end 

當我跑我的測試我的虛擬機上的控制檯顯示出頭的事情和輸出:

webdriver的遠程服務器:INFO執行....

但那是一段時間後,由於超時

測試失敗

有沒有想法?

回答

0

我不確定是什麼原因導致您的具體問題。

profile = Selenium::WebDriver::Firefox::Profile.new 
profile["network.http.use-cache"] = false 

Capybara.register_driver :firefox_ubuntu do |app| 
    Capybara::Driver::Selenium.new(app, 
    :browser => :remote, 
    :url => 'http://192.168.1.69:4444/wd/hub', 
    :desired_capabilities =>  Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile) 
) 
end 

,然後你可以使用正常的機制切換到它:

Capybara.current_dirver :firefox_ubuntu 
+0

啊輝煌我也一直在尋找更好的方式來做到這一點,但你應該使用內置的機構註冊您的驅動器 probs雖然,如何設置配置文件?我從另一個帖子中猜出一半我發現: profile = Selenium :: WebDriver :: Firefox :: Profile.new 但我得到: 未初始化的常量Selenium – msaspence 2011-02-16 08:27:50