NicolaFilosa_SE
2 years agoContributor
Using array values in xpath
Hi to everyone. I want to do a for cycle with elements defined by an xpath. The values that the for cycle uses are defined in an array. How can I insert the elements of the array in the xpath?
pageParameterDevice.FindElement("//tr[@id='rowPar2']/td[contains(@class, 'valdev')]").contentText
The value that has to change is 'rowPar2' (from rowPar1 to rowPar737)
Thanks in advance
It can be done but as nmrao said it is usually recommended to keep the test cases separated from each other. Nevertheless here is the code:
// Get the test step for which you want the response def testStep = testRunner.testCase.testSuite.testCases[ "Name of your test case" ].testSteps[ "Name of your test step" ] // Get the response def response = testStep.testRequest.response.responseContent // Log the response log.info response
I created a demo project which can be downloaded from https://github.com/lucadln/soapui/tree/master/ReadyAPI/ResponseFromDifferentTestCase
Cheers! :manwink: