51Testing软件测试论坛

标题: 为什么关联函数,FOR循环只执行一次,第二次是NULL [打印本页]

作者: allison913    时间: 2013-9-4 15:28
标题: 为什么关联函数,FOR循环只执行一次,第二次是NULL
本帖最后由 allison913 于 2013-9-5 09:00 编辑

Action()
{
int count;
int i;
char param[8];
web_set_max_html_param_len("3333333");
web_reg_save_param_regexp(
  "ParamName=temp",
  "RegExp=<li>.*<em class=\"ntes-.*\">(.*).*</em></span></a></li>",
  "Ordinal=ALL",
  SEARCH_FILTERS,
  LAST);
web_url("网易博客",
  "URL=http://blog.163.com",
  "Resource=0",
  "Referer=",
  LAST);
count=atoi(lr_eval_string("{temp_count}"));
lr_output_message("%d",count);
if(atoi(lr_eval_string("{temp_count}"))==0)
{
  lr_output_message("there is no any id.");
}
else
  {
   for(i=1;i<count;i++)
    {
     sprintf(param,"{temp_%d}",i);
     lr_output_message("输出内容:%s\n",lr_save_string(lr_eval_string(param),"{temp}"));
    }
  }
return 0;
}

-------------------------------------------------------------------------------------------------
Action.c(13): Notify: Saving Parameter "temp_1 = 网易新闻".
Action.c(13): Notify: Saving Parameter "temp_2 = 网易云音乐".
Action.c(13): Notify: Saving Parameter "temp_3 = 网易云阅读".
Action.c(13): Notify: Saving Parameter "temp_4 = 有道云笔记".
Action.c(13): Notify: Saving Parameter "temp_5 = 网易花田".
Action.c(13): Notify: Saving Parameter "temp_6 = 网易公开课".
Action.c(13): Notify: Saving Parameter "temp_7 = 网易彩票".
Action.c(13): Found resource "http://img1.126.net/channel8734/014807/650100_0902_ttw.swf" in HTML "http://g.163.com/r?site=netease&affiliate=blog&cat=homepage&type=column650x100&location=1"   [MsgId: MMSG-26659]
Action.c(13): Found resource "http://img2.126.net/xoimages/hy/20130701/yxin/x/300x100.gif" in HTML "http://g.163.com/r?site=netease&affiliate=blog&cat=homepage&type=logo300x100&location=1"   [MsgId: MMSG-26659]
Action.c(13): Found resource "http://img1.126.net/channel8/014012_960-100_0628.swf" in HTML "http://g.163.com/r?site=netease&affiliate=blog&cat=homepage&type=column960x100&location=1"   [MsgId: MMSG-26659]
Action.c(13): Found resource "http://img2.126.net/xoimages/hy/20130701/yxin/x/960x100.gif" in HTML "http://g.163.com/r?site=netease&affiliate=blog&cat=homepage&type=column960x100&location=2"   [MsgId: MMSG-26659]
Action.c(13): Found resource "http://img2.126.net/xoimages/game/20130901/dh2/300x250.jpg" in HTML "http://g.163.com/r?site=netease&affiliate=blog&cat=homepage&type=logo300x250&location=1"   [MsgId: MMSG-26659]
Action.c(13): Found resource "http://img2.126.net/xoimages/yuehui/20130701/960X100.jpg" in HTML "http://g.163.com/r?site=netease&affiliate=blog&cat=homepage&type=column960x100&location=3"   [MsgId: MMSG-26659]
Action.c(13): Found resource "http://img2.126.net/xoimages/vip/20130901/300x150.jpg" in HTML "http://g.163.com/r?site=netease&affiliate=blog&cat=homepage&type=logo300x150&location=1"   [MsgId: MMSG-26659]
Action.c(13): Found resource "http://img2.126.net/xoimages/istyle/20130901/a/960x130.jpg" in HTML "http://g.163.com/r?site=netease&affiliate=blog&cat=homepage&type=column960x130&location=1"   [MsgId: MMSG-26659]
Action.c(13): Found resource "http://imgsize.ph.126.net/?enlarge=true&imgurl=http://imglf2.ph.126.net/ZSt6tKNzNeUGKyHb18XIaA==/1140255130755045602.jpg_260x226x1x90.jpg" in HTML "http://www.lofter.com/blogHomeEntry.do"   [MsgId: MMSG-26659]
Action.c(13): Found resource "http://imgsize.ph.126.net/?imgurl=http://img2.ph.126.net/7GVEHnPOZuKPszPEH-pymg==/1901081992803968873.jpg_64x64x0.jpg" in HTML "http://www.lofter.com/blogHomeEntry.do"   [MsgId: MMSG-26659]
Action.c(13): Notify: Saving Parameter "temp_count = 7".
Action.c(13): web_url("网易博客") was successful, 1800286 body bytes, 60220 header bytes, 96 chunking overhead bytes   [MsgId: MMSG-26385]
Action.c(18): Notify: Parameter Substitution: parameter "temp_count" =  "7"
Action.c(19): 7
Action.c(20): Notify: Parameter Substitution: parameter "temp_count" =  "7"
Action.c(29): Notify: Parameter Substitution: parameter "temp_1" =  "网易新闻"
Action.c(29): Notify: Saving Parameter "{temp} = 网易新闻".
Action.c(29): 输出内容:(null)
Ending action Action.
Ending iteration 1.




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2