Hi all,
I am trying to login to linked in but it is failing with Mechanize.
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
I am getting the same sign in page.
What can be wrong with this piece of code?
Any help will be appreciated.
Thanks in advance.