Đối với kịch bản Cucumber trên ứng dụng Rails 3.1 của tôi, tôi đã sử dụng thẻ @javascript, vì vậy Selenium được kích hoạt. tôi nhận được lỗi sau:Dưa chuột; Selenium WebDriver - cách sử dụng Google Chrome làm trình duyệt thử nghiệm thay vì Firefox
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)
Nếu có thể, tôi muốn sử dụng Google Chrome làm trình duyệt - không Firefox (mà tôi đã không được cài đặt). Điều này có thể không? Có thể làm gì?
Thực tế, Cucumber/Selenium có phát hiện trình duyệt và sử dụng không?
==== EDIT ====
Sau khi thêm
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
... đến các tính năng/support/env.rb, bây giờ tôi nhận được lỗi này:
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'
Tôi đã tải xuống từ here và tôi đã thử đưa tệp thực thi chromedriver vào/usr/bin, nhưng tôi vẫn gặp lỗi ở trên.
==== EDIT 2 ====
Sau khi đi một bước xa hơn và chạy "sudo chmod + x/usr/bin/chromedriver" như đề xuất dưới đây, bây giờ tôi nhận được một lỗi mới sau khi chạy dưa chuột :
@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)
Giúp đánh giá cao! Đến gần hơn ...
Được rồi, tôi đã tiến thêm một bước với lệnh chmod mà bạn đã chỉ định (cảm ơn!), Nhưng bây giờ tôi gặp phải một lỗi mới. Tôi đang cập nhật câu hỏi của mình ngay bây giờ. – dmonopoly
FWIW, tôi có thể cài đặt chromedriver với Homebrew, nhưng cần thêm/usr/local/bin vào Textmate PATH của tôi trong Preferences -> Advanced -> Shell Variables – orbiteleven
Ai đó cho người này kiểm tra câu trả lời đúng! –