I am new to XPath and need some help.
The system auto generates the id which looks something like this:
<input type="file" class="form-file" size="22"
name="files[entry-23245_field_entry_attachment_und_0]"
id="edit-entry-23245-field-entry-attachment-und-0-upload"
style="background-color: transparent;">
I am able to locate the id using xpath or css however the numbers within the id string changes as this is randomly generated so the next time my test runs, it fails because it cant locate the string.
I would like to know if it is at all possible to write an xpath expression that will look for everything from the start of the string edit-entry-
then some how look for any integer value between 0-9 within that string -23245-
, then also match the end part field-entry-attachment-und-0-upload
. this way when my test runs, it is able to locate the element all the time even if the numbers within the string change. iv tried adding \d+
to my xpath but it doesn't seem to pick it up.
This is the xpath:
//*[@id="edit-entry-23245-field-entry-attachment-und-0-upload"]