Search code examples
hp-uft

Is there a generic way to access objects in UFT


My task is to check the value of data from the global data sheet within different UIs, each of them having lots of data.

My idea was to do this in a generic way. I create a array with the objects name, which corresponds with the name of the data sheet column And then I just compare the content

Browser("").Page("").GENERIC_TYPE(label).GetROProperty("value") = datasheet.GetParameter(label)

Is there such a Generic Type that works for WebEdit and WebList?


Solution

  • You can use WebElement and this is generic as all elements on the page are web elements.

    If you are reading the objects from OR, then you might have to update the element type to WebElement and it's tidious (if you are dealing with multiple objects). So the alternative way is using the below approach.

    Browser("").Page("").WebElement("xpath:=//*[@common_attribute=" + element_attribute_value + "]").GetROProperty("value") = datasheet.GetParameter(label)