Skip to main content

#HACKMONDAY – Debugging my first UI Automation Test Sample (PART I)

How to debug your first UI Automation Test Sample

Another One! (DJ Khaled’s Voice). That’s RIIGGHHT; I am back! I wanted to do my first #HackMonday to follow up on my WinAppDriver (WAD) post. This a three-part blog. In part I of the blog, I will debug the Python calculator sample test. In part II of the blog, I will debug my own Python WordPad test.

Background info:

#HackMonday is an idea I came up with as a social experiment. The goal is to #hack with someone new, with the hopes of learning or teaching them something new. For this #HackMonday, I had the pleasure of virtually meeting Hammid Funsho (HI FWEND!)

About Hammid:

A little bit about Hammid, He is a software engineer. He has about 12 years of experience under his belt. He has a passion for automation testing. He codes Java, but occasionally dabbles in Python, and Ruby.  Hammid is currently based out Raleigh North Carolina.

How did I come about meeting Hammid? Great question! It’s simple; I met Hammid on twitter. I saw his profile and liked his software creds, so I asked him if he would be interested in being part of my first #hackmonday. Thankfully, Hammid gracefully accepted my invitation to #hack.


2.Windows 10 machine

5. Patience

I started off by explaining WinAppDriver to Hammid since he wasn’t familiar with it. (For a recap, click here). Before we debugged my Python Wordpad UI test, I decided to show him WinAppDriver (WAD) in all its glory by running the Python Calculator Test for WAD. The calculator test was a functioning test and should have been an easy way to showcase WAD. To my surprise, the test failed. I must admit, I was taken back by the results since I ran this a couple of weeks ago. I knew for a fact I had not made any changes to the code since I downloaded it from GitHub. So with our best Tom Cruise impressions, Hammid and I went on mission impossible to figure out what went wrong. We started off by comparing the copy of the calculator test I had to the one on the WAD GitHub. We found no differences.

We checked the WAD logged, and we found no 400 errors either. We decided to go back to Visual Studio Code and look at the traceback in the Debug Console.

Here is a video of us debugging the calculator test.

While reviewing the traceback in the debug console, we kept seeing Assertion Error: ‘Display is 8’ != ‘Display is  8 ‘ which means “display is 8 is not equal to display is  8 ”. 

Side note
At first glance, you may not notice anything wrong with the error messages. So we decided to use the print technique to understand what the CalculatorResults value should be.   

def test_initialize(self):

        result = self.driver.find_element_by_accessibility_id("CalculatorResults")

        print (result.text)

        self.assertEqual(str(result.text),"Display is  7 ")

We ran the code and saw that the CalculatorResults value is "Display is 7" but our code was still failing.However, if you look closer, there are some extra white spaces included in one of the “Display is 8”. This was odd since I had not made any changes to the calculator test. To further investigate the issue, we opened up the windows app called Inspect which enables you to view the UI element and see its attributes/ accessibility information.

Upon further inspection, we agreed that there were too many white spaces for "Display is 8" in the test. So after checking Inspect and verifying this ourselves, we decided to remove the extra white spaces. We reran the test again and this time  S-U-C-C-E-S-S.


The sudden change in the element “calculatortest” I believe was due to a Windows update that I did on my machine the day prior.  The calculator app must have updated, and the dev team must have removed the extra white spaces which in turn broke the code.  I learned a lesson. Your environment is always changing, and I find myself asking how could I improve this code so that if there are any additional updates, my code will not break. We could potentially use the strip method or the replace method in python. You can check out an article on how to strip characters from a string from the website below.


  1. Thanks for the useful information of software testing courses, give more updates on software testing development, First time I visit your blog really nice, I bookmark your blog here after a daily visit. Learn software testing course in Chennai

  2. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here.Thanks once more for all the details.
    Best selenium training Institute in chennai

  3. I feel extremely cheerful to have seen your web page and anticipate such a large number of additionally engaging circumstances perusing here.Thanks yet again for every one of the points of interest.
    Read Beard Press

  4. Yiioverflow presenting one of the best and high performance PHP framework. Fast, secure and extremely professionals are developing applications. We guide to implement mobile app development and SOA hybrid applications.Code in Nodejs, Angular,Ionic,ReactJS and Yiiframework.

  5. Thanks for sharing the valuable information to share with us For more valuable information please visit our website.

    selenium training in chennai

    aws training in chennai

  6. Excellent blog about Python. I learned a lot from your blog and I have bookmarked this page for my future reference. Keep up the good work and share more like this.
    Python Classes in Chennai | Python Training

  7. Your posts are the flower of the flock. I apply the advice in real life. They contain pieces of advice. I'm grateful for your sharing. I hope you will write often and post more articles.
    email with love 2018 email with love 2018

  8. Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..

    selenium training in bangalore

    aws training in bangalore

  9. The blog you have shared is very much helpful to know more about the selenium. Thanks for your information about the selenium.
    selenium testing training
    selenium testing course
    selenium training classes
    selenium classes
    selenium training course

  10. This concept is a good way to enhance the knowledge.thanks for sharing. please keep it up selenium Online Training Hyderabad

  11. This concept is a good way to enhance the knowledge.thanks for sharing. please keep it up selenium Online Training Hyderabad

  12. You won't believe me, but I was planning to write a blog very similar to the one you have posted here. Great work!

    Python Training In Chennai

    Selenium Training In Chennai

  13. A very useful blog to every. Really it is easy to understand.
    Great job. Keep posting the updates.
    selenium training
    selenium course
    selenium testing training

  14. Thank you for sharing such a nice and interesting blog with us. Hope it might be much useful for us. keep on updating...!!

    Article submission sites
    Guest posting sites

  15. If you want to play like me and not lose, you should try playing BGAOC. free gambling with us Playing here you not only win but also get a lot of fun.

  16. Your article is really worth reading. I've been follwing your blogs for a while and you are doing a great job. Regards to your hard work and great effort.

    Python Course in Chennai
    Java Course in Chennai

  17. I feel satisfied to read your blog, you have been delivering a useful & unique information to our vision.keep blogging.
    salesforce Training in Bangalore
    uipath Training in Bangalore
    blueprism Training in Bangalore


Post a Comment

Popular posts from this blog

Are You a New Programmer and Would Like to Test Your Windows Application or Existing Windows Application? Here Is a Guide to Help You Get Started. (The Beginner’s Edition)

Getting You Started with WinAppDriver

Are you a total beginner to programming just like I am, but you would still like to try out Microsoft’s tool for application testing? Well don’t worry, I got you covered. Below I will detail my experience with getting started with WinAppDriver and testing basic Windows application such as the calculator in Python and C#. This tool could be beneficial for developers that would like to test their software before production or launch. The purpose of this tutorial is to create easy steps to follow and enable you to use WinAppDriver. I once read a quote that says:
“If you want to learn something, read about it. If you want to understand something, write about it. If you want to master something, teach it.”                                                                                                                                             - Yogi Bhajan

So here goes nothing 😊

Getting Started: What is the Windows Application Driver?
Windows Applicat…

Raw | Uncut | Keeping It All the Way 100

I KNOW! I KNOW! I am terrible; I went back on my word. I have not been pushing out blogs like I promised I would. But I am back for another one so forgive me? Cool

A lot has happened since I last wrote. I have been working on this blog since January but decided not to post it. This is a reasonably vulnerable post, so I was hesitant. I still am, and I am hoping this is the right move. Hopefully, someone will find this and be able to sympathize with this.
I wanted to write a blog about my struggle and reflect on the past two years of my life. Back in December 2015, I accepted an offer to come work for Microsoft as a support engineer(SE). My start date was initially set for Feb 2016, but due to family issues, they pushed it back to July 2016. I chose Microsoft partly because my recruiter showed me the most compassion during that time and so easily accommodated my ask to push back my start date.

In July 2016, I started my job as an SE. At first, I loved my job, but slowly and surely it st…