Mozilla Internship: Conclusion and Retrospective

A Conclusion to My Internship

When I began this internship three months ago, neither myself nor my mentor had a clear picture of what I would produce, or how the goals of the project would change as time progressed.

The high-level goal of the internship was clear: to automate web accessibility testing. How best to do this, however, was not.

The first few weeks, as well as the weeks prior, were mostly spent on research.

I first needed to understand the problem domain, and then understand the tools available, as well as how to use them.

I had done some python programming before, but my work on this project was a side of python I had not delved into.

I had never used pytest or selenium, and knew nothing about python packaging (or accessibility, for that matter).

Prior to the start of the internship, I took a Udacity course on web accessibility, and wrote some simple tests using selenium and python.

Continue reading “Mozilla Internship: Conclusion and Retrospective”

Mozilla Internship: Writing a pytest Fixture

Writing a pytest fixture was actually much easier to do than I expected.

I did find, however, that the documentation on custom pytest fixtures was not very applicable to my situation.

I instead spent quite a lot of time looking at other pytest fixtures, such as pytest-html, pytest-selenium, and pytest-base-url, trying to figure out how they worked.

Having never used pytest fixtures—and being new to pytest—it was a bit of a struggle for me to really understand what was going on.

The most applicable examples that I looked at were pytest-selenium and pytest-base-url.

pytest-selenium and pytest-base-url

The main purpose of the pytest-selenium package is that it takes care of the setup and tear down processes for you.

The selenium fixture essentially instantiates and return a webdriver instance.

The fixture also closes the instance for you at the conclusion of your test function.

If base_url is defined in a config file or passed in as a command line argument, pytest-selenium will use this value and load the page automatically at the execution of your test function.

Using pytest-selenium can simplify something like this:

from selenium import webdriver

def test_python_page_title():
    driver = webdriver.Firefox()
    assert "Python" in driver.title

to this:

def test_python_page(selenium):
    assert "Python" in selenium.title

While pytest-selenium has many more capabilities, and is a complex package, this seems to be the primary purpose, at least as I understand it.


pytest-axe is a pytest fixture similar to pytest-selenium, albeit it is extremely simple in comparison.

This package takes a selenium instance and instantiates an instance of the Axe class for you.

It also finds the axe.min.js script in the axe-selenium-python package, and Axe sets it as a class-level variable in its constructor.

I decided to create this fixture to make it easier for users to integrate my axe-selenium-python API into their test suites.

The easier it is to use, the more likely people are to use it.

To illustrate just how basic this package is, this code is the entire functionality of the plugin:

import pytest
from axe_selenium_python import Axe

def axe(selenium, base_url):
    """Return an Axe instance based on context and options."""
yield Axe(selenium)

I originally implemented this fixture by adding it to within the test files in my axe-selenium-python package.

Again, I was surprised at how easy it was to get this to work. It did take some fiddling around, but altogether, very little time was spent on this.

I moved this fixture into a package by itself, because I don’t want users to have to manually add the fixture into their file.

At best, this would be quite annoying. More than likely, people just wouldn’t use it.

Mozilla Internship: Writing a pip Installable Package

Designing for the User

The first part of this project was to create a rough draft of the package, and a set of both unit tests and integration tests.

For the first several weeks, I only used the package locally from the project folder, which turned out to be much easier than writing a working, pip-installable package.

So that was the next goal to accomplish—but I also wanted to ensure to follow best practices and maintain stability.

These tasks presented many issues I had not yet considered, and many of them I did not (yet) know how to answer.

Writing a package that will be used by other people poses an important question.

“How will other people use this module, and how do I make it most useful to them?”

Continue reading “Mozilla Internship: Writing a pip Installable Package”

Mozilla Internship: Translate Java to Python, Pt. 2

Continued from Part 1

While I began writing my package as a direct, one-to-one translation of the Java package, my package turned out to look very different.

Java and Python are, after all, very different languages. I found some methods to be unnecessary in python, and chose to not use the same design pattern as axe-selenium-java.

The Java package, written by Deque Labs, uses the Builder design pattern.

I wrote the methods used by the Builder class to be methods of the Axe class instead.

Continue reading “Mozilla Internship: Translate Java to Python, Pt. 2”

Mozilla Internship: Diving into Test Automation with Python

pytest python pytest-html

Test Automation with Python

The first week of my internship was spent primarily setting up my dev environment on the laptop I received.

I had also never used a Mac before, so there were some basics to learn as well.

Although, since MacOS is Unix-based now, all of the important things were pretty much the same.

(I’m worthless with a Windows command line)

Once I had everything configured, I started fiddling with python and pytest.

I’ve done some development in python, like a scrabble-esque game, but I’d never written tests in python before.


In order to automate regression testing for accessibility, we need an API of some sort.

I did some research on the available web accessibility APIs before settling on the axe-core API.

The axe-core API was created by Deque, a company that specializes in accessibility.

Deque offers assessment services, certifications, and more.

axe-core is written in JavaScript and distributed as an an npm package.

Eventually, I will create a more seamless integration of axe-core into python, by writing a python library.

DequeLabs did this with Java in their tool axe-selenium-java.

To get started, though, I will be using Selenium’s execute_script() function to handle the JavaScript directly.

Continue reading “Mozilla Internship: Diving into Test Automation with Python”

Mozilla Internship: An Introduction to Web Accessibility

Introduction to Web Accessibility


Some background: GNOME’s Outreachy internship program is targeted at underrepresented groups in tech.

A variety of open-source companies are involved.

An employee of those companies can volunteer to be a mentor, and they design an internship with a particular topic and goal.

Those who are both interested and eligible submit applications for that internship.

The goal of the internship I was selected for is to automate regression testing for web accessibility.
Continue reading “Mozilla Internship: An Introduction to Web Accessibility”

fortune | cowthink

( If one cannot enjoy reading a book over )
( and over again, there is no use in      )
( reading it at all.                      )
(                                         )
( -- Oscar Wilde                          )
        o   ^__^
         o  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Scrape Stack Overflow Jobs Using Scrapy | Python Tutorial

scrape stack overflow jobs
1. What the Hell is Scraping, Anyway?
2. Install Scrapy
3. Write Your First Script
4. Put It To Work!
For this tutorial, we’re going to write a Web Spider to scrape Stack Overflow Jobs.

1. What the Hell is Scraping, Anyway?

Web scraping (web harvesting or web data extraction) is data scraping used for extracting data from websites. Web scraping software may access the World Wide Web directly using the Hypertext Transfer Protocol, or through a web browser.

While web scraping can be done manually by a software user, the term typically refers to automated processes implemented using a bot or web crawler.[1]

What’s a “Web Spider”?

A Web crawler, sometimes called a spider, is an Internet bot which systematically browses the World Wide Web, typically for the purpose of Web indexing (web spidering).[2]

Continue reading “Scrape Stack Overflow Jobs Using Scrapy | Python Tutorial”

fortune | cowthink

Good Morning!

( You look like a million dollars. All )
( green and wrinkled.                  )
        o   ^__^
         o  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||