I wanted to write Xpath or css for

<div class="img"style="background-image:url(//cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_560x.gif);"></div>
  • 1
    Welcome to the community. Are you able to provide more about the DOM structure? Often times just looking at one element in the DOM tree isn't enough to create an xpath or css element locator. Have you tried using the "copy xpath" or "copy selector" in Chrome's dev tools?
    – Lee Jensen
    Dec 10, 2021 at 17:53

1 Answer 1


use above css locator, which checks for div tag element with style property starting with background-image

you can also use xpath:

//div[starts-with(@style, 'background-image')]

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.