LR使用Word下载.docx

上传人:b****5 文档编号:19001876 上传时间:2023-01-02 格式:DOCX 页数:25 大小:33.74KB
下载 相关 举报
LR使用Word下载.docx_第1页
第1页 / 共25页
LR使用Word下载.docx_第2页
第2页 / 共25页
LR使用Word下载.docx_第3页
第3页 / 共25页
LR使用Word下载.docx_第4页
第4页 / 共25页
LR使用Word下载.docx_第5页
第5页 / 共25页
点击查看更多>>
下载资源
资源描述

LR使用Word下载.docx

《LR使用Word下载.docx》由会员分享,可在线阅读,更多相关《LR使用Word下载.docx(25页珍藏版)》请在冰豆网上搜索。

LR使用Word下载.docx

web_custom_request:

允许你以任何HTTP所支持的方法来创建一个customHTTP请求。

web_image:

模拟鼠标在图像上的点击动作。

该图象在attributes中进行了定义。

web_link:

模拟鼠标在链接上的点击动作。

该链接在attributes中进行了定义。

web_submit_data:

完成一个“unconditional(无条件的)”或“上下文无关”的表单的提交。

web_submit_form:

模拟表单提交动作。

web_url:

装载一个指定的URL。

1.1.1.web_custom_request

允许你创建一个HTTP请求,该请求可以使用任何一种HTTP所支持的请求方法。

返回值:

成功,LR_PASS(0);

失败,返回LR_FAIL

(1)。

参数化:

下列参数可以通过标准的参数化方法进行参数化:

ListofAttributes、ListofResourceAttributes。

C语法:

intweb_custom_request(constchar*RequestName,<

ListofAttributes>

[EXTRARES,<

ListofResourceAttributes>

]LAST 

);

 

示例:

在下面的录制脚本中,用户开始从http:

//lazarus/html/forms/file.html录制脚本,当用户提交他的请求时,VuGen插入了一个web_add_header函数,后面紧跟着一个web_custom_request函数。

web_url("

file.html"

"

URL=http:

//lazarus/html/forms/file.html"

 

"

TargetFrame=_TOP"

LAST);

web_add_header("

Content-Type"

multipart/form-data;

boundary=---------------------------292742461228954"

web_custom_request("

post_query.exe"

Method=POST"

//lazarus/cgi-bin/post_query.exe"

Body=-----------------------------292742461228954\r\nContent-Disp"

osition:

form-data;

name=\"

entry\"

\r\n\r\nText\r\n----------"

-------------------292742461228954\r\nContent-Disposition:

f"

-----------292742461228954--\r\n"

TargetFrame="

LAST);

语法说明:

RequestName

步骤名称。

ListofAttributes

请见下面部分:

Attributes。

注:

Attribute名称区分大小写。

EXTRARES

一个分界符,表示它后面所列的参数是resourceattributes。

ListofResourceAttributes

ListofResourceAttributes。

LAST

attribute列表的结束标记。

web_custom_request函数是一个action函数,它允许你使用任何method或body来创建一个customHTTP请求。

默认情况下,只在当请求不可以被其它web函数中断的情况下,VuGen才创建web_custom_request函数。

使用AddStep对话框,可以向脚本中手工插入web_custom_request请求。

如果要在web_custom_request请求前特别指定并发送一个HTTP头,可在此语句前添加web_add_header或web_add_auto_header函数。

Theweb_custom_requestfunctionisanactionfunctionthatallowsyoutocreateacustomHTTPrequestusinganymethodorbody.Bydefault,VuGengeneratesthisfunctiononlyforrequeststhatcouldnotbeinterpretedwithotherwebfunctions.

Toinsertthisfunctionmanually,usetheAddStepdialogbox.TospecifyanHTTPheadertobesentbeforethecustomrequest,addaweb_add_headerorweb_add_auto_headerfunction.

RecContentTypespecifiesthe"

RESPONSEheadervalueasrecorded.TheRecContentTypevalueisusedwhenResourceisnotspecifiedfordeterminingwhetherthetargetURLisaresourceornot.

EncTypespecifiesaContent-Type,suchas"

text/html"

tobespecifiedasthevalueofthe"

REQUESTheaderforthecurrentreplay.web_custom_requestperformsnobodyencoding.TheBodyargumentspecifiesthebodytobeusedasis(orafterapplying"

Binary"

processing),withanyencodinghavingalreadybeenapplied.Therefore,specifyinganEncTypethatdoesnotmatchthebodymaycauseaserver-sideerror.Ingeneral,itisrecommendedthatyoudonotedittheEncTypeasrecorded.

AnyEncTypespecificationsilentlyoverridesanyweb_add_[auto_]headerforContent-Type.When"

EncType="

(emptyvalue)isspecified,no"

requestheaderisgenerated.When"

EncType"

isomitted,thenanyapplicableweb_add_[auto_]headerisused.Ifthereisnoheaderand"

then"

application/x-www-form-urlencoded"

isusedasadefault.Otherwise,noContent-Typerequestheaderisgenerated.

TheExtraResourceAttributesareonlyinsertedwhenperformingHTML-basedrecordingandthenon-HTMLgeneratedelementsoptionissettoRecordwithinthecurrentscriptstep.Thisisthedefaultsetting.Formoreinformation,refertotheCreatingVuserScriptsguide.

ThisfunctionissupportedforallWebscripts,andforWAPscriptsrunninginHTTPorWirelessSessionProtocol(WSP)replaymode.

Attributes

URL-被装载的网页的URL。

Method-表单提交的方法:

POST或GET。

TargetFrame-包含当前链接或资源的frame的名称。

点击此处获取更多的信息。

Enctype-使用的编码方法。

RecContentType-在录制过程中,RESPONSE头的Content-Type,如text/html,application/x-javascript。

读取RESPONSE头中的Content-Type,是为了判定目标RUL是不是一个可录制的资源。

Referer-当前指向的网页。

(Thepagethatreferredtothecurrentpage.Ifthelocationwasexplicitlyexpressed,thisattributeisomitted.)

Body-请求的body。

参考BodyAttribute部分获取更多的信息。

RawBody-请求的body内容是一个数据指针,它被传送到服务器。

参考RawBodyAttribute部分。

BodyfilePath-一个文件的路径被当成请求的body传送到服务器。

BodyFilePath不能与Body、任何BodyAttribute、RawBodyAttribute同时使用。

(如不能与BodyBinary、BodyUnicode、RAW_BODY_START、Binary=1同时使用。

Resource-该值证明URL是不是一个资源:

“Resouce=1”表明URL是一个资源。

whichimpliesthatitisnotcriticalforthesuccessofthescript.Anyfailuresindownloadingtheresourcewillbeconsideredaswarningsratherthanerrors。

无论是否下载该资源,只受Run-Time设置“Downloadnot-THTMresourceds”的影响。

TheresponseisnotparsedasHTML。

“Resource=0”表示theURLiscritical,notaffectedbytheRTS,andwillbeparsedifrequired。

ResourceByteLimit-见ResourceByteLimit部分。

Snapshot-快照文件的名称(扩展名为inf),用于关联。

Mode-录制水平:

HTML或HTTP。

点击此处获取列多信息。

ExtraResBaseDir-在EXTRARES组中,各相对URL的基准URL。

URL可以是绝对的(如URL。

UserAgent-HTTP头中的User-Agent用以指定程序的名称,通常指的是浏览器名称。

例如:

HTTP头“User-Agent:

Mozilla/4.0(compatible;

MSIE6.0;

WindowsNT5.0)”指明浏览器是微软的IE6.0,如果是其它User-Agent值,则表明是其它浏览器,或非浏览器程序。

通常,发自于同一程序的请求,它们的User-Agent值是相同的,User-Agent值是在Run-Time设置中指定的。

但是,即使在常规的浏览器中,也可能遇到非浏览器组件(如Active-X),该组件直接与服务器交互,它的User-Agent值与浏览器不同。

SpecifyingaUserAgentindicatesthatthisissuchanon-browserrequest.Thespecifiedstringisusedinthe"

User-Agent:

HTTPheader,andaffectstheReplay'

sbehaviorinsomepoints,forexample,bynotusingthebrowsercache,assumingthespecifiedURLsareresources,etc。

Nocheckismadetoverifythatthespecifiedvalueisdifferentthanthatofthebrowser。

Binary-

Binary=1"

specifiesthateachsequenceintheBodyoftheform\\x##,where"

##"

aretwo"

hexadecimaldigits"

(0-9,a-forA-F),bereplacedbyasinglebytecontainingthespecifiedhexadecimalvalue.

If"

Binary=0"

(thedefault),suchsequencesarepassedliterally.

Notethattwobackslashesareused.TheyareinterpretedasonebackslashbytotheCinterpreter.WhenazerobyteisNOTrequired,onebackslashcanbeusedwithout"

(e.g.,\x20insteadof\\x20).WhenazerobyteISrequired,specifying\x00wouldcausethestringtobelogicallytruncated(nullterminator),and\\x00needstobespecifiedusing"

.

ContentEncoding-要求按指定的方法(如gzip或deflate)对请求body进行编码(如compressed),相应的HTTP头“Content-Encoding:

”会随该请求一起发出。

此项应用于web_custom_request与web_submit_data函数中。

UsingBinaryCode

YoucanusethefollowingformattoincludebinarycodeintheBodyparameterofaweb_custom_requestfunction:

\x[char1][char2]

Thisrepresentsthehexadecimalvaluethatisrepresentedby[char1][char2].

Forexample:

\x24is16*2+4=36,whichisa$sign;

\x2Bis+sign.

Sequencesthatdonotrepresentvalid2-characterhexadecimalsequencesaretreatedbyVuGenasASCIItext.Donotuse1-characterhexadecimalsequences.Forexample,"

\x2"

isnotavalid2-characterhexadecimalsequence.Use"

\x02"

instead.

Notethatbinaryvaluesappearinascriptas\\x,i.e.the"

x"

isprecededbytwobackslashes.ThisisduetoClanguageescapinglaws.However,whengeneratingaweb_custom_requestfunctionbyusingVuGen,youneedtotypeonlyonebackslash.

Ifyouuseparameterizationwithinaweb_custom_requestfunction,includeonlyonebackslashwithinthedefinitionoftheparameter.ThisisbecauseparametersubstitutiondoesnotperformanyCescapingconversion.

TheHTTPheadercanbemodifiedtopassadditionalinformationabouttherequesttotheserver.UsingHTTPheadersyoucan,forexample,allowothercontenttypesintheresponsesuchascompressedfiles,oryoucanrequestaWebpageonlyoncertainconditions.TomodifytheHTTPheaderintherequest,seeweb_add_header.Tomodifyallsubsequentrequests,seeweb_add_auto_header.

1.1.2.web_link

ListofAttributes

intweb_link(constchar*StepName,<

[EXTRARES,<

]Last);

test.html"

//localhost/test.html"

Resource=0"

RecContentType=text/html"

Referer="

Mode=HTML"

web_link("

Test1"

Text=Test1"

StepName

在树模式中,树中所显示的链接的名称。

它是自动事务的事务名。

支持以下Attribute:

Text,Frame,TargetFrame,ResourceByteLimit,Ordinal。

被录制的属性有:

Text,Ordinal。

web_linkfunction是一个actionfunction,它模拟鼠标在链接上的点击操作。

web_link能否被正确执行,依赖于前面的操作是否提供了执行条件。

只有当VuGen处于HTML-based录制模式时,web_link才能被录制到。

非HTML-generatedresources有gif以及jpg图像等。

只有当在recordingoptins>

recording>

HTML-basedscript>

HTMLadvanced中为这些resources选中了“Recordwithinthecurrentscriptsteps”选项时,VuGen才会向web_link语句中插入ListofResourceAttributes。

该选项设置是默认设置。

TheHTTPheadercanbemodifiedtopassadditionalinformationabouttherequesttotheserver.UsingHTTPheadersyou

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 职业教育 > 其它

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1