Re: LinkedIn still not working?
Lonny Eachus <lonny6 <at> gmail.com>
2011-03-29 17:18:37 GMT
No, the problem is as I stated.
It does indeed redirect, but to the wrong place: I end up on a redirect page, but the link is back to the home
(landing) page, not the user page it should go to. It appears that Mechanize is NOT successfully logging
in, for whatever reason, precisely as described in the link I first gave.
At least that is the appearance of things... it might be failing for a different reason but it is still
failing, and trying to redirect me to the landing page ("http://www.linkedin.com/home") rather than
the user's home page ("http://www.linkedin.com/nhome").
If anybody has an answer, I would really appreciate it. It it important for me to do this, and I have been
pulling my hair.
> Message: 7
> Date: Tue, 29 Mar 2011 09:53:28 -0400
> From: Benjamin Manns <benmanns <at> gmail.com>
> To: Ruby Mechanize Users List <mechanize-users <at> rubyforge.org>
> Subject: Re: [Mechanize-users] LinkedIn still not working?
> <AANLkTikg4qKN0Gttf=OkvuR8wJXtx-Td5fN49EnEuUPy <at> mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> Assuming that you're not getting hit by the captcha, the reason is that
> follow the redirect. However, you can still login by either manually
> here' to redirect link.
> require 'mechanize'
> agent = Mechanize.new
> agent.set_proxy 'localhost', 8080
> page = agent.get 'http://www.linkedin.com/'
> page = page.link_with(:text => /Sign in/).click
> form = page.form_with(:name => 'login')
> form.session_key = 'benmanns <at> gmail.com'
> form.session_password = 'mypassword'
> page = form.submit # form.button_with(:value => /Sign In/)
> |script| script.content.match(/window\.location\.replace\('([^']+)'\);/)
> page = page.link_with(:text => /click here/).click
> code needs to be cleaned up, and doesn't handle when a URI contains
> apostrophes (').
> Good Luck,