I have a question about using selenium in cucumber.
here is the cucumber features:
@selenium @javascript
Scenario: Create forum
Given I have a site named "hairclub" and I logged in as admin
When I am on the "admin" page
To run, I use this command:
cucumber features/forum.feature
It works fine; it opens the bro开发者_如何学运维wser (as you can see @selenium @javascript tag
). Everything looks good.
I want to run the same cucumber script but not open the browser; I imagine if the scenario grows it will take a while to run with the browser. I want both the capability to run with browser open and also without browser opening. Is there any command I can pass it from terminal to overwrite @selenium @javascript
?
You can't run Selenium without a browser, because Selenium works by controlling the browser.
However, you can run Cucumber features without using Selenium.
If the scenario doesn't require JavaScript then you can use mechanize:
Capybara.default_driver = :mechanize
If you do need to test JavaScript, then Thoughtbot have just released this helpful gem: https://github.com/thoughtbot/capybara-webkit
精彩评论