单行注释
//
多行注释
/**/
手写脚本原因
1. 避免LR由于兼容性导致录制异常或失败;
2. 手写脚本无冗余代码,更有利于脚本的增强(插入事务、参数化)和维护
- Action()
- {
- // 打开的登录页面
- web_url("WebTours",
- "URL=http://127.0.0.1:1080/WebTours/",
- "TargetFrame=",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=",
- "Snapshot=t1.inf",
- "Mode=HTML",
- LAST);
-
-
- // 注册按钮进行注册
- web_url("点击注册按钮",
- "URL=http://127.0.0.1:1080/WebTours/login.pl?username=&password=&getInfo=true",
- "TargetFrame=",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=http://127.0.0.1:1080/WebTours/home.html",
- "Snapshot=t2.inf",
- "Mode=HTML",
- LAST);
-
-
- // 提交注册用户信息
- web_submit_data("login.pl",
- "Action=http://127.0.0.1:1080/WebTours/login.pl",
- "Method=POST",
- "TargetFrame=info",
- "RecContentType=text/html",
- "Referer=http://127.0.0.1:1080/WebTours/login.pl?username=&password=&getInfo=true",
- "Snapshot=t3.inf",
- "Mode=HTML",
- ITEMDATA,
- "Name=username", "Value={user_name}", ENDITEM,
- "Name=password", "Value={password}", ENDITEM,
- "Name=passwordConfirm", "Value={password}", ENDITEM,
- "Name=firstName", "Value=w", ENDITEM,
- "Name=lastName", "Value=e", ENDITEM,
- "Name=address1", "Value=", ENDITEM,
- "Name=address2", "Value=", ENDITEM,
- "Name=register.x", "Value=30", ENDITEM,
- "Name=register.y", "Value=15", ENDITEM,
- LAST);
-
- return 0;
- }
为什么学习参数化
1. 减少重复代码
2. 数据代码进行分离,方便维护
- #函数总结
-
- 设置参数 lr_save_string
- 读取参数 lr_eval_string
- 时间戳函数 web_save_timestamp_param()