Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用xpath从内联样式中选择css属性值_Xpath_Web Scraping - Fatal编程技术网

使用xpath从内联样式中选择css属性值

使用xpath从内联样式中选择css属性值,xpath,web-scraping,Xpath,Web Scraping,xpath中是否有允许获取特定css声明值的选择器,请记住它是一种内联样式 在上面的代码示例中,我想检索“background image”prop的值。您可以使用xpath: substring-before(substring-before(//div/@style,'background image:url('),'))考虑使用“selenium webdriver”或Python“scrapy”模块完美的答案,基本上找到url周围字符的开头和结尾。谢谢 <a href="http:

xpath中是否有允许获取特定css声明值的选择器,请记住它是一种内联样式


在上面的代码示例中,我想检索“background image”prop的值。

您可以使用xpath:


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

考虑使用“selenium webdriver”或Python“scrapy”模块完美的答案,基本上找到url周围字符的开头和结尾。谢谢
<a href="http://link.com">
 <div style="background-image:url(https://imageurl.jpeg);">
  </div>
</a>