How can I use selenium automation to test an Online Ordering application/system that has dynamic menus?

I have a test case where I need to validate for "new!" promotional items, new weekly/monthly menus --> Add to Cart --> Verify user is able to order successfully --> Verify Tax, Sub-Total

Challenges --> 1. Since Menus change often (very dynamic) - how should I add value by automating using selenium? Is it worth to go for test automation

  1. Links are dynamic i.e. menus, submenus are added under different links each time. Therefore, I need to go through each menu link and look for where exactly a NEW! sub-menu items were added.

Need some pointers, appreciate your help!


The queries that you have are very subjective. Please provide some specific details. However you can try the below approaches.

  1. Identify the frequently changing areas in the page, try to find out a pattern.
  2. Create different page classes for the dynamic part of the page, so that when they change you only have to change the bare minimum. You have to be wise in creating the small page classes.
  3. Try to create association between the dynamic page classes and the current page. You will achieve much more modular-ism.

I have used this technique for a couple of projects and they work fine. You can also have a chat with the dev team regarding how they are able to cope up with the agility and deliver so much changing and dynamic UI. You can also follow their approach to writing automated tests.

  • I updated the question to make it much more general which affects this answer now – Michael Durrant Jul 3 '18 at 19:06
  • That is not a problem, rather you are doing really great making the queries relevant. Now it is up to the query poster if this answer helps. – Kshetra Mohan Prusty Jul 4 '18 at 5:26

I recommend you focus on two things:

Unit/Integrated tests Make sure the the backend routine that takes a value (such as product identifer) and gives a response (such as 'added to cart' info), works as expected for a number of test cases. Do this for all the code that is involved in presenting and capturing selections from such choices on the backend

UI tests Focus on the dropdown, make sure that you can press down-arrow (using selenium send-keys) to select the first item in the dropdown and then tab on to have it selected. Nothing more, nothing less. This lets you have UI tests that are data-independent which is a huge thing.

By doing this division you can try and respect the test pyramid of

   some UAT
 Integrated Tests
Lots of Unit Tests

For the UI issue of not knowing if a submenu or a value exists I would do something like:

  • select the top level menu
  • wait for value / submenu to appear
  • keyPressDown
  • decide what to do if value appears
  • decide what to do if submenu appears (so do this recursively if u do have multiple levels)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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