Toptal is a marketplace for top Selenium developers, engineers, programmers, coders, architects, and consultants. Top companies and startups choose Toptal Selenium freelancers for their mission-critical software projects.
Papuna is a highly skilled QA automation and DevOps engineer with experience in Linux system administration and network engineering. He has leadership experience in QA teams and skills for delivering high-quality end-to-end tests. Papuna has designed architectures and implemented scalable systems using microservices and serverless architecture.
Deniz has over nine years of experience in software test automation, framework, and test architecture design. He led and mentored teams and created guidelines about testing. Deniz is an expert on Selenium, Cypress, Playwright, WebdriverIO, Protractor, and many other test automation technologies and programming languages. He communicates exceptionally well and has a keen eye for details. Deniz has been working remotely for the last couple of years, providing expert guidance across continents.
For the past seven years, Jovana has worked as a QA engineer collaborating with various QA teams and on complex functional testing (manual and automation) on multiple types of applications. She's passionate about bug hunts and is known as a hard-working team player who loves to learn. Jovana thrives under pressure and this can be seen in her history of successfully dealing with deadlines and product deliveries.
Enzo is an engineer with more than 12 years of experience in QA/QA automation, working with the latest technologies and highest industry quality standards automating web UIs, Rest APIs, and back-end services. He's comfortable in startups and large companies, either as the first QA member or joining teams of all sizes. He also has experience defining processes, procedures, and tools in order to achieve the best quality.
Andrej is a certified software engineer in test (QA) with more than 15 years of progressive experience in software testing methodologies, best practices in test automation, and a variety of test tools. He achieves project objectives through passion, commitment, and expertise. Andrej has hands-on experience in complex testing efforts on projects with multiple integration points and aggressive deadlines.
Leonardo has over a decade of software testing experience in Agile testing, load testing, continuous delivery, and mostly testing automation. He’s capable of working with a wide variety of software quality tools and environments. Leonardo is certified in Tester Foundation Level and Tester Advanced Level and also has a technical license in software analysis/development and graduate studies in business management specialization.
Jacek is a dedicated and scrupulous (a perfectionist) tester with experience in both back-end and front-end. He primarily focuses on Java, but he also enjoys learning and exploring new technologies. Knowledge is power.
Thiago is a QA engineer with 12+ years of experience who's proficient in functional and regression testing using C#/Java and Selenium for UI testing and RestSharp (C#)/RestAssured (Java) for API testing. He's worked with several application types, is able to build a strong background, and communicates well with both business and development ends of the team. His will to solve problems is one of the keys to his success.
United KingdomToptal Member Since October 24, 2019
Fayaz is a DevOps engineer and architect with experience in designing end-to-end solutions. He has extensive cloud and infrastructure expertise with multiple AWS, Azure, and Google Cloud certifications. He specializes in monitoring tools (ELK, Zabbix, and Prometheus) and automation with Python, Ansible, Terraform, and Docker. Fayaz has implemented Jenkins CI/CD pipelines to build, test, and deploy large apps, including microservices, with zero downtime.
Igor is an experienced automation architect with proven leadership ability. Passionate about improving organizational efficiency through utilizing automation strategies, he's capable of directing several initiatives simultaneously and maintaining a high standard of excellence in quality and speed. Igor's experience includes expertise with Java, JavaScript, Python, Selenium, Appium, Jest, Jasmine, NightwatchJS, Karate API, and UI.
Christina is a senior QA engineer with expertise in test automation, test management, and manual testing for web and mobile applications. She has created test automation frameworks from the ground up using Selenium WebDriver in several projects as well as automating API testing using REST-assured and Postman. With experience in both private and public sectors, Christina has worked with large, medium-size, and small startup companies.
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.
... allows corporations to quickly assemble teams that have the right skills for specific projects.
Despite accelerating demand for coders, Toptal prides itself on almost Ivy League-level vetting.
Our clients
Creating an app for the game
Leading a digital transformation
Building a cross-platform app to be used worldwide
Drilling into real-time data creates an industry game changer
Testimonials
Tripcents wouldn't exist without Toptal. Toptal Projects enabled us to rapidly develop our foundation with a product manager, lead developer, and senior designer. In just over 60 days we went from concept to Alpha. The speed, knowledge, expertise, and flexibility is second to none. The Toptal team were as part of tripcents as any in-house team member of tripcents. They contributed and took ownership of the development just like everyone else. We will continue to use Toptal. As a startup, they are our secret weapon.
Brantley Pace, CEO & Co-Founder
Tripcents
I am more than pleased with our experience with Toptal. The professional I got to work with was on the phone with me within a couple of hours. I knew after discussing my project with him that he was the candidate I wanted. I hired him immediately and he wasted no time in getting to my project, even going the extra mile by adding some great design elements that enhanced our overall look.
Paul Fenley, Director
K Dunn & Associates
The developers I was paired with were incredible -- smart, driven, and responsive. It used to be hard to find quality engineers and consultants. Now it isn't.
Ryan Rockefeller, CEO
Radeeus
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
As a small company with limited resources we can't afford to make expensive mistakes. Toptal provided us with an experienced programmer who was able to hit the ground running and begin contributing immediately. It has been a great experience and one we'd repeat again in a heartbeat.
Stuart Pocknee , Principal
Site Specific Software Solutions
We used Toptal to hire a developer with extensive Amazon Web Services experience. We interviewed four candidates, one of which turned out to be a great fit for our requirements. The process was quick and effective.
Abner Guzmán Rivera, CTO and Chief Scientist
Photo Kharma
Sergio was an awesome developer to work with. Top notch, responsive, and got the work done efficiently.
Dennis Baldwin, Chief Technologist and Co-Founder
PriceBlink
Working with Marcin is a joy. He is competent, professional, flexible, and extremely quick to understand what is required and how to implement it.
André Fischer, CTO
POSTIFY
We needed a expert engineer who could start on our project immediately. Simanas exceeded our expectations with his work. Not having to interview and chase down an expert developer was an excellent time-saver and made everyone feel more comfortable with our choice to switch platforms to utilize a more robust language. Toptal made the process easy and convenient. Toptal is now the first place we look for expert-level help.
Derek Minor, Senior VP of Web Development
Networld Media Group
Toptal's developers and architects have been both very professional and easy to work with. The solution they produced was fairly priced and top quality, reducing our time to launch. Thanks again, Toptal.
Jeremy Wessels, CEO
Kognosi
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 throughout our project. We definitely recommend Toptal for finding high quality talent quickly and seamlessly.
Ryan Morrissey, CTO
Applied Business Technologies, LLC
I'm incredibly impressed with Toptal. Our developer communicates with me every day, and is a very powerful coder. He's a true professional and his work is just excellent. 5 stars for Toptal.
Pietro Casoar, CEO
Ronin Play Pty Ltd
Working with Toptal has been a great experience. Prior to using them, I had spent quite some time interviewing other freelancers and wasn't finding what I needed. After engaging with Toptal, they matched me up with the perfect developer in a matter of days. The developer I'm working with not only delivers quality code, but he also makes suggestions on things that I hadn't thought of. It's clear to me that Amaury knows what he is doing. Highly recommended!
George Cheng, CEO
Bulavard, Inc.
As a Toptal qualified front-end developer, I also run my own consulting practice. When clients come to me for help filling key roles on their team, Toptal is the only place I feel comfortable recommending. Toptal's entire candidate pool is the best of the best. Toptal is the best value for money I've found in nearly half a decade of professional online work.
Ethan Brooks, CTO
Langlotz Patent & Trademark Works, Inc.
In Higgle's early days, we needed the best-in-class developers, at affordable rates, in a timely fashion. Toptal delivered!
Lara Aldag, CEO
Higgle
Toptal makes finding a candidate extremely easy and gives you peace-of-mind that they have the skills to deliver. I would definitely recommend their services to anyone looking for highly-skilled developers.
Michael Gluckman, Data Manager
Mxit
Toptal’s ability to rapidly match our project with the best developers was just superb. The developers have become part of our team, and I’m amazed at the level of professional commitment each of them has demonstrated. For those looking to work remotely with the best engineers, look no further than Toptal.
Laurent Alis, Founder
Livepress
Toptal makes finding qualified engineers a breeze. We needed an experienced ASP.NET MVC architect to guide the development of our start-up app, and Toptal had three great candidates for us in less than a week. After making our selection, the engineer was online immediately and hit the ground running. It was so much faster and easier than having to discover and vet candidates ourselves.
Jeff Kelly, Co-Founder
Concerted Solutions
We needed some short-term work in Scala, and Toptal found us a great developer within 24 hours. This simply would not have been possible via any other platform.
Franco Arda, Co-Founder
WhatAdsWork.com
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.com
How to Hire Selenium Developers through Toptal
1
Talk to One of Our Industry Experts
A Toptal director of engineering will work with you to understand your goals, technical needs, and team dynamics.
2
Work With Hand-Selected Talent
Within days, we'll introduce you to the right Selenium developer for your project. Average time to match is under 24 hours.
3
The Right Fit, Guaranteed
Work with your new Selenium developer for a trial period (pay only if satisfied), ensuring they're the right fit before starting the engagement.
Find Experts With Related Skills
Access a vast pool of skilled developers in our talent network and hire the top 3% within just 48 hours.
At Toptal, we thoroughly screen our Selenium developers to ensure we only match you with talent of the highest caliber. Of the more than 200,000 people who apply to join the Toptal network each year, fewer than 3% make the cut. You’ll work with engineering experts (never generalized recruiters or HR reps) to understand your goals, technical needs, and team dynamics. The end result: expert vetted talent from our network, custom matched to fit your business needs.
Can I hire Selenium developers in less than 48 hours through Toptal?
Depending on availability and how fast you can progress, you could start working with a Selenium developer within 48 hours of signing up.
What is the no-risk trial period for Toptal Selenium developers?
We make sure that each engagement between you and your Selenium developer begins with a trial period of up to two weeks. This means that you have time to confirm the engagement will be successful. If you’re completely satisfied with the results, we’ll bill you for the time and continue the engagement for as long as you’d like. If you’re not completely satisfied, you won’t be billed. From there, we can either part ways, or we can provide you with another expert who may be a better fit and with whom we will begin a second, no-risk trial.
Share
How to Hire a Great Selenium Developer
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 the 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.
Version 1 proved to be an interesting framework, and that opened the eyes of many people regarding the automation testing 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 app 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 and data driven 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, Test Automation Engineers, 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 full-time 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 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("http://fghdqx.ce-ss.net");
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 'http://fghdqx.ce-ss.net'
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("http://fghdqx.ce-ss.net")
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:
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:
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.ce-ss.netmon.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.
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.
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:
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:
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 assurance 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 with development experience 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 software 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.