fixed error caused by editing twice

This commit is contained in:
Alex Kogon
2015-09-10 16:09:16 +02:00
parent 17a964fc19
commit acc70c67c6

View File

@@ -146,13 +146,14 @@ public class XpathManager implements Runnable{
if (!parentClassStr.isEmpty()) if (!parentClassStr.isEmpty())
{ {
if (!txtStr.isEmpty()&&useFullTextMatching) { if (!txtStr.isEmpty()&&useFullTextMatching) {
if (txtStr.length() > maxTextLength) {// if the text is too long only test the first maxTextLength characters String copyOfTxtStr = txtStr;
txtStr = WindowsEnumeratedXml.escapeXmlAttributeValue(txtStr.substring(0, maxTextLength)); if (copyOfTxtStr.length() > maxTextLength) {// if the text is too long only test the first maxTextLength characters
txtStr = " and starts-with(@text,'" + txtStr + "')"; copyOfTxtStr = WindowsEnumeratedXml.escapeXmlAttributeValue(copyOfTxtStr.substring(0, maxTextLength));
copyOfTxtStr = " and starts-with(@text,'" + copyOfTxtStr + "')";
} }
else else
txtStr = " and @text='" + txtStr + "'"; copyOfTxtStr = " and @text='" + copyOfTxtStr + "'";
builtXpath = "//win[@class='" + parentClassStr + "'" + parentTxtStr + "]/win[@class='" + classStr + "'" + txtStr + "]"; builtXpath = "//win[@class='" + parentClassStr + "'" + parentTxtStr + "]/win[@class='" + classStr + "'" + copyOfTxtStr + "]";
} }
else else
{ {