ContributionsMost RecentMost LikesSolutionsRe: How to get substring from a text nmrao I expect to do assertion. def feature = context.expand( '${Check Feature_JDBC#ResponseAsXml#//Results[1]/ResultSet[1]/Row/NAME[text()="UVA "]//following-sibling::ENABLED}' ) assert feature == true But I don't expect the tailing space after keyword 'UVA'. Because the tailing space might disappear every once. I wonder if we could use the similar statement? Otherwise, I have to break my script into several lines. Re: How to get substring from a text nmrao thank you. But do you have any other ideas? Example XML result: <Results> <ResultSet fetchSize="128"> <Row rowNumber="1"> <NAME>UVA </NAME> <SUBSCRIPTIONKEY>1858219</SUBSCRIPTIONKEY> <ACCOUNTKEY>101</ACCOUNTKEY> <ENABLED>true</ENABLED> <STARTDATE>2020-06-29 20:38:00.0</STARTDATE> <ENDDATE>2022-12-31 00:00:00.0</ENDDATE> </Row> <Row rowNumber="2"> <NAME>UV </NAME> <SUBSCRIPTIONKEY>1858220</SUBSCRIPTIONKEY> <SUBSCRIPTIONKEY>103</SUBSCRIPTIONKEY> <ENABLED>false</ENABLED> <STARTDATE>2019-06-29 20:38:00.0</STARTDATE> <ENDDATE>2022-12-31 00:00:00.0</ENDDATE> </Row> </ResultSet> </Results> I expect to assert something like context.expand( '${Check Feature_JDBC#ResponseAsXml#//Results[1]/ResultSet[1]/Row/NAME[text().trim()="UVA"]//following-sibling::ENABLED}' == true Re: How to get substring from a text mattb Thanks for your solution. It really helps. What if the text is dynamic? Text is 'UVA ' for case1, while text is 'UV ' for case2, for example. How to get substring from a text //get feature def feature = context.expand( '${Check Feature_JDBC#ResponseAsXml#//Results[1]/ResultSet[1]/Row/NAME[text()="UVA "]//following-sibling::ENABLED}' ) The space after keyword 'UVA' might disappear sometimes. How could I update the script to avoid the space? Thanks. Something like: context.expand( '${Check Feature_JDBC#ResponseAsXml#//Results[1]/ResultSet[1]/Row/NAME[text().trim()="UVA"]//following-sibling::ENABLED}' )