我有一個黃瓜測試套件我想在Internet Explorer環境下運行,問題是我在一臺linux機器上。所以我就跟着這個,有點過時了,guide。用黃瓜遠程測試連接虛擬機的問題
我使用的是本地VM嘗試和運行測試,並在那裏我開始告訴我,獨立硒服務器:
RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wb/hub
現在,這似乎有點奇怪,我有本地主機在這裏作爲連接,但無論它在同一臺物理機器上,所以應該沒有問題或?
那麼接下來我env.rb
我已經定義如下:
Capybara.app_host = "http://hostname:4444"
Capybara.default_driver = :selenium
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app,
:browser => :remote,
:url => "http://MYNETWORKIP:4444/wd/hub",
:desired_capabilities => :internet_explorer)
end
爲指導建議。但是,當我運行測試,我得到以下錯誤:
bad URI(is not URI?): 127.0.0.1:4444/wd/hub (URI::InvalidURIError)
我懷疑它是與我暫時落後的代理,因爲我需要爲Firefox(iceweasel)做一些特別的設置來運行。 這些設置是:
Capybara.register_driver :selenium do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
profile["network.proxy.type"] = 2
profile["network.proxy.autoconfig_url"] = "http config adress here"
profile["network.proxy.no_proxies_on"] = "localhost, 127.0.0.1, #{%x[hostname].gsub("\n", "")}"
profile["network.proxy.http"] = "proxy http address here"
profile["network.proxy.http_port"] = 3128
profile["network.proxy.ssl"] = "ssl proxy http address here"
profile["network.proxy.ssl_port"] = 3128
profile["network.proxy.share_proxy_settings"] = true
Capybara::Selenium::Driver.new(app, :profile => profile)
end
花了很多時間試圖讓這個現在的工作,所以我需要一些幫助 Thx提前
編輯:
意識到,某些版本可能會有所幫助。 從的Gemfile:
cucumber (1.1.9)
rails (2.3.11)
selenium-webdriver (2.20.0)
編輯2:
進一步嘗試與改變URL到我的網絡IP地址給了我另一個錯誤:
both URI are relative (URI::BadURIError)
編輯3:
現在用喬恩MI的幫助得到了進一步,但遇到:
unexpected response, code=404, content-type="text/html"
編輯4:
最新更新:
在改變了連接設置我env.rb
這讓我對我的VirtualBox的連接,並開始了我的IE瀏覽器耶! 但是!它無法連接到應用程序。
剛剛添加了一些我的答案,但你可以澄清硒服務器運行的位置?你說它在本地虛擬機上,但是在其他地方說它在'同一臺機器上'。如果它實際上是一臺虛擬機,那麼您將不得不從主機建立到VM guest虛擬機的連接,這可能涉及到設置僅限主機的網絡。 – 2012-08-09 12:45:10