![](/img/trans.png)
[英]How to find all class names or ids from a CSS file that contains a background image using Regular expression and PHP?
[英]How to find field with specific background using xpath contains
我正在尋找的字段具有以下樣式:
background: #f3e6a0 !important;
我嘗試使用以下方法定位它:
//*[contains(@style, 'background: #f3e6a0')]
但它不起作用,我需要改變什么?
您的表達式匹配這樣的元素:
<div style="background: #f3e6a0 !important;"></div>
用他的樣式作為html元素的屬性。
但是在單獨的 css 文件或 style html 標簽中沒有匹配他的樣式定義的元素。
您可以嘗試通過另一種方式選擇所需的元素,例如 csselector 或通過其他規則使用 xpath 進行選擇。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.