• Trusted by:

Hire Selenium developers and engineers

Luke Sapan, United States

Member since July 7, 2015
Luke is an efficient and passionate software engineer with more than 10 years of programming experience. He is great with solo projects as well as team collaboration. Luke loves full-stack web development and his recent projects exemplify this in the field of administration. Luke is currently working in a senior engineering position. Click to continue

Vladimir Ilmov, Russia

Member since January 2, 2015
Vladimir is a highly skilled Java developer focusing primarily on web applications. He has diverse experience in different operating systems, program languages, and platforms. He is currently learning about Scala, non-stop garbage collectors, and hot swap code replacement. He enjoys dancing in his free time. Click to continue

Jean Christian Daudier, United States

Member since February 16, 2014
Jean Christian is a full stack software engineer balancing timely delivery with code quality. He has an Agile and test-driven mindset with knowledge of dynamic and static languages, and object-oriented and functional programming paradigms. He works well both with team members and alone. Click to continue

Stratos Nikolaidis, Malta

Member since November 11, 2013
Stratos has over 15 years of experience as a professional programmer and is an established software engineer. His next goal is to become a software architect and consultant. His deep knowledge, experience, and technical and communication skills will enable him to face any challenge. Click to continue

Aleksandar Nikolic, Serbia

Member since June 2, 2014
Aleksandar is a senior web developer and system architect. He is highly motivated, dedicated to delivering high quality code, and continuously improving on every project. He prides himself on efficiency, has worked with numerous tools, and has completed a variety of projects over the past 10 years. Click to continue

Alexey Shein, Uzbekistan

Member since January 28, 2015
Alexey is a talented software engineer with more than eight years of web development experience including Ruby on Rails, PHP, and JavaScript. He enjoys solving difficult technical problems and learning new technologies. He is a good mentor and likes helping teammates. Click to continue

Chris Gunawardena, Italy

Member since January 30, 2015
Chris is a developer/solutions architect with over 12 years of experience working for Accenture, Cricket Australia, RMIT University, and Sportsbet. He is a full-stack developer capable of DevOps and automated testing as well as creating cutting-edge web applications. Click to continue

Andrey Adamovich, Latvia

Member since November 19, 2014
Andrey has over fifteen years of professional software design and development experience in a variety of industries. He has a great deal of programming language and technology knowhow, and over the past three years has specialized in software delivery process automation, DevOps, and performance-oriented software architecture. Click to continue

Oscar Guindzberg, Argentina

Member since December 31, 2013
Oscar is a software engineer with 15+ years of experience in the UK and Argentina. He is a Bitcoin & Java expert, co-founder of CreationFlow, and a former university object-oriented design teacher. Click to continue
Selenium Resources
Trustpilot
Toptal on TV
"Toptal is killing it, it kind of owns this market."
Andrew Ross Sorkin Reviews Toptal
Cnbc 02e66b
"Tech companies simply cannot find the quality employees they want to hire. The solution: Toptal."
Liz Claman´s Review of Toptal
Fox 7ef901
Toptal in the press
“Despite accelerating demand for coders, Toptal prides itself on almost Ivy League-level vetting.”
Selina Wang
“Toptal allows corporations to quickly assemble teams that have the right skills for specific projects.”
Steven Norton
A hiring guide
The Vital Guide to Selenium Developer Interviewing

Testing web applications and sites can be a daunting task, especially if you don’t have the right tools. Selenium aims to streamline this as much as possible, and having an expert Selenium automation engineer can tremendously benefit your project's development.

Testimonials
“I am more than pleased with the experience with Toptal. It may cost a little more, but because they pre-qualify and hand-pick the professional best suited for the job, it's well worth it. The professional I got to work with was on the phone (Skype) with me within a couple hours. I knew after discussing my project with him that he was the candidate I wanted to do the job, and I hired him immediately... and he wasted no time in getting to my project. He completed the job and went the extra mile to clean up older, messy code and even added some great design elements that enhanced our overall look. I would highly recommend Toptal to anyone needing to hire a professional. Great company. Great service. Thank you, Toptal.”
Paul Fenley
Director @ K Dunn & Associates
“I really enjoyed my experience with Toptal. Searching for a developer was both painless and engaging, and the first match was a perfect fit! Toptal is a fantastic way to find talented developers for small or large aspects of your project.”
Willem Shepherd
Creative Director @ Mookieyams
“I needed help, and fast. I did not want to hire a random coder I met online- I was worried about security, and many other issues. Toptal was there when I needed them- and has been fantastic to work with. Outsourcing is full of terrible stories- Toptal is the story that is the giant exception. I give them my highest recommendation.”
Michael Feder
Founder & CEO @ PrayerSpark
“With Toptal, we are able to find talented developers in a matter of weeks instead of months. The quality of talent they supply is extremely high as the developers are able to immediately onboard and ramp incredibly fast.”
Zac Carman
CEO @ ConsumerAffairs
“Toptal offers a no-compromise solution to businesses undergoing rapid development and scale. Every engineer we've contracted through Toptal has quickly integrated into our team and held their work to the highest standard of quality while maintaining blazing development speed.”
Greg Kimball
Co-Founder @ Nifti
“We had a wonderful experience with our Toptal consultant. He was very reliable and punctual, delivering excellent work on a budget—we will certainly be using him again!”
Barbara Karpf
President @ DecoratorsBest
“I’m a big believer in the saying, ‘hire smart, or manage tough’. For us non-hackers, Toptal takes the guesswork out of hiring. Their coders are vetted, and the work is guaranteed. Why look anywhere else?”
Greg Archbald
Founder & CEO @ Greasebook
“We had a great experience with Toptal. They paired us with the perfect developer for our application and made the process very easy. It was also easy to extend beyond the initial time frame, and we were able to keep the same contractor devoted to the project. We definitely recommend Toptal for finding high quality talent quickly and seamlessly.”
Ryan Morrissey
CTO @ Applied Business Technologies, LLC
“Getting set up with Toptal and finding a new team member was so easy, I don't know why anyone wouldn't give it a try. Best of all, we no longer have to worry about finding great people to help with our projects!”
Mike Branch
President & CTO @ HarborSI
“We've used Toptal developers multiple times for multiple projects, and they've always been world-class—regardless of whether they've been from South Africa, Brazil, or the United States.”
Alex Haro
CEO @ Life360
“We've been incredibly pleased with our experience working with Toptal thus far. Their team worked quickly and efficiently to isolate the needs of our project, and they paired us with an appropriate developer within a couple days who we quickly contracted after a great interview. The work performed on our project was top-notch, and we can’t wait to make use of Toptal’s resources again.”
Ryan Staake
Owner @ Pomp&Clout
“Toptal developers deliver. Hiring my first developer on Toptal was such a pleasant experience that I quickly turned around and hired another. Every developer I've hired on Toptal has been professional, skilled, and self-managing—a pleasant departure from the typical freelancer marketplace.”
Mike Riess
Owner @ RiessGroup
“Prior to working with Toptal, we had a very difficult time finding qualified developers. The Toptal team worked with us to find a developer that was a great fit in terms of technical skills, culture, and finances. Our Toptal developer is four months into this project and we are still impressed with the attention to detail and technical prowess that he brings to our team.”
Justin Fister
Chief Scientist @ PaperRater
“I can't say enough about how happy and confident I am in working with Enrique. He brings an enthusiasm to his profession that is very refreshing, constantly surprising us with his depth of knowledge and his capability to not only complete the task, but to surpass our expectations. He presents us with solutions that we would not have thought about ourselves, and sees the problem better than we can explain it.”
Chad Berryman
Senior Technical Lead @ Zoomedia
“Toptal understood our project needs immediately. We were matched with an exceptional freelancer from Argentina who, from Day 1, immersed himself in our industry, blended seamlessly with our team, understood our vision and produced top-notch results. Toptal makes connecting with superior developers and programmers very easy.”
Jason Kulik
Co-Founder @ ProHatch
“Toptal has helped my business tremendously by finding, vetting, and recruiting the talent I need, at the right time. I’d definitely recommend it to others.”
Xavier Xicay
CEO & Creative Director @ Tuatara Corp
“Best talent is here for sure. Toptal hiring and overall working experience has been wonderful. This is way better and faster than any other means of getting top talent.”
Rajesh Nagarajan
Co-Founder & CTO @ maxMantra
“I've been very happy with Juraj. He is efficient, writes great code, and is an extremely nice guy to work with. Most importantly, he is self-motivated. In just his initial pass at the code base, he has contributed several optimizations and stability improvements. Regarding Toptal as a service…well, you matched us up with Juraj without me having to sort through a list of candidates, so I’m impressed.”
Matt Cotton
Dev Team Lead @ eFolder
Hire a top Selenium developer now.
Toptal is a marketplace for top Selenium developers, engineers, programmers, coders, architects, and consultants. Top companies and start-ups choose Toptal freelancers for their mission critical software projects.
Full
profile
Luke SapanUnited States
Luke is an efficient and passionate software engineer with more than 10 years of programming experience. He is great with solo projects as well as team collaboration. Luke loves full-stack web development and his recent projects exemplify this in the field of administration. Luke is currently working in a senior engineering position.
[click to continue…]
SeleniumPythonSwiftSQLObjective-CCSSJavaScriptiOS SDKAndroid SDKDjango RESTDjangojQueryiOS
Hire
Full
profile
Vladimir IlmovRussia
Vladimir is a highly skilled Java developer focusing primarily on web applications. He has diverse experience in different operating systems, program languages, and platforms. He is currently learning about Scala, non-stop garbage collectors, and hot swap code replacement. He enjoys dancing in his free time.
[click to continue…]
SeleniumJavaSQLPostgreSQLWebLogic
Hire
Full
profile
Jean Christian DaudierUnited States
Jean Christian is a full stack software engineer balancing timely delivery with code quality. He has an Agile and test-driven mindset with knowledge of dynamic and static languages, and object-oriented and functional programming paradigms. He works well both with team members and alone.
[click to continue…]
SeleniumC#SQLASP.NET Web APIASP.NET MVCVisual StudioAgile Software DevelopmentSQL Server
Hire
Full
profile
Stratos NikolaidisMalta
Stratos has over 15 years of experience as a professional programmer and is an established software engineer. His next goal is to become a software architect and consultant. His deep knowledge, experience, and technical and communication skills will enable him to face any challenge.
[click to continue…]
SeleniumDelphiJavaScriptPHPCSS3SQLGitWordPressMySQLKalipso Mobile Development
Hire
Full
profile
Aleksandar NikolicSerbia
Aleksandar is a senior web developer and system architect. He is highly motivated, dedicated to delivering high quality code, and continuously improving on every project. He prides himself on efficiency, has worked with numerous tools, and has completed a variety of projects over the past 10 years.
[click to continue…]
SeleniumSQLJavaScriptPHPSymfonyjQueryAgile Software DevelopmentMySQL
Hire
Full
profile
Alexey SheinUzbekistan
Alexey is a talented software engineer with more than eight years of web development experience including Ruby on Rails, PHP, and JavaScript. He enjoys solving difficult technical problems and learning new technologies. He is a good mentor and likes helping teammates.
[click to continue…]
SeleniumCSS3SQLJavaScriptHTML5PHPRubyRuby on RailsjQuerySQLiteGitAJAXMagento
Hire
Full
profile
Chris GunawardenaItaly
Chris is a developer/solutions architect with over 12 years of experience working for Accenture, Cricket Australia, RMIT University, and Sportsbet. He is a full-stack developer capable of DevOps and automated testing as well as creating cutting-edge web applications.
[click to continue…]
SeleniumPHPCSSSQLJavaScriptYii FrameworkBootstrapAngularJSNode.jsjQuerySocket.IOAngularUIGitHub
Hire
Full
profile
Andrey AdamovichLatvia
Andrey has over fifteen years of professional software design and development experience in a variety of industries. He has a great deal of programming language and technology knowhow, and over the past three years has specialized in software delivery process automation, DevOps, and performance-oriented software architecture.
[click to continue…]
SeleniumSQLGroovyJavaSpringHibernateAgile Software DevelopmentDevOpsJava EEJava SEJava concurrency
Hire
Full
profile
Oscar GuindzbergArgentina
Oscar is a software engineer with 15+ years of experience in the UK and Argentina. He is a Bitcoin & Java expert, co-founder of CreationFlow, and a former university object-oriented design teacher.
[click to continue…]
SeleniumJavaSpring SecuritySpringSpring MVCJavaServer PagesSpring Social
Hire

The Vital Guide to Selenium Developer Interviewing

The Selenium project was born out of everyday work that Jason Higgins, Paul Gross and Jie Tina Wang did for ThoughtWorks some time during 2004. While showing Selenium to their colleagues, Paul Hammant saw big potential, and suggested open-sourcing Selenium and making it work in a driven mode which would make it accessible to other programming languages. Since it was open-sourced from the early days, a lot of people contributed to make it the robust web automation tool as it is today.

Selenium IDE also played a great role in making Selenium project as popular and widespread as it is. Created as a Firefox plugin by Shinya Kasatani, this tool enabled users to record and then play back their browser actions as a set of Selenium core commands inside the browser. They could then save those actions to a file and reuse them later as a self-contained script.

Selenium: More than a Safety Net

Selenium: More than a Safety Net

Version 1 proved to be an interesting framework, and that opened the eyes of many people regarding the automation process. Version 2 built upon that, introduced WebDriver as an interface, and is about to become W3C standard. Selenium’s WebDriver architecture was also used as a starting point for mobile testing frameworks such as Appium, Selendroid and iosdriver.

Selenium Library

Selenium makes automating web applications and sites a streamlined process. It uses methods for finding web page elements with selectors available in HTML4/HTML5/CSS standards. That way, whole burden of manually testing web application can be eased with the use of a few clever scripts. Selenium WebDriver interface makes it possible to use any modern browser and automate web sites and applications using HTML/CSS selectors that interact in a manner similar to a real user using their browser - just a tad faster.

Selenium actually consists of three separate components:

  • Selenium WebDriver (Selenium 2)
  • Selenium IDE
  • Selenium Remote Control

Selenium WebDriver knowledge is the key skill required, writing tests using Selenium driver is what we are looking for. Selenium Remote Control is a part of Selenium Server, a component that allows Selenium browser tests to run in parallel on dedicated servers grid, and is only an additional component for building an automated system.

While Selenium IDE is nice for new users and for quickly trying out how Selenium or system under test actually works, it cannot be considered as a tool that will get the job done completely, since for a bigger project with a lot of functionalities there needs to be a lot of tests organized in a logical and readable manner. To create Selenium automated tests, coding skills, architectural skills, and technical knowledge are required, as is the case with any development process.

Questions and Answers

Selenium was made to be an easy-to-use framework by design, so that people with less technical experience can use it for regular needs. Anyone can actually write a script using Selenium IDE without even leaving the browser. But there is actually more than just a fine line between someone who can use it, someone who is good with it, and someone who mastered both Selenium development and testing process. Selenium developers need to be more than just coders in most of the cases. In the following sections we are going to see which of those skills can be evaluated when choosing the perfect candidate.

To Automate or Not to Automate

While debate about automation reach is still on, no one can deny Selenium’s identity as the de-facto standard for web automation and its great impact on testing world. Some organizations have gone automation-crazy, and are not employing anyone without background in automation and development. QA Developers, Software Engineers in Test (SET) or however called by different organizations, empowering various tools (including Selenium) into the context of a system under test are quite in demand nowadays, and that trend will continue as long as development cycles are as fast as they are, and as web software becomes more and more sophisticated.

There is also another question that arises: is there a need for a dedicated Selenium developer? One could argue that a developer who coded an application and its features can also create automated tests using Selenium. And, in a lot of cases, that may be true.

There is no straight-forward answer to this question, since it depends on a lot of different factors such as project size, solution complexity, manpower, and deadlines. If a web application developer needs to spend half of his working time automating and coding tests, that is not exactly being efficient. A dedicated Selenium developer with experience will spend much less time automating, will know from the beginning how to organize code in best way, and will also create a quality layer of tests. They can also give insights and tips about making these features act more user-friendly and efficient. Covering edge cases and situations that are not easy to test without automation can help create another layer of security for the end product. It just depends on how determined you are about the final quality of a product and making it work as it should from day one.

Q: Is it always appropriate to automate a project and all of its features?

While it cannot be denied that automation can be quite usable in everyday development, there are situations in which automation is not appropriate, or even possible. Also, taking into consideration the test pyramid, it is not advisable to have too many automated UI tests and to depend a lot on them, since all major application features have to be covered on levels beyond (unit, services). Therefore, only crucial application features need to be tested using UI coverage. Some of the minor app functionality can be tested unattended by going through major application workflows and using specific unit tests for those components.

QA, Developer or Both?

Q: How are you seeing yourself predominantly, as the developer or QA?

What you are looking for is neither QA nor developer in their strict sense. In a world of continuous development, you are looking for a person who posses a wide range of skills that fits the agile development philosophy. That is especially the case with Selenium developers, maybe even more than with any other role in your team. They are certainly not traditional QA’s, and most of the time, they are not producing any code that is worth releasing out through the company doors. What they do is provide support code that can be crucial for cutting down testing time and expenses, and giving the product a support that goes well beyond just regular testing efforts.

They need to have QA skills nonetheless. Creating valid and meaningful test scenarios, testing edge cases, and then coding them as scripts should be a part of their everyday work. Selenium developers need to understand complex business logic and rules, because that is one of the requirements for making automation effort really worthwhile.

Selenium developers should not fear about getting their hands dirty doing manual testing, because let’s face it, you can automate a lot, but you don’t have to automate everything. Manual testing is still more than valid in situations where automated testing is not efficient and where human judgement is providing more information than a computer can provide. Computers are good in execution, but not in making judgements. So use humans for what they are best at. Automation starts where manual testing ends. Automation using Selenium WebDriver is always a successor of manual work, as it further validates good judgements made while manually testing an application.

Language-gnostic

Q: What language do you prefer when writing Selenium tests?

Selenium WebDriver is ported to many popular languages, so if you are looking for a Selenium expert, you don’t have to worry much about the language he uses. Unless of course, it is crucial to the actual business or company’s policies. Driver libraries are available for Java (native), C#, Python, Ruby and JavaScript. It should be quite easy for a seasoned Selenium developer to switch to any of the different languages. The driver libraries’ APIs are almost identical, leaving the emphasis on the languages best coding practices.

Let’s see how these differences look in practice:

Java:

import org.junit.AfterClass;
import static org.junit.Assert.*;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class TestToptal {
    private static FirefoxDriver driver;

    @Before
    public static void initializeDriver(){
        driver = new FirefoxDriver();
    }

    @Test
    public void testTitle(){
        driver.get("https://www.toptal.com");
        assertEquals(driver.getTitle(), "Hire the top 3% of freelance developers, designers, and other tech talent.");
    }

    @After
    public static void closeBrowser(){
        driver.quit();
    }
}

Ruby:

require 'selenium-webdriver'
require 'minitest/autorun'

class TestToptal < Minitest::Unit::TestCase
  def setup
    @driver = Selenium::WebDriver.for :firefox
  end

  def test_title
    @driver.get 'https://www.toptal.com'
    assert_equal @driver.title, "Hire the top 3% of freelance developers, designers, and other tech talent."
  end

  def teardown
    @driver.quit
  end
end

Python:

import unittest
from selenium import webdriver

class ToptalTest(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.driver = webdriver.Firefox()

    def test_title(self):
        self.driver.get("https://www.toptal.com")
        self.assertEqual(
            self.driver.title,
            "Hire the top 3% of freelance developers, designers, and other tech talent.")

    @classmethod
    def tearDownClass(cls):
        cls.driver.quit()

As you can see for yourself, the differences are minor, and expect for the actual amount of code needed to be written.

HTML + CSS

It is a fact that one could automate web page or application testing using Selenium WebDriver without having any HTML or CSS skill. Selenium can provide selectors and action specifications, and these can be used directly. But there is a big advantage if the candidate has knowledge and understanding of HTML and CSS.

Q: How would you rate your HTML & CSS knowledge?

Even intermediate HTML and CSS knowledge could prove beneficial for Selenium developers dealing with the web application or site under test. Especially when it is a bit more markup heavy or complex.

Another benefit of knowing those two technologies is that it allows the Selenium developer to help front-end developers in a much more direct manner, or even by doing code reviews. Speaking from experiences of many organizations, involving project members into each other’s code proves to be beneficial to whole development process.

Q: What is CSS? How can it be used in test automation context?

CSS or Cascade Style Sheets is a declarative language that describes HTML presentation to end client. With CSS, plain HTML pages are rendered as beautifully styled documents.

While they may not be that important for actual test automation, a Selenium developer’s knowledge of CSS can help them choose better selectors. They can also use CSS attributes for advanced assertions if needed. They can help identify poorly written CSS so that front-end developers can fix them.

Q: Briefly describe the HTML4 page layout.

Every web page consists of at least a head and a body tag wrapped inside the HTML root element. While head holds some page specific metadata, everything relevant to the actual user interface is inside body tag, and is visible to the end user.

Selenium developers will spend their programming life inside the body tag, finding out the best ways to locate elements and do various manipulations and assertions.

Q: Is there any difference if a page is using HTML5 from a test automation standpoint?

No. HTML5 uses a specific set of tags in order to have more standardized and well annotated page layouts, but this has little to no effect on the actual test automation process. Although, this is also dependant on actual the web application being tested.

Q: What is HTML DOM?

Domain Object Model, or in short DOM, is a programming interface for the HTML page, and is constructed every time a page is loaded. It is a tree representing elements of a page as objects with their own properties, methods for manipulation and events that they react to. By using HTML object model, pages and their elements can be manipulated using JavaScript.

Advanced Web Browser Knowledge

It is quite important that a Selenium developer not only knows how to code, but also knows about browser capabilities. Firefox, Chrome, IE (Edge), Safari etc., all of them have subtle differences regarding page loading, element rendering and inner mechanics of how they process pages. One has to know all their quirks to be able to bend these tools to their needs. Selenium developers do not need to be exactly on a developer’s level of knowledge, but they need to know more about the browsers than any regular user. And this includes the use of tools that the browsers provide, such as Developer Console, Network Traffic, Performance tools and so on.

For example, Chrome has configuration profiles, which can be used for developers advantage, as a way of setting up test sets before each run, like loading of images on sites, working with different directories for downloads, turning off advanced or standard browser features. Same thing with Firefox, which has a similar set of hidden and not-so-hidden options in its arsenal. Mastering these will make developers life as an automation engineer much easier, and are quite important for testing the application in various scenarios.

Browsers of today are like mini operating systems (some people even tend to look at them that way) that have a lot to offer, and most of the regular computer users are seeing them as the single most important piece of their software, without even knowing they are not an integral part of it. Master them for a more joyful automation life.

JavaScript is a Friend in Need

It is also a big advantage if the candidate knows JavaScript. There are situations where JavaScript can be the only way of automating parts of application workflow. In 95% of cases, it is not required. But it can still be a distinguishing factor, specifically if the project is JavaScript heavy. Since it is possible to run or trigger JavaScript in the context of the Selenium WebDriver, making it part of the automated solution is a straight-forward process.

A lot of modern projects are using JavaScript almost exclusively for both backend (server side) and front-end (client side) development, and having that knowledge keeps Selenium developers in sync with the rest.

Selenium developers can also help review JavaScript code and help fix bugs or find them before they strike. And that is something which could become invaluable for your team and its success.

Q: How would you call a JavaScript object or method using Selenium Driver?

It is possible to call JavaScript directly in the driver’s context using JavascriptExecutor class in Java, and similarly in other languages. Script can be executed synchronously or asynchronously:

// ...
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.firefox.FirefoxDriver;
// ...

WebDriver driver = new FirefoxDriver();
JavascriptExecutor js;
if (driver instanceof JavascriptExecutor) {
    js = (JavascriptExecutor)driver;
}
js.executeScript("return document.getElementById('myid');");
// ...

This way, you have access to the entire HTML DOM and can also call any script or object that is already a part of the page.

General Programming Knowledge

Selenium IDE made Selenium extremely simple for any beginner wanting to dive quickly into web automation. But to make efficient and reliable scripts, it is much better to have code organized into re-usable units. While it is possible to use Selenium IDE for recording and playing back actions, it is quite a nuisance to sustain that code through agile development, where a lot of features are changed rapidly and frequently. So, if you are looking for an expert, you are looking for someone who is also a good developer.

Q: How should you organize automation code?

It is also a big advantage if Selenium test code is organized using Page Object pattern, that is discussed a few paragraphs later. Test code that are decoupled from support code can further improve maintainability. There are few guidelines though:

  • Keep custom support libraries out of actual test code
  • Make workflow helper methods that can be reused between tests
  • Use Page Objects to organize code
  • Remove old irrelevant code
  • Remove tests that are already covered while adding new functionality

Since automated tests change quite fast, it’s advisable to change it as fast as development goes.

Testing Libraries to Wrap Tests Up

A big part of organizing test code actually involves the use of test unit/spec/features library that will make test assertions and checks a part of the workflow. It is possible to do actual test scripts without them, but they do provide an additional level of control, especially if project is using CI (Continuous Integration) servers as part of the development process.

Q: What is your experience with testing libraries?

Testing library selection will vary depending on programming language that is actually being used. But they share one common element: asserting that an action performed by Selenium produced expected results, be it a web element being displayed, text being rendered or anything else that can happen on the browser’s interface. Some of the most popular libraries by languages are:

  • Java: jUnit, TestNG
  • Ruby: rspec, minitest
  • Python: py.test, unittest, nose

Q: Do you have experience writing Cucumber features?

One interesting library that deals with features is Cucumber, where tests specified in a way similar to business specifications that even people with no technical knowledge can read and understand:

Scenario: Downloading business report
  Given I am signed in as manager
  When I search for "latest report"
  Then report list should contain "report from last day"

This way, tests become even more communicative, while programming implementation is kept out of business requirements. This is a skill that cannot be emphasized more if you have lots of stakeholders that want to be involved in testing, and who do not have actual technical skills to interpret code by themselves.

Page Object Pattern

Q: Have you used Page Objects? How are they useful?

Introduced in Java Selenium library version 2, Page Object pattern is a great way for organizing code into reusable classes. Consider part of the code code below that is automating Toptal site application:

driver.findElement(By.CssSelector("div[data-role='custom_field']")).click();
driver.findElement(By.CssSelector("div[data-value='Developer']")).click();
driver.findElement(By.Id("talent_email")).sendKeys("selenium.dev@toptal.com");
driver.findElement(By.Id("talent_password")).sendKeys("mypassword");
driver.findElement(By.Id("talent_password_confirmation")).sendKeys("mypassword");
driver.findElement(By.Id("talent_full_name")).sendKeys("Selenium Dev");
driver.findElement(By.Id("talent_skype")).sendKeys("selenium.dev");
driver.findElement(By.Id("save_new_talent")).click();

It does the work, but it is not likely to be reusable or easily extendable if that workflow changes for any reason. Using Page Object pattern, this simple test becomes a highly reusable class that can be initialized and used in multiple tests:

package com.toptal.common.pageobjects;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

public class SignUpPage {
    private final WebDriver driver;

    private By talentDiv = By.CssSelector("div[data-role='custom_field']");
	private By developerDiv = By.CssSelector("div[data-value='Developer']");
    private By designerDiv = By.CssSelector("div[data-value='Designer']");
    private By emailField = By.Id("talent_email");
    private By passwordField = By.Id("talent_password");
    private By passwordConfirmField = By.Id("talent_password_confirmation");
    private By fullNameField = By.Id("talent_full_name");
    private By skypeNameField = By.Id("talent_skype");
    private By saveTalentButton = By.Id("save_new_talent");

	public SignUpPage(WebDriver driver) {
		this.driver = driver;

        if (!verifyBasePageTitle) {
            throw new IllegalStateException("This is not the Sign Up page");
        }
	}

	public String getPageTitle() {
		String title = driver.getTitle();
		return title;
	}

	public boolean verifyBasePageTitle() {
		String expectedPageTitle="Exclusive Access to Top Developers and Designers | Toptal";
		return getPageTitle().contains(expectedPageTitle);
	}

    public SignUpPage selectTalent(String talent) {
        driver.findElement(talentDiv).click();
        if talent.equals(developerValue.text) {
            driver.findElement(developerDiv).click();
        } else if talent.equals(designerDiv.text) {
            driver.findElement(designerDiv).click();
        } else {
    	     driver.findElement(By.CssSelector(String.format("div[data-value='%s']", talent)).click();
        }
        return this;
    }

    public SignUpStepTwo applyAsDeveloper(String email, String password, String fullName, String skypeName) {
        driver.selectTalent("Developer");
        driver.findElement(emailField).sendKeys(email);
        driver.findElement(passwordField).sendKeys(password);
        driver.findElement(passwordConfirmField).sendKeys(password);
        driver.findElement(fullNameField).sendKeys(fullName);
        driver.findElement(skypeNameField).sendKeys(skypeName);
        driver.findElement(saveTalentButton).click();
        return new SignUpStepTwo(driver);
    }
}

What directly comes to mind is that Page Object makes most sense as an exact counterpart of what actually happens within browser when a user is working with it, like a mind that drives the page in pursuit of its goal.

There are different Page Object libraries for different languages, but they all have some things in common: they are making logical placement of all elements on page, and are also providing convenient methods for accessing any feature that is present on that page. They can also be used as routers, where Page Object are created after web application actions and chained in a logical structure that is same as one of the system under test. You can then combine them with wait states to create a sophisticated machinery that will drive your tests and contain all logic important for execution.

Although today there are a lot of sites and web applications that use single-page principle for rendering their content, page objects are still valid in most cases for at least having web elements organized in logical and clean way.

Q: Should Page Object be an exact copy of real page (have all elements as separate objects)?

No. Since there are usually a lot of elements on each page, only those elements that are necessary for creating workflow automation should be modeled inside a Page Object. Having every single element on page is actually quite counter-productive since it makes Page Objects big, clumsy, hard to maintain and almost unusable.

Q: Is it advisable to make assertions directly in page object?

It should be avoided. What Page Objects do best is keep and expose page structure and inner logic of a page through a clean API. One could make a Page Object verify some state of an element, but it should never assert directly.

Selenium Specifics

Q: Which element selectors are considered most optimal?

It is quite easy to create Selenium driver scripts that test some functionality. It is even easier to make it hard to change and support scripting code later, either by using complicated selectors that are too dependent on page structure, or not following Page Object pattern while developing test scripts. Best selectors are those that are most distinctive, and at the same time, simplest to follow as application grows and changes its layout.

For example:

driver.findElement(By.CssSelectors("div.some-section div.my-section > a#some-id"))

When you can just do simple selection:

driver.findElement(By.Id("some-id"))

This also begs another question: what selectors are actually best for locators of page elements? While pragmatic ones can say that anything that works is good enough, there is actually a hierarchy that is best to follow:

id > name > class >= css_selector > tag > text > xpath

This is also debatable, but to sum the logic behind it, IDs are locators that are most distinctive per page and therefore should be used first. Element names can also be quite distinctive. CSS classes are also great, especially on web pages that are well formed using distinctive CSS classes.

Sometimes it is highly desirable that actual link text is used as selector, since test could catch any typo or functional problem directly on interface while selecting a page element.

Q: Briefly explain advanced CSS selectors usage.

When everything else fails, advanced CSS selectors are the best bet in finding elements or groups of elements on a page. Here are some of the most frequently used ones:

  • Direct child: div > a
  • Child or subchild: div a
  • Specific id: div#myid a
  • Specific class: div.myclass a
  • Specific match: ul#mylist li:nth-child(2)

CSS selectors can also be used to search the content of a page, but that’s a topic of its own.

Q: What should you do when there are two elements that do not have anything distinctive?

Once in awhile there will be a situation where two elements on a page have every part of HTML / CSS tag that are exactly the same, including element text, but they do have different functionality that needs to be automated. There are multiple ways to solve this:

Use findElements method that returns a list of elements. Then it would be possible to access any element of the list by index

Use CSS / XPATH specific matcher and match exact occurrence of an element

Q: What will happen if an element selector is the same for multiple elements on page?

Only first occurrence of the element will be selected, and since page is read from top to bottom, that will be the element nearest to the top of the document.

Mastering Timeouts

Q: State the difference between explicit and implicit waits.

Web pages usually consist of a lot of different elements, such as links, paragraphs, buttons, input fields, text fields, combo boxes and custom objects. And most of them are loaded as soon as whole page is loaded, and they can be accessed almost instantly after being loaded. But there are situations where elements are loaded asynchronously, waiting for server response, or response from some external service provider.

When the only way that you could know if an element is available for automation is to wait for it to become fully loaded, Selenium WebDriver provides waits. They can be explicit or implicit. Implicit waits are like always waiting for 3 seconds before accessing an element or polling the DOM every 0.5 seconds to determine if a condition is met. Explicit waits check directly if an element condition is true, and pauses the script execution until that exact condition is met, throwing timeout error if it’s not met after a set duration.

Implicit:

driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

Explicit:

WebDriverWait wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.elementToBeClickable(By.id("myid")));

As you can see, the implicit wait is being done on driver level, so that whenever a new page opens, before actual element lookup is done, driver will wait for 5 seconds minimum. In reality, there are situations in which you will have to use a combination of both, although explicit waits are generally considered better practice. Implicit waits are definitely better in situations where tests can be made more reliable. Using explicit waits will make tests work much faster, which can also be quite important. Using waits wisely is the key. If the application is AJAX heavy, appropriate wait states are crucial for making automation work reliably.

HTTP Rules

So, what actually happens in a browser when you are navigating from page to page? Everything on web starts by making HTTP GET requests to the server and getting responses from them in many different forms, be it complete web pages, images, sounds or simple responses that hold data that is used in a context of application. The internet of today is a mixture of many technologies, but in its core, it’s still the same old HTTP protocol that is ruling Internet from its beginning. With a plethora of APIs from swarms of vendors, applications of today are much more interconnected that sometimes it is quite hard to isolate one application from the rest. There is a recent trend of making applications in two layers, an API layer with so called microservices (backend) and a UI level (frontend) as separate units of work that are communicating with each other. With that sort of separation, Selenium tests are actually becoming not only features, but sort of integration tests, and their value is becoming even more evident.

While it is not an urgent need for a Selenium developers to know a lot about HTTP, it can help them do automation in a lot of ways, especially if the application is using a lot of external APIs. He could record responses and then mock them inside tests for their speed and reliability, he could also make direct HTTP calls as they are part of application. He could even make separate tests for API application layer, using tools of his choice.

Q: Which methods are considered secure in browser?

For security reasons, only OPTIONS, GET, HEAD, POST, PUT, and DELETE are allowed inside web browsers. Methods such as TRACE and CONNECT are not allowed. Old browsers such as Internet Explorer had even more limited support for HTTP methods.

Q: How can the use of parameters in URL affect automation?

A lot of web applications are using parameters inside their URLs, and that can be great when testing something specific, without a need to go through complicated workflows of the application. Consider this example:

driver.get("https://www.toptal.com/companies/apply?interested_in=developers")

While it is desirable to automate the whole workflow to get to this point, it is also possible to manipulate the request and directly get parameter that you need for some other test:

driver.get("https://www.toptal.com/companies/apply?interested_in=designers")

By this approach, it would be possible to parametrize a test and verify conditional behavior without going through the whole application workflow.

Combine Selenium with Other Tools and Libraries

While you can do a lot by automating web sites and applications using Selenium WebDriver, there will come a situation where something more is needed. For example, you can combine Selenium automation with database tests, to verify if data is correctly stored inside database. You can even create test reports that are logging everything that was done inside automated tests and have it saved in various formats, for future reference or for CI reports.

Speaking of CI, it would be more than beneficial for Selenium developers to have knowledge about them. CI servers are there to run all kinds of tests, building application and packing them to self-contained bundles. One can use headless drivers / browsers, such as PhantomJS to run tests on CI servers, or use xvfb to run real browsers without actually running display servers. Whatever you choose, CI are invaluable for making test automation a tool that every member of team can rely on. Knowing how to set them up and prepare for running Selenium or any other kind of unit or integration tests can become crucial to the development’s success.

Communication

Programming is, in its core, communication. Not only between human and machine, but also between programmers themselves. Using code to communicate with each team member is one skill that is easy to overlook, because let’s face it, no one knows what tomorrow brings: someone else will join the project, some parts of application will miss documentation and no one will know how it was coded, or you will find yourself explaining parts of code you did before every time someone tries to use it. Unreadable code can leave you with that sorrow feeling that you or someone else should do it better in the first place. Documentation is great, but code itself needs to be clear and as communicative as possible.

For a Selenium developer, it is of utmost importance that they give their objective opinion about everything inside project, be it code, design, feature set and implementation, and to communicate that back and forth between each and every member of a team. That’s not as easy as it might appear, since we are all human, have our own opinions, have our own pride, and sometimes that mix can become an obstacle in making the right decisions and make project progress. Mastering communication is not something that can be taught in school, at least not as a part of any official studies. This is part of social intelligence, which not everyone has.

Knowing English well is a big part of online communication, especially in coding and when working on freelance projects. Therefore it is important to gauge the candidate’s language skills beforehand.

Wrap Up

Web projects of today cannot be seen without some sort of automation as their foundational parts. Using any of Selenium’s supported languages, well created automated tests and test suites can provide a safety net that ensures that any regression is caught before it hits production, and that development becomes reliable and a pleasurable process. Version 3 of Selenium is in the making, and it will be an evolution of an already established legacy. The question is not whether you should have automation, the question is how dedicated to automation and quality your team is, and how much you can invest in it.

It is absolutely a best practice to start automating a project from day one, and having a dedicated seasoned Selenium automation engineer is a big plus.

If your project still does not have Selenium tests, and there is a need for automation, do not hesitate. Start now! The difference will be huge, for both development and team morale. Automation is not a magic wand that will make all project problems disappear, but it will at least make them more visible.

Hire Selenium developers now
Alvaro 1506e7

My team is going to personally help you find the best candidate to join your team.

Alvaro Oliveira
VP of Talent Operations