Ruby on rails 无法在60秒内获得稳定的firefox连接(与版本无关?)
我刚刚安装了Ruby on rails 无法在60秒内获得稳定的firefox连接(与版本无关?),ruby-on-rails,firefox,selenium-webdriver,capybara,ruby-on-rails-4.2,Ruby On Rails,Firefox,Selenium Webdriver,Capybara,Ruby On Rails 4.2,我刚刚安装了selenium webdriver(2.45.0)与capybara(2.4.0)一起用于功能测试(来自bundle show的版本)。我从gemfile中删除了这两个版本的版本号,以确保获得最新版本。当我发现这个错误时,我搜索了SO,随后将Firefox降级为33版 我已经阅读了所有关于SO的“无法在60秒内获得稳定的firefox连接”的帖子,主题基本相同-selenium webdriver的selenium版本不适用于最新版本的firefox。不幸的是,我尝试了所有建议,仍
selenium webdriver
(2.45.0)与capybara
(2.4.0)一起用于功能测试(来自bundle show的版本)。我从gemfile
中删除了这两个版本的版本号,以确保获得最新版本。当我发现这个错误时,我搜索了SO,随后将Firefox降级为33版
我已经阅读了所有关于SO的“无法在60秒内获得稳定的firefox连接”的帖子,主题基本相同-selenium webdriver的selenium
版本不适用于最新版本的firefox
。不幸的是,我尝试了所有建议,仍然得到相同的错误
有没有其他(非常基本的)东西我可能会遗漏(记住我刚开始使用硒)?还要注意,我使用的是Cloud9IDE
更新-我的测试环境设置(为简洁起见删除注释):
几个月前,我也遇到了同样的问题,我下载了一个稳定版本的firefox,然后把它放到我的本地目录中,解决了这个问题
在--/featutes/support/env.rb文件中,我设置了Selenium::WebDriver::Firefox::Binary.path的路径
这是我的密码:
Capybara.register_driver :selenium do |app|
Selenium::WebDriver::Firefox::Binary.path=("/localpath/firefox/firefox") if REGISTRY[:local_path_for_selenium] # I have used condition so it will not effect my production enviroment
profile = Selenium::WebDriver::Firefox::Profile.new
profile.assume_untrusted_certificate_issuer = false
profile.secure_ssl = false
http_client = Selenium::WebDriver::Remote::Http::Default.new
http_client.timeout = 410
Capybara::Selenium::Driver.new(app, :profile => profile,:http_client => http_client)
end
Capybara.default_driver = :selenium
谢谢拉扎。不知道你所说的“将FF放入本地目录”是什么意思。。。我不能将路径设置为当前下载的位置(V33)吗?另外,/features/support/env.rb
在哪里?你是说config/environments/test.rb'?最后,是不是
Capybara.default\u driver=:selenium`会让Capybara在我的所有功能测试中使用selenium(而不仅仅是JS)。在您的文件系统(anywere)中下载(V33)摘录如果它是gz文件2,不要担心'features/support/env.rb'基本上是cucumber设置文件,它可能会有所不同。3.最后一件事是设置下载的FF的Selenium::WebDriver::Firefox::Binary.path=(“/localpath/Firefox/Firefox”)路径。在您的应用程序“Selenium::WebDriver::Firefox::”中的故事结束搜索将其二进制路径设置为本地FF binary。好的,谢谢Raza。我在其他事情的中间,但在我的名单后面尝试。我会让你知道我是怎么做的。如果它有用并且有效,请投票,然后请接受我的答案
Capybara.register_driver :selenium do |app|
Selenium::WebDriver::Firefox::Binary.path=("/localpath/firefox/firefox") if REGISTRY[:local_path_for_selenium] # I have used condition so it will not effect my production enviroment
profile = Selenium::WebDriver::Firefox::Profile.new
profile.assume_untrusted_certificate_issuer = false
profile.secure_ssl = false
http_client = Selenium::WebDriver::Remote::Http::Default.new
http_client.timeout = 410
Capybara::Selenium::Driver.new(app, :profile => profile,:http_client => http_client)
end
Capybara.default_driver = :selenium