22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/telenorsms.rb', line 22
def login username, password
forms = @agent.get(@login_url).forms
login_form = nil
forms.each {|form| login_form = form if form.action == "https://telenormobil.no/minesider/login.do" }
login_form.j_username = username
login_form.j_password = password
@agent.submit(login_form)
if @agent.page.uri.to_s == @login_url then
error = @agent.page / "div[id='main_content']" / "div[class='section error']" / "span"
if error != nil then raise error.inner_html end
end
end
|