- 使用wb.doScript执行js脚本提交的方法
- import win;
- import win.ui;
- import win.ui.menu
- import win.ole
- /*DSG{{*/
- var winform = win.form(parent=...; min=1;bottom=249;scroll=1;right=349;text="AAuto Form";max=1 )
- winform.add( )
- /*}}*/
- import web.form;
- //创建web窗体
- var wb = web.form( winform );
- //打开目标网站
- wb.go("http://secure.verycd.com/3rdServices/50hero")
- winform.show(true)
- wb.wait("");
- //登录
- wb.getEle("username").value="登录用户名"
- wb.getEle("password").value="999999"
- wb.doScript("FormSubmit()")
- //进入消息循环
- win.loopMessage();
- return wb,winform;
- 使用ele.form.submit提交的方法
- import win;
- import win.ui;
- import win.ui.menu
- import win.ole
- /*DSG{{*/
- var winform = win.form(parent=...; min=1;bottom=249;scroll=1;right=349;text="AAuto Form";max=1 )
- winform.add( )
- /*}}*/
- import web.form;
- //创建web窗体
- var wb = web.form( winform );
- //打开目标网站
- wb.go("http://secure.verycd.com/3rdServices/50hero")
- winform.show(true)
- wb.wait("");
- //登录
- wb.getEle("username").value="登录用户名"
- ele = wb.getEle("password")
- ele.value="999999"
- ele.form.action = 'http://secure.verycd.com/signin?f=out'
- ele.form.submit()
- //进入消息循环
- win.loopMessage();
- return wb,winform;
- 自动post的方法
- import win;
- import win.ui;
- import win.ui.menu
- import win.ole
- /*DSG{{*/
- var winform = win.form(parent=...; min=1;bottom=249;scroll=1;right=349;text="AAuto Form";max=1 )
- winform.add( )
- /*}}*/
- import web.form;
- //创建web窗体
- var wb = web.form( winform );
- //构建上传数据
- postData = string.fromto(
- "ru=http%3A%2F%2Fsecure.verycd.com%2F3rdServices%2F50hero&login_submit=%E7%99%BB%E5%BD%95&username=登录用户名&password=999999&x=33&y=15&_REFERER="
- ,0
- ,65001
- )
- //自动提交
- wb.post("http://secure.verycd.com/signin?f=out"
- ,postData )
- //显示窗口
- winform.show(true)
- //进入消息循环
- win.loopMessage();
- return wb,winform;
- 使用wb.getDoc().Script.函数(至少一个参数) 执行脚本提交
- import win;
- import win.ui;
- import win.ui.menu
- import win.ole
- /*DSG{{*/
- var winform = win.form(parent=...; min=1;bottom=249;scroll=1;right=349;text="AAuto Form";max=1 )
- winform.add( )
- /*}}*/
- import web.form;
- //创建web窗体
- var wb = web.form( winform );
- //打开目标网站
- wb.go("http://secure.verycd.com/3rdServices/50hero")
- winform.show(true)
- wb.wait("");
- //登录
- wb.getEle("username").value="登录用户名"
- wb.getEle("password").value="999999"
- //这样直接执行函数有返回值,必须至少传递一个参数,随便写一个也可以
- wb.getDoc().Script.FormSubmit(0)
- //进入消息循环
- win.loopMessage();
- return wb,winform;
- 用wb.eachAll查找节点,并使用ele.click()模拟点击提交.
- import win;
- import win.ui;
- import win.ui.menu
- import win.ole
- /*DSG{{*/
- var winform = win.form(parent=...; min=1;bottom=249;scroll=1;right=349;text="AAuto Form";max=1 )
- winform.add( )
- /*}}*/
- import web.form;
- //创建web窗体
- var wb = web.form( winform );
- //打开目标网站
- wb.go("http://secure.verycd.com/3rdServices/50hero")
- winform.show(true)
- wb.wait("");
- //登录
- wb.getEle("username").value="登录用户名"
- wb.getEle("password").value="999999"
- //遍历所有input节点
- for( i,ele in wb.eachAll("input") ){
- if( ele.src == "http://game.verycd.com/hero/wp-content/themes/hero_v1/images/dl.gif" )
- ele.click();
- }
- //进入消息循环
- win.loopMessage();
- return wb,winform;
- 不用web窗体也可以自动提交
- import process;
- import inet.whttp
- whttp = inet.whttp();
- //构建上传数据
- postData = string.fromto(
- "ru=http%3A%2F%2Fsecure.verycd.com%2F3rdServices%2F50hero&login_submit=%E7%99%BB%E5%BD%95&username=登录用户名&password=999999&x=33&y=15&_REFERER="
- ,0
- ,65001
- )
- str,errmsg = whttp.down("http://secure.verycd.com/signin?f=out" ,postData,"" );
- whttp.close();//释放资源
-
- if(str){//如果提交成功则保存到指定文件
- string.save("/post.html",str )
- process.execute( "/post.html" )
- }
- else{//否则输出错误信息
- win.msgbox(errmsg)
- }
复制代码
|
|