51Testing软件测试论坛

标题: 如何直接往listbox中加数据 [打印本页]

作者: qsj_shao    时间: 2006-11-6 14:54
标题: 如何直接往listbox中加数据
有一个.net写的web网页,上面有一个textbox1,一个button1,一个button2,一个listbox3,在textbox中输入数据后,点击button1即将数据放到listbox,然后点击button2,将listbox中的数据以及另外一个textbox的数据提交(现在不关心这个textbox的数据),使用lr录制这个操作得到以下代码:
//将数据插入listbox
web_submit_data("sendmain.aspx",
  "Action=http://192.168.0.200/esmp/sendmain.aspx",
  "Method=POST",
  "RecContentType=text/html",
  "Referer=http://192.168.0.200/esmp/sendmain.aspx",
  "Snapshot=t10.inf",
  "Mode=HTML",
  ITEMDATA,
  "Name=__EVENTTARGET", "Value=Sendmain1:LinkButton1", ENDITEM,
  "Name=__EVENTARGUMENT", "Value=", ENDITEM,
  "Name=Sendmain1:TextBox1", "Value=123", ENDITEM,
  "Name=Sendmain1:TextBox2", "Value=", ENDITEM,
  "Name=Sendmain1:DropDownList1", "Value=2006", ENDITEM,
  "Name=Sendmain1:DropDownList2", "Value=11", ENDITEM,
  "Name=Sendmain1:DropDownList3", "Value=6", ENDITEM,
  "Name=Sendmain1:DropDownList4", "Value=13", ENDITEM,
  "Name=Sendmain1:DropDownList5", "Value=51", ENDITEM,
  EXTRARES,
  "Url=images/left_bg.gif", ENDITEM,
  "Url=images/index_bg4.gif", ENDITEM,
  "Url=images/index_bg3.gif", ENDITEM,
  LAST);
//提交listbox数据
web_submit_data("sendmain.aspx_2",
  "Action=http://192.168.0.200/esmp/sendmain.aspx",
  "Method=POST",
  "RecContentType=text/html",
  "Referer=http://192.168.0.200/esmp/sendmain.aspx",
  "Snapshot=t4.inf",
  "Mode=HTML",
  ITEMDATA,
  "Name=__EVENTTARGET", "Value=", ENDITEM,
  "Name=__EVENTARGUMENT", "Value=", ENDITEM,
  "Name=Sendmain1:ListBox3", "value=参数化需要的值", ENDITEM,//想插入的语句
  "Name=Sendmain1:TextBox1", "Value=", ENDITEM,
  "Name=Sendmain1:TextBox2", "Value=777", ENDITEM,
  "Name=Sendmain1:DropDownList1", "Value=2006", ENDITEM,
  "Name=Sendmain1:DropDownList2", "Value=11", ENDITEM,
  "Name=Sendmain1:DropDownList3", "Value=6", ENDITEM,
  "Name=Sendmain1:DropDownList4", "Value=11", ENDITEM,
  "Name=Sendmain1:DropDownList5", "Value=13", ENDITEM,
  "Name=Sendmain1:ImageButton5.x", "Value=94", ENDITEM,
  "Name=Sendmain1:ImageButton5.y", "Value=11", ENDITEM,
  EXTRARES,
  "Url=images/index_bg3.gif", ENDITEM,
  "Url=images/index_bg4.gif", ENDITEM,
  "Url=images/left_bg.gif", ENDITEM,
  LAST);
因为想把listbox中的值参数化,所以想把第一个submitdata省略,直接在第二个submit中加上listbox的值,比如"Name=Sendmain1:ListBox3", "value=需要的值", ENDITEM,但运行时这样不行,因为listbox不是这样添加值的
所以想问一下lr中怎么往listbox中加值,谢谢




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