我有问题。我需要将此值=“0,20”改为value =“1,20”in
<configuration>
<deviceConfiguration>
<devices>
<add logicalName="MainScale" type="XXX.XXX.XXX.XXX.XXX, XXX.XXX.XXX">
<parameters>
<add key="CustomWeight" value="0,20"/>
</parameters>
</add>
</devices>
</deviceConfiguration>
</configuration>
我怎样才能获得这个价值?非常感谢你的帮助!
您可以在Working With XML Files From Scripts帮助主题中的TestComplete脚本中找到有关如何使用XML文件的信息。以下是适用于您的案例的特定示例代码:
function test()
{
var doc = getActiveXObject("Msxml2.DOMDocument.6.0");
doc.async = false;
doc.load("d:\\test.xml");
var node = doc.selectSingleNode("//devices/add/parameters/add[@key='CustomWeight']");
Log.Message("Old value: " + node.getAttribute("value"));
node.setAttribute("value", "1,20");
Log.Message("New value: " + node.getAttribute("value"));
doc.save("d:\\test_updated.xml");
}