I have a webpage where there are few text fields to be filled up with some values using Selenium WebDriver. But I’m unable to fetch these items using the APIs provided in selenium framwework because the IDs are changing dynamically.
For example one of the text fields has the following ID
<input id="order_unit_line_rate_806099_unit_price" type="text" value="" uniqueattr="Dynamic Site Accelerator / Dynamic Site Accelerator / Platform Fee / / Price" size="10" onchange="javascript:numberFormatValid('order_unit_line_rate_806099_unit_price', parseI18nNumber($('order_unit_line_rate_806099_unit_price').value, ',', '.'), 5, '.');" name="order_unit_line_rate[806099][unit_price]">
where the digits 806099 which is a part of the id varies for every new page and every new text box. I didn’t have any luck by using the findElements(By.id()) API.
can someone please suggest any approach for identifying these elements.
I’m using eclipse as the editor, java as the client driver and selenium webDriver as the automation framework.
Thanks
Kiran
You can use findElementsByTagName and then loop over each returned element, checking its ID versus your regular expression: