TestComplete Web Testing Quick Tip: Checking ALT attributes of IMG Tags
TestComplete provides scripting access to web page elements as well as to methods, properties and events of elements. Using this functionality, you can check different characteristics of a web page and its elements. For example, you can check whether the ALT attribute is specified for all images on the page. Why is this attribute so important?
- The attribute is needed so that people who have low vision could work with the page.
- The text of the ALT attribute is used by text browsers for indicating an image.
- The text of the attribute is used by regular browsers and if the image indication option is disabled in browser settings.
- ALT is used by search engines for page indexing.
Microsoft recommends that the ALT attribute be used to create accessible web pages. In some companies using this attribute is also required by internal standards for documentation and web pages. Many authors (for instance, http://www.xs4all.nl/~sbpoley/webmatters/checklist.html#access) suggest including the check for ALT tags into a web page checklist.
Since TestComplete provides access to web page elements, you can easily check whether the ALT attribute is used for images on the tested pages. The following code demonstrates how you can do this: