Create an automated test with selenium, python, and unittest

Given the test automation requirement is to automate the login process and create a note on the web application how would you approach this?

I would approach it by exploring the app first. I would get familiar with the user flow, what elements I could automate, what checks to implement. I would make notes on this.

Then I would write a pseudocode.


  1. Launch the web application
  2. Verify the elements exits
  3. Click login button
  4. Input username and password
  5. Click the login button
  6. Verify the elements exists on page
  7. Close the browser

After this I draft my code until the requirement is satisfied. I would test it several times then have someone review it.

After which I can commit it to the main repository as an approved test case.

Of course, the code could still be improved but that’s for another time.

Here is the code I made –

Comment and let me know your thoughts.


Love your BASHers! .bashrc vs. .bash_profile


Before anything else, let’s look up what BASH is.

Basically, BASH is a type of shell. A shell is an interpreter of commands in a command line environment. We use BASH and it’s syntax to instruct a computer to do things aka as programming.

For every environment, we have settings to configure. .bashrc and .bash_profile does that for us.

We declare our setting in these files. An example would be the PATH.

The difference between the .bashrc and .bash_profile is that the .bash_profile is used on login environments. By default, when we login to a terminal the .bash_profile will be used.

If the environment or application doesn’t need any login permissions, .bash_rc will be used.


What the f*** is PATH?

When installing applications. The installation guide always says to add this to the PATH. But what the f*** does that mean?

:~user$ echo $PATH

As a beginner this is confusing. You just want to get the thing running without errors.

Let’s dig in.

From StackOverflow:

It is a list of directories in which to search for executable files.

It is when you try to execute a command from your shell (or from within some other program in certain ways), it will search through each of the directories in this list, in order, looking for an executable file of the name you’re provided, and run the first one it finds.

Basically, it is a configuration needed in order for your programs to run.

It can be set on the .bash_profile file for Linux/Unix or the control panel for Windows.

To know more about PATH and .profiles check out these links:

Love at VS Code? My first impression

TLDR; I am starting to fall in LOVE with VS Code

As a tester, I write automated tests. I use an IDE or text editor to do so.

Since I learned how to write tests with Python, I used Pycharm exclusively. I liked using it since it is powerful. It has IntelliSense, themes, command line and much more. I used it both on Windows and Mac. However, in time, I noticed it is becoming sluggish. Unfortunately, I don’t have a fast computer so it adds damage to my patience.
Pycharm Screenshot

I explored other text editors like Atom. I liked how minimalist it is. I just can write and run code on it. What’s good about Atom is it is highly customizable. You can import plugins to suit your workflow. So if you miss the IntelliSense, themes, command line and much more, you can just install it. After a while, I also notice it becoming sluggish on Windows and Mac. Sometimes I experience errors because of the compatibility of the plugins. It is frustrating.

Atom Screenshot

I think both Pycharm and Atom are good development tools but it favors power users with powerful computers because they can maximize its features.

Finally, I tried VS Code and I was impressed by it’s UX. So much that I installed it on both Windows and Mac.

Create Test Cases

I liked how the UI is neatly placed. Elements and partitions are well balanced. Intuitively, I can decipher what’s going on with the UI. From the icons to the views and the tabs.

Performance wise, it is faster than what I am used to. It also has all the power and configuration a coder needs. I can go install-happy on installing plugins!

Basically, it’s what they described- lightweight and powerful.

It is excellent for beginners more so power users.

For some reason, I favor using it on Mac just because it feels more smooth.

I haven’t spend a lot of time on it but my first impression was lovely! VS Code did a good job of taking what worked well and what didn’t from other products and improved on it.

My Mac OS crashed. This is how I fixed it.

Yesterday, I received an update notification for the latest release of MacOS High Sierra. So I clicked the update and restart button.

It was noon and I was not at home but in a coffee shop browsing the web about Travis CI. The internet connection was fairly stable in the coffee shop until I noticed the update progress bar was stuck at 50% for some time. I clicked the cancel button and went home.

I restarted the update at home and it was successful until my computer
restarted. I was prompted that an update failed to install. I clicked continue and my computer booted as normal. I was able to use it.

I check the updates and there was still an update left. I thought this was the one that did not install successfully. So I clicked the update button again. My computer rebooted and I was able to use my it flawlessly.

Until I shut it down…

I opened my computer in the evening and it booted slowly until it crashed. I was prompted with this screen.


I tried rebooting nth times to no avail.

I was frustrated.

I calmed down and pondered on solutions. I created a hypothesis that it might be a bad install because of the experience I had earlier noontime.

The solutions I had were bringing it to the Apple store and have it fixed or find online some suggestions. I went with the latter.

Normally, during crashes, the solution is to reformat or erase everything and do a clean install. This solves most problems but with the sacrifice of loss of files and more effort to fix.

I didn’t want to do that.

The suggestion I found online was to reinstall the OS. For me, I had High Sierra as my OS.

So I restarted my computer and pressed  CMD +R  while it was booting.

This procedure will bring up the disk utility app.

On the disk utility, I opt to install MacOS again. My computer restarted and installed MacOS.


I waited 1-2 hours for it to complete. After that, I was able to log in and use my computer. My files were still intact. All of my worries were gone.



  • Don’t download and install an update when the internet connection is unstable.
  • Don’t rush into solutions. Think as many solutions and try the most practical one.
  • Share the problem and solution.

How to run a headless browser with Selenium Python

One day, I came across the word “headless browser” and it made no sense to me. I initially thought it was a fancy term for new web browser brand.


A headless browser is when a web browser is running without seeing it on the screen. It just runs in the background.

To enable this feature the browser options must be configured. In this case, Chrome and Firefox browsers will be used.

Before proceeding make sure that python, selenium, Chrome and Firefox browsers are installed.

Below is the code snippet on how to run a browser in headless mode.

from selenium import webdriver

'''Using Firefox Browser'''
options = webdriver.FirefoxOptions() # selenium 3.8.0 above
options.add_argument('-headless') # alternatively options.set_headless(headless=True)

driver = webdriver.Firefox(firefox_options=options)

'''Using Chrome Browser'''
options = webdriver.ChromeOptions() # selenium 3.8.0 above

driver = webdriver.Chrome(chrome_options=options)

For more samples, kindly visit my GitHub