Module: MediawikiSelenium::LoginHelper
- Defined in:
- lib/mediawiki_selenium/helpers/login_helper.rb
Overview
Expepiates logging in to wikis by authenticating with the MW API and transfering the returned cookie to the current browser.
Instance Method Summary collapse
-
#log_in(cookies = {}) ⇒ Object
Authenticate with the current wiki's API and save the resulting cookie in the current browser.
Instance Method Details
#log_in(cookies = {}) ⇒ Object
Authenticate with the current wiki's API and save the resulting cookie in the current browser.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mediawiki_selenium/helpers/login_helper.rb', line 13 def log_in( = {}) visit_wiki do |url| uri = URI.parse(url) = {} [:domain] = uri.host unless ['localhost', '127.0.0.1'].include?(uri.host) api..each do || browser..add .name, .value, .merge({ secure: .secure, path: .path, expires: .expires }) end .each do |name, value| browser..add name.to_s, value, end browser.refresh end end |