问题描述
- 关于 python 的一个自动登录脚本的问题
-
一个要等5秒之后才可以登录,有onclick() 函数的应该怎么做一个自动登陆的python脚步,哪个大神给我讲一下。万分谢谢。这是网页源代码片段
function Clicked(){
if(sv1==1)
document.form1.v6ip.value=myv6ip;
if(osele!=1){
if(sv==2&&m46==1)
v4serip=v6;
open("http://"+v4serip+":9002/In0","p99","width=280,height=50,left=0,top=0,toolbar=no,crollbars=no,status=no");
}
var thisform=document.forms[0];
if(thisform.DDDDD.value=="") {
thisform.DDDDD.focus();
alert("请您输入用户帐号");
return false;
} else if(thisform.upass.value=="") {
thisform.upass.focus();
alert("请您输入用户密码");
return false;
} else {
setCookie("myusername",thisform.DDDDD.value,10);
if(thisform.savePWD.checked)
setCookie("pwd",thisform.upass.value,10);
else
setCookie("pwd","",-10);
setCookie("username",thisform.DDDDD.value,10)
setCookie("smartdot",thisform.upass.value,10)
thisform.submit();
}
}function tologin(){
var thisform=document.forms[0];
if(thisform.DDDDD.value=="") {
thisform.DDDDD.focus();
alert("请您输入用户帐号");
return false;
} else if(thisform.upass.value=="") {
thisform.upass.focus();
alert("请您输入用户密码");
return false;
} else {
setCookie("myusername",thisform.DDDDD.value,10);
if(thisform.savePWD.checked)
setCookie("pwd",thisform.upass.value,10);
else
setCookie("pwd","",-10);
setCookie("username",thisform.DDDDD.value,10)
setCookie("smartdot",thisform.upass.value,10)
return true;
}
}
function setCookie(cookieName,cvalue,expiredays,path){
var expireDate = new Date();
var expireStr = "";
if (expiredays != null) {
expireDate.setTime(expireDate.getTime()+(expiredays*24*3600*1000));
expireStr="; expires="+expireDate.toGMTString();
}
pathStr = (path == null) ? "; path=/" : "; path=" + path;
document.cookie = cookieName + '=' + escape(cvalue) + expireStr + pathStr;
}
function getCookie(cookieName)
{
var index=-1;
if(document.cookie)
index=document.cookie.indexOf(cookieName);
if(index==-1) {
return "";
} else {
var iBegin = (document.cookie.indexOf("=", index) +1);
var iEnd =document.cookie.indexOf(";", index);
if (iEnd == -1)
{
iEnd = document.cookie.length;
}
return unescape(document.cookie.substring(iBegin,iEnd));
}
}
function test1()
{
document.forms[0].DDDDD.value=getCookie('myusername');
var pwd = getCookie('pwd');
if (pwd != ''){
document.forms[0].upass.value = pwd;
document.forms[0].savePWD.checked = true;
}
setFormFocus();
}
function $(id)
{
return document.getElementById(id);
}
var remain =5;
function init(){
$("btn").innerHTML = "请稍等("+(remain--)+"秒)";
if(remain>-1){
window.setTimeout(init,1000);
}
else{
$("btn").disabled = false;
$("btn").innerHTML = "登录 Login";
}
}
function on_load(){
test1();
init();
var ua = window.navigator.userAgent.toLowerCase();
url6='iv6';if (ua.indexOf("firefox")>-1)url6='nv6';
if(sv==1&&sv1==0&&domain!='dr.com')document.getElementById("c").src='http://'+domain+':9002/'+url6;
}
登录 Login万分感谢
解决方案
解决方案二:
看网页上面的提交地址是什么,然后模拟一个请求提交相关的参数。