结论
到这里结论其实也就出来了。(结论只针对HTML-Based Mode录制方式)
HTML页面中的资源,如页面里写的<img>(跟是不是在表格中无关...),是不会显示在脚本中的。
而外部链接中的资源,如<link type="text/css>连接的CSS文件中使用的图片,是会通过EXTRARES属性显示在脚本中的。
运行上面这个脚本,Replay Log中会显示:
Action3.c(8): Downloading resource http://search.thunisoft.com/skins/default/images/bg_top.gif (specified by argument number 9) [MsgId: MMSG-26577] Action3.c(8): Downloading resource http://search.thunisoft.com/skins/default/images/nav_bg.gif (specified by argument number 11) [MsgId: MMSG-26577] Action3.c(8): Downloading resource http://search.thunisoft.com/skins/default/images/nav_right.jpg (specified by argument number 13) [MsgId: MMSG-26577] Action3.c(8): Downloading resource http://search.thunisoft.com/skins/default/images/search_m.gif (specified by argument number 15) [MsgId: MMSG-26577] Action3.c(8): Downloading resource http://search.thunisoft.com/skins/default/images/button02.gif (specified by argument number 17) [MsgId: MMSG-26577] Action3.c(8): Downloading resource http://search.thunisoft.com/skins/default/images/nav_r.gif (specified by argument number 19) [MsgId: MMSG-26577] Action3.c(8): Downloading resource http://search.thunisoft.com/skins/default/images/button01.gif (specified by argument number 21) [MsgId: MMSG-26577] Action3.c(8): Downloading resource http://search.thunisoft.com/skins/default/images/nav_l.gif (specified by argument number 23) [MsgId: MMSG-26577] Action3.c(8): Downloading resource http://search.thunisoft.com/skins/default/images/search_l.gif (specified by argument number 25) [MsgId: MMSG-26577] Action3.c(8): Downloading resource http://search.thunisoft.com/skins/default/images/search_r.gif (specified by argument number 27) [MsgId: MMSG-26577] |
细心的人可以发现,这个日志和第一步实验中的不一样呢。再次对比上面写出的两种Replay Log,可以发现一个是"Found resource ... in HTML ...",一个是"Downloading resource ..."(标记蓝色两处)
这样也可以解释了。
HTML文件内部的资源,不需要显示在脚本中就可以下载,因为会在访问这个页面时“发现”。
而外部链接的资源,必须在脚本中显式写出,才会去“下载”。
所以EXTRARES属性下面的资源,只要注释掉相应的脚本,就可以避免该请求。
而HTML页面文件中的资源,则只能通过修改MODE="HTTP"属性,或者改为URL-Based Mode录制方式,才能避免请求。
说到这,基本都清楚了,最后再翻一下官方文档(Function Reference)吧。
web_url EXTRARES: List of Resource Attributes: |
再次验证了我们的结论,EXTRARES中只显示非HTML文件中的资源。