How can I use the regular expression to identify xpath regex?
I need to access this element:
<input id ="combo-1105-inputWrap">
The 4 digits in the xpath are autogenerated per browser session. I need to find that particular xpath and key in the data.
I have tried to use a regular expression in my xpath but I am not able to make this work. //*[contains(id,'combo-1[0-9]{3}') and ends-with(id,'-inputWrap')] How can I reliably access this element?
The answer to your question regarding the xpath regex is that you can use some wild cards in cssSelecter to locate the same. Try below css Selector :
input[id^='combo-'][id$='-inputWrap']
For further clarification see this :-
input[id^='id_prefix_']
input[id$='_id_suffix']
input[id*='id_pattern']