ruby on rails - Why does signing in with Mechanize on website redirect to the home page? -


I'm trying to add automaticaly to a website using mechanize.

I have searched the Internet, but I am not getting any solution to my problem, that is the reason why, after running form.submit , on the home page Come back

What logs do I try to connect to?

My code:

  mechanize = mechanize.new do agent | Agent.user_agent_alias = "Linux Mozilla" and page = mechanizejet ("http://website.org/") form = mechanism.page.form: first form. Content form Username = "MylanGin" form. Password = "Mypassword" form.submit  

Website snippet code:

  & lt; Div id = "signincontainer" & gt; & Lt; Form method = "POST" verb = "http://website.org/" name = "FL" id = "signin" & gt; & Lt; Input name = "op" value = "login" type = "hidden" & gt; & Lt; Input name = "redirect" value = "" type = "hidden" & gt; & Lt; Span class = "signinq" & gt; & Lt; Input style = "background: url ('images / username.png') No-double scroll 5px 50% RGB (255, 255, 255);" Id = "username" name = "login" title = "user name" tabindex = "4" type = "text" & gt; & Lt; A class = "donthaveaccount" href = "http://website.org/signup.html" & gt; & Lt; Span & gt; Sign up & lt; / Span & gt; & Lt; / A & gt; & Lt; / Span & gt; & Lt; Span class = "signinq" & gt; & Lt; Input style = "background: url ('images / password.png') No-report scroll 5 px 50% RGB (255, 255, 255);" Id = "password" name = "password" value = "" title = "password" tabindex = "5" type = "password" & gt; & Lt; A class = "forgotten password" href = "http://website.org/forgot-pass.html" id = "resend_password_link"> gt; & Lt; Span & gt; Have you forgotten your password? & Lt; / Span & gt; & Lt; / A & gt; & Lt; / Span & gt; & Lt; Input id = "signin_submit" value = "enviar" tabindex = "6" src = "images2 / signin.png" type = "picture" & gt; & Lt; / Form & gt; & Lt; / Div & gt;  

I'm running Ruby 1.9.3-P484 and MacKenzie 2.0.1.

tin man I get full id for Mozilla, but only me The problem is, when I do not write anything in the password, I get an incorrect password or login, but when I write my password does not get anything?

I have improved my code.

agent = Mechanize.new {| A | A.log = Logger.new ("Mechanize.log") Agent.read_timeout = 60

  def add_cookie (Agent, Yuri, Cookie) Yuri = URI.Purs (Yuri) Mechanic :: Cookie. From (Yuri, Cookies). Cookies | Agent.cookie_jar.add (Yuri, Cookie) End and Agent Agent. User_agent_lays = 'linux mozilla' {'linux mozilla' = & gt; 'Mozilla / 5.0 (X11; U; Linux i686; N-US; RV. 1.4) Gecho / 20030624', 'Linux Firefox' = & gt; 'Mozilla / 5.0 (X11; U; Linux i686; N-US; RV: 1.9.2.1) Geico / 20100122 Firefox / 3.6.1'} Agent.Jet ("http://youwatch.org/?op=my_files ") Form = agent.page.parser.css ['form'] [0] agent.page.forms [0] [" login "] =" jealous "agent.page.forces [0] [" password "] = "Pbxk @ 1064" f = agent.page.forms [0]. Submit submit f.content  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -