enter image description here

just as in the above image there is use of divs and every time the data (image) in that div changes. You are not even sure that how many divs will be therewith respect to row and columns. Kindly guide if any one has idea about it. Thanks.

  • 1
    What exactly do you want to check? The image?
    – beatngu13
    Apr 26 '19 at 17:43
  • No I just want to click on that image in the child div. Actually its and food item and after click on it, it will open a pop-up window. Apr 29 '19 at 4:55

I am not sure I understand completly so here are two solutions:

If the image path does not change use css selector:


If the path does change and all you really need to do is select "some" product:

Query all divs that have a class 'card-item-img' and select any of them:


Personally if that is the case I would use a lamba:


Here i can see that in your DOM that your image's path will unique, so if they will not change then you create the Xpath of that div using it's class and bakground-image.
and for further reference in making Xpath of background-image you can go through

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.