hide-if-matches-computed-xpath
The hide-if-matches-computed-xpath snippet hides specific elements whose class name or ID changes at runtime through a dynamically-built XPath query. It takes an incomplete XPath selector with a {{}} placeholder and fills it using searchQuery and searchRegex.
Always use double quotes instead of single quotes inside selectors.
Parameters
|
Name |
Description |
Mandatory |
|---|---|---|
|
query |
Template XPath query. Use |
Yes |
|
searchQuery |
XPath query to search for an element used alongside searchRegex. |
Yes |
|
searchRegex |
Regular expression to extract text from the innerHTML of the element matching searchQuery. |
Yes |
|
waitUntil |
Delay until given state (loading, interactive, complete, load, or event name). |
No |
Filter examples
|
Filter |
Result |
|---|---|
|
|
Hides all elements with a class matching any string in the target div. |
|
|
Hides elements containing "Sponsored" with a dynamically computed class. |