After further review I recommend using:
because it is not tied in to the actual text "Add photos..." which may change over time.
It is based on there being a section of the page being used for this message composition ('
#pagelet_composer') which has a link for attachments conveniently marked with a data attribute '
You have not shown all the page HTML or other cases so I can't tell whether this is truly unique, you will have to finally determine that based on the full page HTML and functionality.
Ultimately I would use a Page Object (implementation depeneds on your language and framework) to define this selector, name it something like
attach_document and then you can use
attach_document.click() in the actual test for readability.
If this is a one page document and/or has this identifier in other places on the page, but only one is visible at a given time you might need to add a