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

image.png

1 Like

I have used Basic.

XPATH.JPG

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

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

2018-07-10_15-08-03.png

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:

//table[@id='DataTable_Name_${index}']/tbody/tr[${row}]/td[${column}]

and then called it with:

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