loadrunner11录制简单脚本1

loadrunner设置自带浏览器回放脚本


1

选择选项

2

录制登录百度搜索“电影”脚本

新建一个html脚本


3

录制成功后的脚本,删除多余脚本

Action() {

web_add_cookie("BAIDUID=25DD7C5B89500AE324134CEF568820C3:FG=1; DOMAIN=www.baidu.com"); web_add_cookie("BIDUPSID=25DD7C5B89500AE324134CEF568820C3; DOMAIN=www.baidu.com"); web_add_cookie("PSTM=1520233011; DOMAIN=www.baidu.com"); web_add_cookie("BD_UPN=13314352; DOMAIN=www.baidu.com"); web_add_cookie("BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; DOMAIN=www.baidu.com"); web_add_cookie("B64_BOT=1; DOMAIN=www.baidu.com");

web_url("www.baidu.com",

    "URL=https://www.baidu.com/",

    "TargetFrame=", "Resource=0",

    "RecContentType=text/html", "Referer=",

    "Snapshot=t1.inf", "Mode=HTML",

    LAST);

lr_think_time(10);

web_submit_data("s",

"Action=https://www.baidu.com/s",

"Method=GET",

"EncType=", "TargetFrame=",

"RecContentType=text/html",

"Referer=https://www.baidu.com/",

"Snapshot=t2.inf",

"Mode=HTML",

ITEMDATA,

"Name=ie","Value=utf-8",ENDITEM,

"Name=f", "Value=8", ENDITEM,

"Name=rsv_bp", "Value=1", ENDITEM,

"Name=rsv_idx", "Value=1", ENDITEM,

"Name=ch", "Value=", ENDITEM,

"Name=tn", "Value=baidu", ENDITEM,

"Name=bar", "Value=", ENDITEM,

"Name=wd", "Value=电影", ENDITEM,

"Name=rn", "Value=", ENDITEM,

"Name=oq", "Value=", ENDITEM,

"Name=rsv_pq", "Value=e454236900029dfd",ENDITEM,

"Name=rsv_t", "Value=511917QCJsqhwxwLMNauC98ql3uSoh+WYmUCAJn8bXa8JidEdYJ9Cs+IwtU", ENDITEM,

"Name=rqlang", "Value=cn", ENDITEM,

EXTRARES,

"Url=/aladdin/tpl/right_toplist/toplist_dot.png", "Referer=https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&ch=&tn=baidu&bar=&wd=%E7%94%B5%E5%BD%B1&rn=&oq=&rsv_pq=e454236900029dfd&rsv_t=511917QCJsqhwxwLMNauC98ql3uSoh%2BWYmUCAJn8bXa8JidEdYJ9Cs%2BIwtU&rqlang=cn", ENDITEM,

LAST);

return 0; }

运行脚本后,发现报错

Starting iteration 1.

Starting action Action.

Action.c(4): Error -27778: SSL protocol error when attempting to connect with host "www.baidu.com"  [MsgId: MERR-27778]

Action.c(4): Warning -26000: Empty or no response for URL="https://www.baidu.com/"  [MsgId: MWAR-26000]

Action.c(4): web_url("www.baidu.com") highest severity level was "ERROR", 0 body bytes, 0 header bytes  [MsgId: MMSG-26388]

Ending action Action.

Ending iteration 1.

修改属性


4

勾选Preference中的选项


5

完成脚本,并成功运行

你可能感兴趣的:(loadrunner11录制简单脚本1)