Skip to content

Instantly share code, notes, and snippets.

@komiyake
Last active April 13, 2016 15:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save komiyake/ed51173a54f8227089e5 to your computer and use it in GitHub Desktop.
Save komiyake/ed51173a54f8227089e5 to your computer and use it in GitHub Desktop.
Webauthに接続するよ
require 'capybara'
require 'capybara/dsl'
require 'selenium-webdriver'
require 'io/console'
Capybara.run_server = false
Capybara.current_driver = :selenium
Capybara.app_host = "https://webauth.ritsumei.ac.jp/fs/customwebauth/login.html?switch_url=https://webauth.ritsumei.ac.jp/login.html&wlan=WebAuth"
class Webauth
include Capybara::DSL
def login(id, pass)
visit ('/')
sleep 1
fill_in "username",
:with => id
fill_in "password",
:with => pass
click_button "Submit"
end
end
print "username: "
id = STDIN.gets.chomp
print "pass: "
pass = STDIN.noecho(&:gets).chomp
webauth = Webauth.new
webauth.login(id, pass)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment