Reputation: 111
Can someone tell me an XPATH that does extract background color RGB values, or whole style, then I will remove unneeded data using Excel find/replace.
Been able to extract car color names using XPATH //div[@class='colorName']
<div class="colours" style="background-color: #040404; height: 30px; width: 130px; margin: 7px"></div>
<div class="colorName">Obsidian Black</div>
Source page: http://www.carwale.com/mercedesbenz-cars/e-class/e63amg-3049/
Upvotes: 4
Views: 941
Reputation: 473833
You can use the combination of substring-after()
and substring-before()
:
substring-before(substring-after(//div[@class="colours"]/@style, "background-color: "), ";")
Works for me in the chrome console:
> $x('substring-before(substring-after(//div[@class="colours"]/@style, "background-color: "), ";")')
"#040404"
Upvotes: 2