Skip to content

Instantly share code, notes, and snippets.

@hamajyotan
Last active September 30, 2016 13:53
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 hamajyotan/9d0030b9e963bacac3fd to your computer and use it in GitHub Desktop.
Save hamajyotan/9d0030b9e963bacac3fd to your computer and use it in GitHub Desktop.
So-net 0sim
#!/usr/bin/env ruby
require 'bundler'
Bundler.require
Capybara.run_server = false
Capybara::Session.new(:poltergeist).tap do |page|
page.visit 'https://www.so-net.ne.jp/retail/w/'
page.within 'form[name=Login]' do
page.find('input[name=IDToken1]').set ENV['ZEROSIM_ID']
page.find('input[name=IDToken2]').set ENV['ZEROSIM_PW']
page.find('input#simSubmit[type=submit]').click
end
page.find('#menuUseCondition').click
page.within 'dl.useConditionDisplay' do
page.all('dt, dd').each do |el|
puts el.text
end
end
end
source 'https://rubygems.org'
group :default do
gem 'nokogiri'
gem 'capybara'
gem 'poltergeist', require: 'capybara/poltergeist'
end
@hamajyotan
Copy link
Author

ZEROSIM_ID=foo ZEROSIM_PW=bar ./0sim
今月のデータ使用量(速報値)
144 MB
本日のデータ使用量(速報値)
0 MB
昨日のデータ使用量
0 MB
一昨日のデータ使用量
0 MB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment