WebUI.getAttribute is always returning null

I am trying to get the xpath value of an object using :

String xpath = WebUI.getAttribute(findTestObject(‘NETVEEDDI/Reports/Historical Reports/Common Filters/Metrics/radiobutton_metric’,
[(‘index’) : index]),‘xpath’).toString()

The test object attribute is :

xpath : //p[@id=‘alert-dialog-description’]/div[2]/div[${index}]/div/label/span[1]/span[1]/input

When running the test case I am getting :
Attribute ‘xpath’ of object ‘Object Repository/NETVEEDDI/Reports/Historical Reports/Common Filters/Metrics/radiobutton_metric’ is: ‘null’

could you pls help me with it

Xpath is not an attribute, that’s why you get null.

Thanks Marek.

How can I get the xpath value of an object ?

What you want is a property of your test object:

TestObject testObject = findTestObject(‘NETVEEDDI/Reports/Historical Reports/Common Filters/Metrics/radiobutton_metric’,
[(‘index’) : index])
String xpath = testObject.findPropertyValue("xpath")

(Edit: I was looking at an old API in my original post. The above should work.)

@Brandon_Hein

Yes I tried testObject.findPropertyValue(“xpath”) and it worked.

Thanks again :slight_smile:

Good to hear, please consider marking a solution for others reading this topic to quickly find an answer :slight_smile: