TestComplete Web Testing Quick Tip: Checking ALT attributes of IMG Tags
Test and Monitor | Posted March 24, 2006

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:


Close

By submitting this form, you agree to our
Terms of Use and Privacy Policy

Thanks for Subscribing

Keep an eye on your inbox for more great content.

Continue Reading

Add a little SmartBear to your life

Stay on top of your Software game with the latest developer tips, best practices and news, delivered straight to your inbox