Xpath with variables.

//div[@row-index =‘2’]/div[@col-id = ‘ackDelState’]/app-alarm-state-renderer/div/span/*[name()=‘svg’ and contains(@role,‘img’)] ----This WORKS. [Element Found]

Below Code doesnt work

//div[@row-index =‘${param}’]/div[@col-id = ‘ackDelState’]/app-alarm-state-renderer/div/span/*[name()=‘svg’ and contains(@role,‘img’)]

WebUI.verifyXXX(findTestObject(‘Object Repository/IMR’,[(‘param’):param]), FailureHandling.CONTINUE_ON_FAILURE) ----Returns ELEMENT NOT FOUND

Am i doing anything wrong here?

where you define xpath? in basic or in xpath section?

as far as i know, variables are not working for objects defined with xpath selection.
use basic instead


1 Like

I have used Basic.


i think ${param} cannot be recognized don’t use ‘${param}’ use “${param}”

*** edit ***
i’m starting to think i’m wrong on this


can you please provide error message you received

Hi All,

It started to work when I changed to this.

WebUI.verifyXXX(findTestObject(‘Object Repository/IMR’,[‘param’:param]), FailureHandling.CONTINUE_ON_FAILURE)

Note:-Removed the parenthesis around ‘param’ .Not sure what is the reason.

1 Like

I have done something similar and defined the object as:


and then called it with:

WebUI.getText(findTestObject('table-DataTable', [('index') : 0, ('row') : loop, ('column') : 3]))
1 Like