Reputation: 21
<div class="card-image" style="background-image: url("https://cdn6.bigcommerce.com/s-0kvv9/images/stencil/500x659/products/170691/242554/dicemastgreenflash__36803.1503934716.jpg?c=2");">
</div>
When I input this,
.//*[@class='card-image']/@style
it returns this:
background-image:url('https://cdn6.bigcommerce.com/s-0kvv9/images/stencil/500x659/products/170691/242554/dicemastgreenflash__36803.1503934716.jpg?c=2');
I only want it to return the URL.
Upvotes: 2
Views: 1151
Reputation: 111581
This XPath,
substring-before(substring-after(.//*[@class='card-image']/@style, "url('"), ");")
will select only the URL, as requested.
Upvotes: 1