fail to parse page after redirect in login form

R

Rita Amritkar

Hi all,

My code is,

agent = WWW::Mechanize.new
page = agent.get("https://www.linkedin.com")
link = page.links.find {|l| l.text =~ /Sign in/}
page = agent.click(link)
form = page.forms.first
form.fields.find {|f| f.name == "session_login" }.value = "linkedin_id"
form.fields.find {|f| f.name == "session_password" }.value = "password"
page = agent.submit(form, form.buttons.first)
puts page.body

It gives me the same page as sign in. The result is not the redirected
home page.
Multiple redirects are there so there could be a problem with cookies or
may be the problem with code.

Can anyone help me?

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top