I’m trying to use the getAttribute method to get an attribute of an object however the value coming back is null. The data-tileversion
attribute is a custom attribute for our application and contains a version number. I’m able to work around this by using the value
attribute and using substring to extract the version number from the string as it contains a tile code and the tile version. The data-tileversion attribute only contains the version number and would be more robust than relying on substring in the event the substring index changes. How can I get the value of the data-tileversion
attribute?
Example:
What my question is in reference to:
HTML of Select Option:
getAttribute returns null
actualVersion = WebUI.getAttribute(findTestObject('Object Repository/Web/Management Portal/HomeScreen/Switcher/select_--Select an unauthenticated Home Screen Tile'), 'data-tileversion')
Workaround works and returns the value attribute of the option currently set :
actualVersion = WebUI.getAttribute(findTestObject('Object Repository/Web/Management Portal/HomeScreen/Switcher/select_--Select an unauthenticated Home Screen Tile'), 'value')
However the string contains some extra I don’t care about and the code above returns:
342333A4-B8F7-49AF-AC44-D89CBCD7DD0F~3.3.0
I’m then using substring to return only the version number from the string to compare against the expected version number:
WebUI.verifyNotMatch(actualVersion.substring(37), hsVersion, false)
returns: 3.3.0