Hi Pauline, the attributes for a Dynamic Component are in the the "dynamic_attributes" attribute_dictionary.
# Check "dynamic_attributes" dictionary for a Dynamic Component
identity = selected[0].get_attribute("dynamic_attributes", "identity")
# the Definition may have the attribute, so...
if identity.nil?
identity = selected.definition.get_attribute("dynamic_attributes", "identity")
end
if identity.nil?
# there is not attribute named "identity"
else
# Yes, we found "identity"
end