友善交流技术...

WEB页面的二级链接遍历

上一篇 / 下一篇  2008-02-03 14:30:19 / 个人分类:性能测试

//这个是二层所有的链接,遍历的代码...
Action()
{


   int i;
   int rc=0;
   int k=0;
   //  int sum=0;
   int sum1;
   int rc_new=0;
   int HttpRetCode=0;
   char temp[100];
   char child_temp[100];
   char New_url[100];
   char New_url2[100];

 

    lr_start_transaction("Big_datuu");
        web_reg_save_param("Datuu","LB=href=\"","RB=\"","ord=all");

  
         lr_start_sub_transaction("Child_datuu_1","Big_datuu");
         web_url("datuu","url=http://59.151.23.58/wapnew/info.do",LAST);
          lr_end_sub_transaction("Child_datuu_1",LR_AUTO);
   lr_end_transaction("Big_datuu",LR_AUTO);

   for(i=1;i<=atoi(lr_eval_string("{Datuu_count}"));i++)
      {
         sprintf(temp,"{Datuu_%d}",i);
         lr_save_string(lr_eval_string(temp),"stemp");
     
        
        rc=strstr(lr_eval_string("{stemp}"),"http");
          strcpy(New_url2,"");
 
           if(rc!=0)
            {
              
                web_reg_save_param("NewDa","LB=href=\"","RB=\"","ord=all");
                web_url("Datuu_child","url={stemp}",LAST);
                            

                   HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);    //url 状态的判定。
           
                               if(HttpRetCode==200)
                                      lr_message("ok this is the right url");
                               else
                                      lr_error_message("sorry");  
              
              // lr_error_message("%s",lr_eval_string("{stemp}"));
                for(k=1;k<=atoi(lr_eval_string("{NewDa_count}"));k++) 
                    {
                         sprintf(child_temp,"{Datuu_%d}",k);
                         lr_save_string(lr_eval_string(child_temp),"Nstemp");
                         rc_new=strstr(lr_eval_string("{Nstemp}"),"http");
                          strcpy(New_url,"");
                               sum1=sum1+1;

                            if(rc_new!=0)
                                {
                                  web_url("Datuu_child","url={Nstemp}",LAST);
                               //   lr_error_message("%s",lr_eval_string("{Nstemp}"))
                                   sum1=sum1+1;
                                 }
                            else
                                {
                                  strcat(New_url,"http:\/\/59.151.23.58");
                                  strcat(New_url,lr_eval_string("{Nstemp}"));

                            //     lr_error_message("%s",New_url);
                                 lr_save_string(New_url,"New_temp");
                                 web_url("New_url","url={New_temp}",LAST);
                                   sum1=sum1+1;
                               
                                 
                                 }
                      }
                           
                
             }
            
            else
             {
            //  lr_error_message("url is wrong");
          //     lr_error_message("%s",lr_eval_string("{stemp}"));
                 strcat(New_url2,"http:\/\/59.151.23.58");
                 strcat(New_url2,lr_eval_string("{stemp}"));

                lr_save_string(New_url2,"New_temp2");
                 web_url("New_url","url={New_temp2}",LAST);
                    sum1=sum1+1;
               
              }          

             }
   
     lr_error_message("%d",sum1);

 return 0;
 }
//但是我想说明下,我用的WAP与WEB混合协议做的..


TAG: LR测试

 

评分:0

我来说两句

Open Toolbar