I am using JSF 1.2. We want to write some selenium tests (based on xpath), but xpath does not seem to have wildcards for element identifiers.
We cannot disable prefix identifiers because we are launching the portlet in IBM Portal Server 6.1, and our application is terminated in this environment with the prefix disabled.
We are currently using xpaths of the form
//*[substring(@id, 54)='id_distributorName']
which will match:
<select size="1" class="firstName" name="viewns_7_8000CB1A0GUIE0IJF799CR10O2_:commonEntryForm:id_distributorName" id="viewns_7_8000CB1A0GUIE0IJF799CR10O2_:commonEntryForm:id_distributorName" >
but it seems to me that assuming that JSF always generates viewId with the same length is dangerous.
Is there a better way to do this?
We tried to use the attribute namefor our input controls, but of course, JSF ignores the attribute and writes its own name attribute whose value matches the identifier, presumably for explaining the evant scripts)
source
share