大柱子 发表于 2014-5-29 15:32:37

求助,新手入门,想插入一段C语言代码但是不知道插到哪里

如题,求助,新手入门,想插入一段C语言代码但是不知道插到哪里
Action:
Action()
{

        web_reg_find("Text=Web Tours",
                LAST);
        web_reg_find("Text=Web Tours",
                LAST);
   
        lr_start_transaction("logon");

        web_url("WebTours",
                "URL=http://127.0.0.1:1080/WebTours/",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                LAST);

        lr_think_time(11);

   
        lr_rendezvous("tologon");

        web_submit_form("login.pl",
                "Snapshot=t2.inf",
                ITEMDATA,
                "Name=username", "Value=jojo", ENDITEM,
                "Name=password", "Value=bean", ENDITEM,
                "Name=login.x", "Value=27", ENDITEM,
                "Name=login.y", "Value=15", ENDITEM,
                LAST);

        lr_end_transaction("logon", LR_AUTO);

        lr_think_time(4);
   
        lr_start_transaction("fight");


        lr_start_transaction("find_confirm_flight");

        web_image("Search Flights Button",
                "Alt=Search Flights Button",
                "Snapshot=t3.inf",
                LAST);

        web_url("FormDateUpdate.class",
                "URL=http://127.0.0.1:1080/WebTours/FormDateUpdate.class",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Mode=HTML",
                LAST);

        web_url("CalSelect.class",
                "URL=http://127.0.0.1:1080/WebTours/CalSelect.class",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Mode=HTML",
                LAST);

        web_url("Calendar.class",
                "URL=http://127.0.0.1:1080/WebTours/Calendar.class",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Mode=HTML",
                LAST);

        lr_think_time(72);

        web_submit_data("reservations.pl",
                "Action=http://127.0.0.1:1080/WebTours/reservations.pl",
                "Method=POST",
                "RecContentType=text/html",
                "Referer=http://127.0.0.1:1080/WebTours/reservations.pl?page=welcome",
                "Snapshot=t4.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=advanceDiscount", "Value=0", ENDITEM,
                "Name=depart", "Value=Denver", ENDITEM,
                "Name=departDate", "Value=05/14/2014", ENDITEM,
                "Name=arrive", "Value=Los Angeles", ENDITEM,
                "Name=returnDate", "Value=05/15/2014", ENDITEM,
                "Name=numPassengers", "Value=1", ENDITEM,
                "Name=seatPref", "Value={seat}", ENDITEM,
                "Name=seatType", "Value=Coach", ENDITEM,
                "Name=.cgifields", "Value=roundtrip", ENDITEM,
                "Name=.cgifields", "Value=seatType", ENDITEM,
                "Name=.cgifields", "Value=seatPref", ENDITEM,
                "Name=findFlights.x", "Value=32", ENDITEM,
                "Name=findFlights.y", "Value=7", ENDITEM,
                LAST);

        lr_think_time(11);

        web_submit_form("reservations.pl_2",
                "Snapshot=t5.inf",
                ITEMDATA,
                "Name=outboundFlight", "Value=030;251;05/14/2014", ENDITEM,
                "Name=reserveFlights.x", "Value=53", ENDITEM,
                "Name=reserveFlights.y", "Value=9", ENDITEM,
                LAST);

        lr_think_time(17);

        web_submit_form("reservations.pl_3",
                "Snapshot=t6.inf",
                ITEMDATA,
                "Name=firstName", "Value=Joseph", ENDITEM,
                "Name=lastName", "Value=Marshall", ENDITEM,
                "Name=address1", "Value=234 Willow Drive", ENDITEM,
                "Name=address2", "Value=San Jose/CA/94085", ENDITEM,
                "Name=pass1", "Value=Joseph Marshall", ENDITEM,
                "Name=creditCard", "Value=12345678", ENDITEM,
                "Name=expDate", "Value=06/10", ENDITEM,
                "Name=saveCC", "Value=<OFF>", ENDITEM,
                "Name=buyFlights.x", "Value=72", ENDITEM,
                "Name=buyFlights.y", "Value=15", ENDITEM,
                LAST);

        lr_end_transaction("fight", LR_AUTO);



        lr_think_time(7);

        web_url("welcome.pl",
                "URL=http://127.0.0.1:1080/WebTours/welcome.pl?page=itinerary",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=flights",
                "Snapshot=t7.inf",
                "Mode=HTML",
                LAST);




        lr_end_transaction("find_confirm_flight", LR_AUTO);

        lr_think_time(6);

        web_image("SignOff Button",
                "Alt=SignOff Button",
                "Snapshot=t8.inf",
                LAST);
        lr_output_message("the flight was booked");

return 0;
}

网上找的常用代码:
//(随机城市)
count=atoi(lr_eval_string("{city_count}"));     srand(time(NULL)); 
    depart_num=rand()%count+1;     if(depart_num= =18) 
       arrive_num=depart_num-1;     else 
       arrive_num=depart_num+1;  
    lr_output_message("起始城市下标为 %d,目的城市下标  
%d",depart_num,arrive_num); //输出语句 
 
    sprintf(rand_depart_city,"{city_%d}",depart_num);     sprintf(rand_arrive_city,"{city_%d}",arrive_num);     sprintf(depart,"Value=%s",rand_depart_city);     sprintf(arrive,"Value=%s",rand_arrive_city);
页: [1]
查看完整版本: 求助,新手入门,想插入一段C语言代码但是不知道插到哪里