How to select Random images from gallery and random future from date picker in web

Hello ,

I’m stuck with following specific scenario -

  1. Random Images selection from available images page.
  2. Random future date selection from calendar date picker widget.

I would like to know how we can select random images from any specific page modal so, whenever I run test case with different accounts then my test case will pickup any available random image from web screen.

Same issue for random future date selection from date picker widget.


general approach may look like this:

  1. a. Identify all images with some selector
    b. Get number of images
    c. Generate a random number between 0 and number of images
    d. Use this number in XPath to get random image

  2. a. Get current date
    b. Identify the position of current date in your widget
    c. Pick a random element after your current date

I can’t help you anymore as I don’t know your HTML code, but this general approach would work.