Selenium 禁用cucumber测试的Cookie
我希望能够做到以下几点:Selenium 禁用cucumber测试的Cookie,selenium,cucumber,capybara,Selenium,Cucumber,Capybara,我希望能够做到以下几点: @javascript @disallow_cookies Scenario: Test Something that depends on cookies 我如何编写@disallow\u cookiescucumber钩子来实现这一点 我正在使用以下工具: @javascript @disallow_cookies Scenario: Test Something that depends on cookies 宝石‘薄’、‘1.2.11’ 宝石“黄瓜轨道”,
@javascript @disallow_cookies
Scenario: Test Something that depends on cookies
我如何编写@disallow\u cookies
cucumber钩子来实现这一点
我正在使用以下工具:
@javascript @disallow_cookies
Scenario: Test Something that depends on cookies
- 宝石‘薄’、‘1.2.11’
- 宝石“黄瓜轨道”,“1.0.4”
- gem“数据库清理器”,“0.6.7”
- 宝石“水豚”,“1.1.2”
- 宝石“水豚萤火虫”,“0.0.10”
- gem“selenium webdriver”、“2.14.0”
谢谢 这是一个老问题,但问题来了。为标记@disallow\u cookies创建一个before钩子
Before('@disallow_cookies') do
profile = Selenium::WebDriver::Firefox::Profile.new
profile['network.cookie.cookieBehavior'] = 2 # disables all kind of cookies
Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => profile)
end
假设您是在常规钩子之前创建驱动程序,那么您应该很好。我还没有运行这段代码,但这是我要开始这个过程的地方。这是一个老问题,但问题来了。为标记@disallow\u cookies创建一个before钩子
Before('@disallow_cookies') do
profile = Selenium::WebDriver::Firefox::Profile.new
profile['network.cookie.cookieBehavior'] = 2 # disables all kind of cookies
Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => profile)
end
假设您是在常规钩子之前创建驱动程序,那么您应该很好。我还没有运行这段代码,但我会从这里开始这个过程