I'm trying to connect automaticaly to a website using Mechanize.
I read searched the internet but I can't find any solution to my problem, which is why when i write nothing in, value = ""
, I get Incorrect Login or Password but when i write my password i get nothing ?
agent = Mechanize.new{ |a| a.log = Logger.new("mech.log") }
@agent.user_agent_alias = 'Linux Firefox'
login_page = agent.get('http://xxxx.org/?op=my_files')
login_form = login_page.forms.first
login_field = login_form.field_with(name: "login").value = "MyLogin"
password_field = login_form.field_with(name: "password").value = "MyPassword"
home_page = login_form.submit
puts home_page.content
the code HTML
<div id="signincontainer">
<form method="POST" action="http://xxx.org/" name="FL" id="signin">
<input name="op" value="login" type="hidden">
<input name="redirect" value="" type="hidden">
<span class="signinq">
<input style="background: url('images/username.png') no-repeat
scroll 5px 50% rgb(255, 255, 255);" id="username" name="login"
title="username" tabindex="4" type="text">
<a class="donthaveaccount" href="http://xxxx.org/signup.html"><span>
Sign Up
</span></a> </span> <span class="signinq">
<input style="background: url('images/password.png') no-repeat
scroll 5px 50% rgb(255, 255, 255);" id="password" name="password"
value="" title="password" tabindex="5" type="password">
<a class="forgotpassword" href="http://xxxx.org/forgot-pass.html" id="resend_password_link"><span>
Forgot your password?
</span></a> </span>
<input id="signin_submit" value="Enviar" tabindex="6" src="images2/signin.png" type="image">
</form>
</div>
the log file of the connection : https://gist.github.com/anonymous/b24486ab1822c178b190
document.cookie.
--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "RubyFR public".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse rubyfr-publi...@googlegroups.com.
Pour envoyer un message à ce groupe, envoyez un e-mail à l'adresse rubyfr...@googlegroups.com.
Visitez ce groupe à l'adresse http://groups.google.com/group/rubyfr-public.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.
I'm trying to connect automaticaly to a website using Mechanize.
I read searched the internet but I can't find any solution to my problem, which is why when i write nothing in,
value = ""
, I get Incorrect Login or Password but when i write my password i get nothing ?
agent = Mechanize.new{ |a| a.log = Logger.new("mech.log") }
@agent.user_agent_alias = 'Linux Firefox'
login_page = agent.get('http://xxxx.org/?op=my_files')
login_form = login_page.forms.first
login_field = login_form.field_with(name: "login").value = "MyLogin"
password_field = login_form.field_with(name: "password").value = "MyPassword"
home_page = login_form.submit
puts home_page.content
the code HTML
<div id="signincontainer">
<form method="POST" action="http://xxx.org/" name="FL" id="signin">
<input name="op" value="login" type="hidden">
<input name="redirect" value="" type="hidden">
<span class="signinq">
<input style="background: url('images/username.png') no-repeat scroll 5px 50% rgb(255, 255, 255);" id="username" name="login" title="username" tabindex="4" type="text">
<a class="donthaveaccount" href="http://xxxx.org/signup.html"><span>
Sign Up
</span></a> </span> <span class="signinq">
<input style="background: url('images/password.png') no-repeat scroll 5px 50% rgb(255, 255, 255);" id="password" name="password" value="" title="password" tabindex="5" type="password">
<a class="forgotpassword" href="http://xxxx.org/forgot-pass.html" id="resend_password_link"><span>
Forgot your password?
</span></a> </span>
<input id="signin_submit" value="Enviar" tabindex="6" src="images2/signin.png" type="image">
</form>
</div>
the log file of the connection : https://gist.github.com/anonymous/b24486ab1822c178b190