1
<a href="http://link.com">
 <div style="background-image:url(https://imageurl.jpeg);">
  </div>
</a>

Is there a selector in xpath that allows for getting the value of a certain css declaration, bearing in mind that it is an inline style.

In the code example above I want to retrieve the value of the "background-image" prop.

1
  • consider using "selenium webdriver" or Python "scrapy" module Commented Jun 10, 2017 at 19:37

1 Answer 1

2

You could use the xpath :

substring-before(substring-after(//div/@style, 'background-image:url('), ')')

Sign up to request clarification or add additional context in comments.

1 Comment

perfect answer, basically find the beginning and end of the characters surrounding the url. thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.