以gmail为例,详细讲解C#技巧:网页表单自动填写技术
2012-02-06 00:00
477 查看
此技术常用于购物导航搜索,如淘宝网购物上的商品搜索自动提示功能:
var ie=WScript.createobject("InternetExplorer.Application");
var args = WScript.arguments;
var followme="http://www.89900.com";
if(args.length>0)
{
followme+=args(0);
}
ie.Navigate("https://www.google.com/accounts/Login?continue="+followme);
SynchronizeIE();
var doc=ie.document;
doc.forms[0].Email.value="lixianmin@gmail.com";
doc.forms[0].Passwd.value="密码写在这里";
//这是因为PersistentCookie这个checkbox有时候有而有时候没有。
if(doc.forms[0].PersistentCookie!=null)
{
doc.forms[0].PersistentCookie.checked=false;
}
doc.forms[0].submit();
SynchronizeIE();
ie.Visible=true;
//等待IE操作结束。
function SynchronizeIE()
{
while(ie.Busy)
{
WScript.Sleep(100);
}
}
假定把该文件保存为googleSpecific.js,存放在%windir%\system32路径下,并建立如下内容的一个google.bat文件同样放在%windir%\system32路径下。
@cls
@wscript %windir%\system32\googleSpecific.js %1 %2 %3 %4 %5 %6 %7 %8 %9
然后,在命令行执行语句:go mail,就可以直接登陆到你的gmail了。
var ie=WScript.createobject("InternetExplorer.Application");
var args = WScript.arguments;
var followme="http://www.89900.com";
if(args.length>0)
{
followme+=args(0);
}
ie.Navigate("https://www.google.com/accounts/Login?continue="+followme);
SynchronizeIE();
var doc=ie.document;
doc.forms[0].Email.value="lixianmin@gmail.com";
doc.forms[0].Passwd.value="密码写在这里";
//这是因为PersistentCookie这个checkbox有时候有而有时候没有。
if(doc.forms[0].PersistentCookie!=null)
{
doc.forms[0].PersistentCookie.checked=false;
}
doc.forms[0].submit();
SynchronizeIE();
ie.Visible=true;
//等待IE操作结束。
function SynchronizeIE()
{
while(ie.Busy)
{
WScript.Sleep(100);
}
}
假定把该文件保存为googleSpecific.js,存放在%windir%\system32路径下,并建立如下内容的一个google.bat文件同样放在%windir%\system32路径下。
@cls
@wscript %windir%\system32\googleSpecific.js %1 %2 %3 %4 %5 %6 %7 %8 %9
然后,在命令行执行语句:go mail,就可以直接登陆到你的gmail了。
相关文章推荐
- C#技巧:网页表单自动填写技术(gmail为例)
- C#技巧:网页表单自动填写技术(以gmail为例)
- C#技巧:网页表单自动填写技术(gmail为例)
- 网页表单自动填写技术(gmail为例)
- 关于c#的webbrows控件自动填写表单并获取提交后的网页内容
- C#网页表单自动填写实现原理
- 让一个网页打开的同时自动为另一个网页自动填写表单并提交
- 自动填写网页表单
- 遍历当前网页表单,并自动填写提交的问题(VC++)!
- C#实现网页表单自动提交
- javascript自动填写表单小技巧
- C#实现网页表单自动提交(126邮箱登录例程)
- delphi实现自动填写表单和调用网页上的函数
- C#实现网页表单自动提交(126邮箱登录例程)
- 详细讲解在c#语言中DateTime类常用技巧
- vc遍历网页表单并自动填写提交
- 忆龙2009:用C#如何自动提交网页表单
- C#实现网页表单自动提交
- vc遍历网页表单并自动填写提交
- 访问网页并自动填写表单