HTML模式WebTours登陆脚本
Action()
{
web_add_auto_header("Upgrade-Insecure-Requests",
"1");
web_url("index.htm",
"URL=http://127.0.0.1:1080/WebTours/index.htm",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
web_set_sockets_option("SSL_VERSION", "TLS1.2");
web_revert_auto_header("Upgrade-Insecure-Requests");
web_add_header("Origin",
"http://127.0.0.1:1080");
web_submit_data("login.pl",
"Action=http://127.0.0.1:1080/cgi-bin/login.pl",
"Method=POST",
"TargetFrame=",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?in=home",
"Snapshot=t3.inf",
"Mode=HTML",
ITEMDATA,
"Name=userSession", "Value=125904.032239773ztHzViipzfiDDDDDDiifHpVDVQf", ENDITEM,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=login.x", "Value=38", ENDITEM,
"Name=login.y", "Value=9", ENDITEM,
"Name=JSFormSubmit", "Value=on", ENDITEM,
LAST);
web_add_header("Upgrade-Insecure-Requests",
"1");
lr_think_time(6);
web_url("SignOff Button",
"URL=http://127.0.0.1:1080/cgi-bin/welcome.pl?signOff=1",
"TargetFrame=body",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?page=menu&in=home",
"Snapshot=t4.inf",
"Mode=HTML",
LAST);
return 0;
}
URL模式WebTours登陆脚本
Action()
{
web_add_auto_header("Upgrade-Insecure-Requests",
"1");
web_url("index.htm",
"URL=http://127.0.0.1:1080/WebTours/index.htm",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t5.inf",
"Mode=HTTP",
LAST);
web_concurrent_start(NULL);
web_url("header.html",
"URL=http://127.0.0.1:1080/WebTours/header.html",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/index.htm",
"Snapshot=t6.inf",
"Mode=HTTP",
LAST);
web_url("welcome.pl",
"URL=http://127.0.0.1:1080/cgi-bin/welcome.pl?signOff=true",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/index.htm",
"Snapshot=t9.inf",
"Mode=HTTP",
LAST);
web_concurrent_end(NULL);
web_concurrent_start(NULL);
web_url("hp_logo.png",
"URL=http://127.0.0.1:1080/WebTours/images/hp_logo.png",
"Resource=1",
"RecContentType=image/png",
"Referer=http://127.0.0.1:1080/WebTours/header.html",
"Snapshot=t7.inf",
LAST);
web_url("webtours.png",
"URL=http://127.0.0.1:1080/WebTours/images/webtours.png",
"Resource=1",
"RecContentType=image/png",
"Referer=http://127.0.0.1:1080/WebTours/header.html",
"Snapshot=t8.inf",
LAST);
web_concurrent_end(NULL);
web_concurrent_start(NULL);
web_url("home.html",
"URL=http://127.0.0.1:1080/WebTours/home.html",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/cgi-bin/welcome.pl?signOff=true",
"Snapshot=t10.inf",
"Mode=HTTP",
LAST);
web_url("nav.pl",
"URL=http://127.0.0.1:1080/cgi-bin/nav.pl?in=home",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/cgi-bin/welcome.pl?signOff=true",
"Snapshot=t11.inf",
"Mode=HTTP",
LAST);
web_concurrent_end(NULL);
web_url("mer_login.gif",
"URL=http://127.0.0.1:1080/WebTours/images/mer_login.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?in=home",
"Snapshot=t12.inf",
LAST);
web_set_sockets_option("SSL_VERSION", "TLS1.2");
web_add_header("Origin",
"http://127.0.0.1:1080");
lr_think_time(13);
web_submit_data("login.pl",
"Action=http://127.0.0.1:1080/cgi-bin/login.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?in=home",
"Snapshot=t13.inf",
"Mode=HTTP",
ITEMDATA,
"Name=userSession", "Value=125908.601215067ztHztcDpzHfDiifipftcAf", ENDITEM,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=login.x", "Value=77", ENDITEM,
"Name=login.y", "Value=0", ENDITEM,
"Name=JSFormSubmit", "Value=off", ENDITEM,
LAST);
web_concurrent_start(NULL);
web_url("login.pl_2",
"URL=http://127.0.0.1:1080/cgi-bin/login.pl?intro=true",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/cgi-bin/login.pl",
"Snapshot=t14.inf",
"Mode=HTTP",
LAST);
web_url("nav.pl_2",
"URL=http://127.0.0.1:1080/cgi-bin/nav.pl?page=menu&in=home",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/cgi-bin/login.pl",
"Snapshot=t15.inf",
"Mode=HTTP",
LAST);
web_concurrent_end(NULL);
web_concurrent_start(NULL);
web_url("in_home.gif",
"URL=http://127.0.0.1:1080/WebTours/images/in_home.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?page=menu&in=home",
"Snapshot=t16.inf",
LAST);
web_url("itinerary.gif",
"URL=http://127.0.0.1:1080/WebTours/images/itinerary.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?page=menu&in=home",
"Snapshot=t17.inf",
LAST);
web_url("signoff.gif",
"URL=http://127.0.0.1:1080/WebTours/images/signoff.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?page=menu&in=home",
"Snapshot=t18.inf",
LAST);
web_url("flights.gif",
"URL=http://127.0.0.1:1080/WebTours/images/flights.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?page=menu&in=home",
"Snapshot=t19.inf",
LAST);
web_concurrent_end(NULL);
web_url("SignOff Button",
"URL=http://127.0.0.1:1080/cgi-bin/welcome.pl?signOff=1",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?page=menu&in=home",
"Snapshot=t20.inf",
"Mode=HTTP",
LAST);
web_concurrent_start(NULL);
web_url("home.html_2",
"URL=http://127.0.0.1:1080/WebTours/home.html",
"Resource=0",
"Referer=http://127.0.0.1:1080/cgi-bin/welcome.pl?signOff=1",
"Snapshot=t21.inf",
"Mode=HTTP",
LAST);
web_url("nav.pl_3",
"URL=http://127.0.0.1:1080/cgi-bin/nav.pl?in=home",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/cgi-bin/welcome.pl?signOff=1",
"Snapshot=t22.inf",
"Mode=HTTP",
LAST);
web_concurrent_end(NULL);
return 0;
}
"URL-based script" 说明
脚本中的表示采用基于URL的方式,所有的HTTP的请求都会被录制下来,单独生成函数,
所以URL模式生成的脚本会显得有些杂乱。URL录制的脚本中web_ concurrent start函数是并发组
开始的标记, web concurrent end是并发组的结束标记。在并发组中的函数不是立即执行的。在并发
组开始时,所有的函数首先被记录下来,当并发组结束时,所有的函数并发执行。
选择HTML还是URL录制,有以下参考原则:
( 1 )基于浏览器的应用程序推荐使用HTML-based script。
( 2 )不是基于浏览器的应用程序推荐使用URL based script.
( 3 )如果基于浏览器的应用程序中包含了JavaScript 并且该脚本向服务器产生了请求,
使用URL-based script方式录制。
( 4 )基于浏览器的应用程序中使用了HTTPS安全协议,使用URL-based script方式录
制。