<?xml version="1.0" encoding="utf-8"?> <serverConfig> <IP>192.168.1.69</IP> <port>8889</port> </serverConfig>
>假设上图为xml的内容,文件名字为test1.xml
我们在利用advanced进行打包的时候,有些参数化的东西可以直接从xml中进行传递
具体实现方法:
1、在Custom Behavior——search中增加xml search,在file path那边选择test1.xml的位置,也就是你想要在那个目录中
2、在Locators中按照test1.xml的节点设置好,当然只需要设置到你感兴趣的节点即可。
3、我需要的IP后面的192等数字,按照图所示,add一个property 等等操作,最关键的是value这个地方的填写。
locator Tyepe--Element has index in parent
很明显,IP value 0,port value 是1;如果port在上,那么value为0
--Attribute Value 模式,如果xml文件内容改为下面情况
<?xml version="1.0" encoding="utf-8"?> <serverConfig> <IP value="8">192.168.1.69</IP> <port value="41">8889</port> </serverConfig>
很明显,IP value 8,port value 是41;如果port在上,那么value依然为41
另外其他2个模式,自行探索,当然Result Type都是Element TXT
3、在Dialogs界面需要设置edit的propertry name 为 Result Property的值