Photo by Ross Sneddon on Unsplash

One of the things that makes Selenium code better is having many small, single-purpose classes instead of fewer large, multiple purpose ones.

It is common for testers that just started Selenium automation to use utility classes as containers for many, unrelated common methods.

This leads to less duplicated code and shorter tests.

Unfortunately, this approach is not correct.

Let’s see an example.

I will use the following site to implement a test case: https://todomvc.com/examples/angularjs/#/

The test case is very simple:


Photo by Brett Jordan on Unsplash

Everyone goes through interviewing for new jobs once in a while.

If you are a consultant, you probably apply for new jobs once a year or more. As permanent employee, looking for a new job happens less, maybe every few years.

Not many people like the interviewing process. It is stressful every time as it elicits lots of emotions in the candidate. Like fear when he goes through interview after interview and no offer is made. Or inadequacy when realizing that the new positions require skills that he no longer has. …


Photo by Jeff Sheldon on Unsplash

If you are using Protractor for test automation of Angular sites, I have bad and good news for you.

First, the bad news.

Protractor will be retired at the end of 2022 as it became incompatible with the latest version of the Selenium WebDriver framework.

Protractor is built on top of the Selenium WebDriver bindings for Node.JS and unfortunately the latest version of these bindings introduced changes that are difficult to use in Protractor.

Read the announcement here.

If you have lots of UI tests built with Protractor, this is obviously not good news.

You will have to migrate the…


Photo by Greg Rakozy on Unsplash

As a continuation of the article on the reasons of using Java for Selenium automated tests, let’s try to answer a similar question for Javascript.

Why are you using Javascript for writing Selenium tests?

Before reading more, think for a few minutes how would you answer this question in an interview.

Javascript is a great choice as programming language for automation projects.

It is ranked on 2nd position in the list of most loved programming languages in 2020 (as per the 2020 Stack Overflow survey).

Actually, Typescript is on 2nd position (Typescript = static typed Javascript). …


Photo by Charles Deluvio on Unsplash

Indeed, why not a different programming language?

Such as Javascript.

Or C#.

Or Python.

What is so special about Java?

Assume that you are interviewing for a new position and have to answer this question.

What’s your answer?

This is what I would say.

First, Java is on high demand on the local job market. At least, where I live, it is. It is probably as much on demand as Javascript. Most automation jobs for UI/mobile/API require Java. So, for finding a new job, Java knowledge is very useful.

This applies also to hiring new people. There are many SDETs…


Photo by Samantha Gades on Unsplash

Short answer: the site should be designed in a way that allows easy and efficient test automation to be implemented.

Simplicity always helps.

The long answer follows.

The majority of times I was involved in a web test automation project, implementing test automation was not easy because the site design was not appropriate. In other words, the site was implemented without thinking on how test automation will be done.

When is the site design not appropriate?


What makes an automated test more clear?

By automated test, I understand any test that automates a test case so the test can be for the UI, for an API or anything else.

An automated test is clear if it is short and it is written from the user’s point of view.

An automated test is clear if it is written at a higher level of abstraction.

An automated test is clear if it is independent of other tests.

It is clear if it has a limited number of assertions.

And …….

It is more clear if the assertions are…


What is wrong in this Selenium code snippet?

public void waitUntilElementIsClickable(WebElement element)
{
driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.elementToBeClickable(element));
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}

At a first glance, the code seems correct.

The first line changes the timeout of the implicit wait to 0 so the implicit wait is disabled.

Then, an explicit wait and an expected condition are used for waiting until an element is clickable.

The last line changes the timeout of the implicit wait to 10 seconds so the implicit wait is enabled again.

At a second glance, lots of things are wrong.

To understand them…


Photo by amirali mirhashemian on Unsplash

“All you can eat” restaurants are bad for you because you will eat much more than needed and because the food quality is low.

“All you can drink” pubs are bad for you as well for similar reasons. You will drink too much of low quality drinks.

Then, can “All You Can Learn” courses be beneficial for you?

If your answer is yes, this article is not for you.

If you are not sure, then read along.

“All you can learn” courses are defined by a few things.

They do not teach a narrow set of skills such as programming…


Photo by Rod Long on Unsplash

What is independent?

Independent of each other.
If a test depends on another test and the other test fails, the current test may fail as well. Or it may be ignored.

If a test does not depend on any other test, it will run every time.

Independent of development environment.
The test should run on the development environment, on the test environment, on the staging environment with no changes.

Independent of language.
The test should run not only in the main language but in any other language that the site supports.

Independent of the browser.
The test should work in the…

Alex Siminiuc

Blogs about Selenium and Java at https://seleniumjava.com.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store