Question: How can I use Power Search to find images (img tags) on my website that do not have an “alt” attribute present?
Answer: Follow these steps:
- Create a new project and specify your Root URL
- Set the Query Type to “XPath”
- In the Query field, enter: //img[not(@alt)]
- In the “Attribute” field (to the right of the Query) enter in “src”.
- Click the “More Query Options” link and turn on “Include Context of Match”. This will make it easier to find the actual “img” tag on the page.
- Click “OK” to close the Query Options window and run your project.
With this configuration, Power Search will only display only the “img” tags that lack the “alt” attribute. The “src” field in the results will be the value in the “src” attribute, and the “Context” column will show where in the HTML the image tag is located.