Email Subscription Form

Saturday, March 9, 2019

Easy Free Automation Part VIII: Accessibility Tests

Accessibility in the context of a software application means that as many people as possible can use the application easily.  When making an application accessible, we should consider users with limited vision or hearing, limited cognitive ability, and limited dexterity.  Accessibility also means that users from all over the world can use the application, even if their language is different from that of the developers who created it.

In this final post in my "Easy Free Automation" series, I'll be showing two easy ways to test for accessibility.  I'll be using Python and Selenium Webdriver.  You can download the simple test here.


To run the test, you will need to have Python and Selenium installed.  You can find instructions for installing Python in Easy Free Automation Part I: Unit Tests.  To install Selenium, open a command window and type pip install selenium.  You may also need to have Chromedriver installed.  You can find instructions for installing it here.

Once you have downloaded the test file and installed all the needed components, navigate to the test folder in the command line and type python3 easyFreeAccessibilityTest.py.  (If you don't have Python 3, or if you don't have two versions of Python installed, you may be able to type python instead of python3.) The test should run, the Chrome browser should open and close when the test is completed, and in the command line you should see these two log entries:
Alt text is present
Page is in German

Let's take a look at these two tests to see what they do.  The first test verifies that an image has an alt text.  Alt texts are used to provide a description of an image for any user who might not be able to see the image.  A screen-reading application will read the alt text aloud so the user will know what image is portrayed.

driver.get("https://www.amazon.com/s?k=goodnight+moon&ref=nb_sb_noss_1")
elem = driver.find_element_by_class_name("s-image")
val = elem.get_attribute('alt')
if val == 'Goodnight Moon':
print('Alt text is present')
else:
print('Alt text is missing or incorrect')

In the first line, we are navigating to an Amazon.com web page where we are searching for the children's book "Goodnight Moon".  In the next line, we are locating the book image.  In the third line, we are getting the 'alt' attribute of the web element and assigning it to the variable 'val'.  If there is no alt text, this variable will remain null.

Finally we are using an if statement to assert that the alt text is correct.  If the alt text is not the title of the book, we will get a message that the text is missing.

The second test verifies that we are able to change the language of the Audi website to German.

driver.get("https://www.audi.com/en.html")
driver.find_element_by_link_text("DE").click()
try:
elem = driver.find_element_by_link_text("Kontakt")
if elem:
print('Page is in German')
except:
print('Page is not in German')

In the first line, we navigate to the Audi website.  In the second line, we find the button that will change the language to German, and we click it.  Then we look for the element with the link text of "Kontakt".  If we find the element, we can conclude that we are on the German version of the page.  If we do not find the element, the page has not been changed to German.  The reason I am using a try-except block here is that if the element with the link text is not located, an error will be thrown.  I'm catching the error so that an appropriate error message can be logged and the test can end properly.

There are other ways to verify things like alt texts and page translations.  There are CSS scanning tools that will verify the presence of alt texts and rate how well a page can be read by a screen reader.  There are services that will check your internationalization of your site with native speakers of many different languages.  But if you are looking for an easy, free way to check these things, this simple test script provides you with a way to get started.

For the last eight weeks, we've looked at easy, free ways to automate each area of the Automation Test Wheel.  I hope you have found these posts informative!  If you missed any of the posts, I hope you'll go back and take a look.  Remember also that each week has a code sample that can be found at my Github page.  Happy automating!


37 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Needed to compose one simple thing yet thanks for the suggestions that you are contributed here. Would like to read this blog regularly to get more updates regarding Software Testing Company in India and Automation Testing Services

    ReplyDelete
  3. Thanks for the article. Really appreciate the time and effort that went into composing this article. Looking forward to reading more from you.
    softwaretesting
    softwaretestingcompaniesinhyderabad
    manualtesting
    automationtesting

    ReplyDelete
  4. Thank your for this article. We are proving software testing services in Hyderabad. https://stigentech.com/qa_testing/

    ReplyDelete
  5. Nice Post...
    I am a professional techie and using a computer system for various computing tasks. I need a Microsoft office suite for various tasks such as MS word, and Excel. I want to install MS office suite from www.office.com/setup on my computer system, but I don’t have sufficient experience to install MS office suite on my computer system. So, I am into a big technical trouble, so I am looking for a technician’s help for the installation process. Can you recommend the easy steps for the installation process of MS office suite? Please share your easy steps here.
    office.com/setup
    office.com

    ReplyDelete
  6. I agree with you. I was looking for some cross-references, and found this one. I really think that I found something worth reading. I am putting it on my RSS feed to ensure that I don't miss out on your posts.

    Etech

    Sorry, No Manipulations With Clipboard Allowed
    VIPBox
    TheWatchSeries.to
    retrieve software product keys
    Enable Streamer Mode on Discord
    Minecraft run faster

    ReplyDelete
  7. I have been reading your posts for quite some time. And everytime, it adds to my knowledge. But could you please elaborate on the last section in your upcoming post? Keep writing.
    tech ransom
    Gorgeous Rainmeter Skins
    Google Picasa Alternatives
    [pii_email_ddb7b0ca0f8cb4d23f14]
    Best Windows 10 Apps
    8 Best Voice Changer Apps for Discord
    Cool Discord Bots
    SNES Emulators

    ReplyDelete
  8. Thank you, I have recently been looking for info about this topic for ages and yours is the best I have discovered so far.
    But, what about the bottom line? Are you sure about the source?우리카지노

    ReplyDelete
  9. 토토사이트
    I’ve been watching out for your content. If ever you have some more updates please do notify me.

    ReplyDelete
  10. 먹튀검증
    I am very happy to discover your post as it will become on top in my collection of favorite blogs to visit.

    ReplyDelete
  11. You have remarked very interesting details ! Also visit my site:
    토토
    경마사이트
    경마

    ReplyDelete
  12. Succeed! It could be one of the most useful blogs we have ever come across on the subject. Excellent info! I’m also an expert in this topic so I can understand your effort very well. Thanks for the huge help. 안전놀이터


    ReplyDelete
  13. Thank you so much for such a well-written article. It’s full of insightful information. Your point of view is the best among many without fail.For certain, It is one of the best blogs in my opinion. 먹튀검증


    ReplyDelete
  14. That's a great article! The neatly organized content is good to see. Can I quote a blog and write it on my blog? My blog has a variety of communities including these articles. Would you like to visit me later? keo nhacai


    ReplyDelete
  15. To do this from placing completely different signs in the office and bathing room to entice and call attention workers to fix and sterilize their wrists and hands regularly with a alcohol-based sanitiserAfter disinfection from a surface, have a disinfecting wipe for you to do a one-way wipe down. Which may be, a wipe down in only one place, that process germ won’t turn out to be deposited in your opposite direction of this surface. cleaning companies in dubai

    ReplyDelete
  16. Very garcefull post thanks for sharing. If you are looking for Courses after 12th, then you must visit India's largest growing education platform, Spin On Education which provides the best entrance exam preparation material and counselling.  

    ReplyDelete
  17. This post is so useful and informative. Keep updating with more information.....
    Developer Testing
    Software System Testing

    ReplyDelete
  18. By this comment I sincerely believe that the site needs more attention.Thank you once again for your advice. I will read more!

    카지노
    메이저사이트
    토토
    사설토토
    스포츠토토
    카지노사이트

    ReplyDelete
  19. Gday there, just got alert to your web page through Search engine, and found that it is pretty beneficial. I will value if you decide to retain such.
    Keep working ,splendid job!카지노사이트

    ReplyDelete
  20. Write more, that all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what your talking about, why waste your intelligence on just posting videos to your site when you could be giving us something informative to read?바둑이사이트

    ReplyDelete
  21. This comment has been removed by the author.

    ReplyDelete
  22. Thanks to sharing this infromation help me lot sir
    Read more: https://fmovies3.com/

    ReplyDelete
  23. Unlock a world of entertainment possibilities with Fubo.tv/connect, where live sports, TV channels, and on-demand content converge. Immerse yourself in the excitement of live games, explore an extensive selection of channels spanning news, entertainment, and more, and discover a vast library of on-demand movies, series, and exclusive content, all available at your fingertips.

    ReplyDelete
  24. Cbd Oil For Pain has gained popularity as a potential remedy for pain management. Extracted from the hemp plant, CBD oil contains cannabidiol, a non-psychoactive compound with anti-inflammatory properties. When consumed, CBD interacts with the body's endocannabinoid system, which regulates various functions, including pain perception.

    ReplyDelete
  25. Elevate your career with our premium CV writing services Ireland! Our expert team at CVWritingServices.ie is dedicated to crafting resumes that showcase your skills and experience. Trust us for the most reliable and best CV writing service in Ireland. Don't miss out on your dream job – start with us today!

    ReplyDelete
  26. Nice blog
    Looking for online driver licence translation services? Mytranslationservices.com is your trusted destination. Our offerings include marketing translation, legal translation, document translation, and transcription services, covering over 200 languages. With precision and cultural sensitivity, we ensure accurate translations for your driver's license. Count on us for professional online translation services tailored to your needs. Explore Mytranslationservices.com for comprehensive language solutions. When it comes to online driver's license translation, we're your reliable choice. Visit our website now for seamless and accurate translations. Your partner for online driver's license translation is Mytranslationservices.com.

    ReplyDelete
  27. In a world where technology dominates our expressions of affection, there's a unique joy in creating tangible symbols of love. One such delightful and nostalgic craft involves transforming a simple gum wrapper into a charming heart. This DIY project not only allows you to express your creativity but also provides a unique and personal way to show someone you care. In this comprehensive guide, we'll explore the step-by-step process of crafting hearts with gum wrappers, turning a humble foil into a symbol of love and thoughtfulness. How to Make a Heart with a Gum Wrapper

    ReplyDelete
  28. Nice Post,

    Hello everyone, I am George Mcbrine your helping partner in crafting your CV. Crafting a professional CV just got easier with our premier CV Builder in Ireland. Our intuitive platform guides you through the process step-by-step, helping you create a polished and tailored resume in no time. With customizable templates and expert tips, you can showcase your skills and experiences effectively to potential employers. Say goodbye to CV struggles and hello to success with our CV Builder in Ireland. Start building your winning CV today!

    ReplyDelete

New Blog Location!

I've moved!  I've really enjoyed using Blogger for my blog, but it didn't integrate with my website in the way I wanted.  So I&#...