dmo*_*oly 20 browser testing selenium cucumber ruby-on-rails-3
对于我的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)
Run Code Online (Sandbox Code Playgroud)
如果可能的话,我想使用谷歌浏览器作为浏览器 - 而不是Firefox(我还没有安装).这可能吗?可以做些什么?
事实上,Cucumber/Selenium不应该检测浏览器并使用它吗?
==== ====编辑
添加后
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
Run Code Online (Sandbox Code Playgroud)
...到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'
Run Code Online (Sandbox Code Playgroud)
我从这里下载了,我已经尝试将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)
Run Code Online (Sandbox Code Playgroud)
帮助赞赏!越来越近...
Joe*_*gen 32
对于水豚,将其添加到env.rb
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
Run Code Online (Sandbox Code Playgroud)
下载Chrome驱动程序可执行文件并将其复制到您的路径中,例如/ usr/bin /并使其可执行
$ sudo chmod +x /usr/bin/chromedriver
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22122 次 |
| 最近记录: |