Module: Capybara::UserAgent::DSL
- Defined in:
- lib/capybara/user_agent/dsl.rb
Instance Method Summary collapse
Instance Method Details
#set_custom_user_agent(user_agent) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/capybara/user_agent/dsl.rb', line 8 def set_custom_user_agent(user_agent) driver = Capybara.current_session.driver if driver.respond_to?(:add_headers) driver.add_headers('User-Agent' => user_agent) else driver.header('User-Agent', user_agent) end end |
#set_user_agent(type) ⇒ Object
4 5 6 |
# File 'lib/capybara/user_agent/dsl.rb', line 4 def set_user_agent(type) set_custom_user_agent(Capybara::UserAgent.user_agents[type]) end |