GetText from dynamic xpath

How to get Text and print by xpath

xpath is = //*[@id=‘tblDefaultAgents’]/tbody/tr[td[normalize-space()=’${Name}’]]/td[2]

kindly help

Have a look at the following post

This post includes a description how to interpolate a placeholder ${ptn} in a XPath of a TestObject with value supplied to findTestObject(path, params) call.

Name = [John , Mark , Stephen]
xpath is //*[@id=‘tblList’]/tbody/tr[td[normalize-space()=‘${Name}’]]

This Name changes
how can I implement this xpath to
Test object


to verify this element present and also to get text of this particular row

without custom keyword

can you pls help me

In you test script, you should have a line like

for (name in ["John", "Mark", "Stephen"]) {
    ....
    WebUI.verifyElementPresent(
        findTestObject("test object name", ["Name": name]),
        10)
    ...
}

1 Like