# Selenium IDE - Selecting an option from Popup Menu when the ID is dynamic

I would like to select an option from the Popup Menu. I tried all possible combinations.

Steps:

1. I click on a button
3. select an option from the list of options. a) Edit b) Delete

Every time I try to record this though the ID changes.

• Yes your steps looks fine , what issue you facing? – Helping Hands Jan 7 '15 at 12:05
• Thanks for taking time to help me. I tried to locate the option using its id. But the id keeps changing for each run. I'm unable to find the id of the option. I tried using xpath and //a commands too. It says element not located. – Divya Jan 7 '15 at 12:09
• Did you try XPATH? – Helping Hands Jan 7 '15 at 12:10
• I also tried these commands Selectpopup (Popup window name) and click //a[2]/span commands. – Divya Jan 7 '15 at 12:23
• Actually selenium IDE as mostly issue with popup. you can try like waitForPopUp | yourwinId | 30000 selectWindow |yourwinId ... close – Helping Hands Jan 7 '15 at 12:26

Check this out: Testing the popup with Selenium IDE

IDE (plain Record and Playback) will work only till an extent. When you reach that point, you will have to either start spending a lot of time adding your own commands between various recorded steps or you will have to step into the world of Selenium Webdriver. I would suggest the latter.

• fyi, seleniumIDE is not only record and play. It's a great tool that I've used a lot without record and play. It even allows constructs such as Page Objects, etc. The only thing I avoid with the tool is... record and play – Michael Durrant Jun 2 '17 at 13:09

Please see here https://www.youtube.com/watch?v=KDBp6hErHlY a small example. I'd took youtube.com to show it. Pause command was added only to show that popup menu is opened

1. When you use Selenium IDE in some cases you can choose one of several options in "target" field

2. Sometimes tail could be removed. I'd try to remove /button but it should be in displayed case

In general, "it depends" which locator you should select. It could be /a[1] link (but if there a lot of links on page - you should define XPath carefully - please study tutorials about XPath), it could be /li[1] elements, it could be (//button[@type='button'][1]) and other kind of XPath.

Solution: Typically some part of the ID remains constant e. g. post-123456 and post-555555. We can use XPath's starts-with or contains functions to search just for the stable part of the ID. So the selector will be something like this: //*[contains(@id, 'post-')].