diff --git a/robot-server-core/src/main/kotlin/com/intellij/remoterobot/services/xpath/XpathDataModelCreator.kt b/robot-server-core/src/main/kotlin/com/intellij/remoterobot/services/xpath/XpathDataModelCreator.kt index f16ca65a..9484a448 100644 --- a/robot-server-core/src/main/kotlin/com/intellij/remoterobot/services/xpath/XpathDataModelCreator.kt +++ b/robot-server-core/src/main/kotlin/com/intellij/remoterobot/services/xpath/XpathDataModelCreator.kt @@ -108,7 +108,7 @@ class XpathDataModelCreator(private val textToKeyCache: TextToKeyCache) { }?.apply { element.setAttribute(attributeName, this) } - value?.apply { + value?.removeInvalidXmlCharacters()?.apply { if (textFieldsFilter(attributeName, value)) { elementText.append("$attributeName: '$this'. ") textToKeyCache.findKey(value)?.apply { @@ -308,3 +308,7 @@ fun Element.addIcon(iconName: String, size: Int, onClickFunction: String) { ) appendChild(icon) } + +private fun String.removeInvalidXmlCharacters(): String { + return replace(Regex("[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]"), "") +} \ No newline at end of file