1

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

Steps:

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

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

10
  • Yes your steps looks fine , what issue you facing? Commented Jan 7, 2015 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
    Commented Jan 7, 2015 at 12:09
  • Did you try XPATH? Commented Jan 7, 2015 at 12:10
  • I also tried these commands Selectpopup (Popup window name) and click //a[2]/span commands.
    – Divya
    Commented Jan 7, 2015 at 12:23
  • Actually selenium IDE as mostly issue with popup. you can try like waitForPopUp | yourwinId | 30000 selectWindow |yourwinId ... close Commented Jan 7, 2015 at 12:26

4 Answers 4

1

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.

1
  • 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 Commented Jun 2, 2017 at 13:09
1

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

Please note:

  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.

1

I would suggest minimize usage of your's Selenium IDE instead of try to write your own code , i would help you in that process. please provide me your HTML code for popup.

1

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

On some websites the ID of a button (or an element in general) is changing between different page loads (dynamic ID). This means the test case macro will fail at replay as the button has a new ID after each page refresh.

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-')].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.