对于我的Rails 3.1应用程序上的Cucumber场景,我使用了@javascript标记,因此Selenium已激活。我收到以下错误:
Could not find Firefox binary (os=macosx). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path= (Selenium::WebDriver::Error::WebDriverError)
如果可能的话,我想使用Google Chrome浏览器作为浏览器-而不是Firefox(我尚未安装)。这可能吗?该怎么办?
实际上,Cucumber / Selenium不应检测并使用浏览器吗?
====编辑====
添加后
Capybara.register_driver :selenium do |app| Capybara::Selenium::Driver.new(app, :browser => :chrome) end
…到features / support / env.rb,我现在收到此错误:
Unable to find the chromedriver executable. Please download the server from http://code.google.com/p/chromium/downloads/list and place it somewhere on your PATH. More info at http://code.google.com/p/selenium/wiki/ChromeDriver. (Selenium::WebDriver::Error::WebDriverError) ./features/step_definitions/web_steps.rb:45:in `/^(?:|I )am on (.+)$/' features/update_memories.feature:11:in `Given I am on the home page'
我是从这里下载的,并且尝试将chromedriver可执行文件放在/ usr / bin中,但是仍然出现上述错误。
====编辑2 ====
进一步执行以下步骤并运行“ sudo chmod + x / usr / bin / chromedriver”后,在运行黄瓜之后,我现在收到一个新错误:
@javascript Scenario: navigate to memory update page from home page # features/update_memories.feature:11 Given I am on the home page # features/step_definitions/web_steps.rb:44 unable to connect to chromedriver http://127.0.0.1:57870 (Selenium::WebDriver::Error::WebDriverError) ./features/step_definitions/web_steps.rb:45:in `/^(?:|I )am on (.+)$/' features/update_memories.feature:12:in `Given I am on the home page' When I activate the edit memory switch for the memory "I played" # features/step_definitions/memories/memory_steps.rb:5 Then I should be on the edit memory page for the memory "I played" # features/step_definitions/web_steps.rb:187 PGError: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. : ROLLBACK (ActiveRecord::StatementInvalid)
帮助赞赏!越来越近…
对于水豚,将其添加到 env.rb
下载Chrome驱动程序可执行文件并将其复制到您的路径中,例如 / usr / bin / 并使其可执行
$ sudo chmod +x /usr/bin/chromedriver