How can I automate user signup form testing using Selenium?

I want to automate user signup from testing using selenium, can anyone please guide me onto that.

1 Like

If you are just starting with Selenium automation testing of your product, the first page you would probably want to automate would be the SignUp or Login Page. If you have an online platform like an ecommerce company or a Software-as-a-Service product, the Signup page acts as the door to welcome your web application visitors. It is one of the simplest yet one of the most important pages of your platform, and comes at the start of every possible user journey that you may want to test. Hence, it is also one of the most important web pages for your web application.

So today, we are going deeper into how you can perform Selenium automation testing of Signup form page. We are going to execute automation testing with Selenium and Java. In one of our previous Selenium Java tutorials, we demonstrated how to automate the login process using Selenium automation testing.

Today, we will take an example of a Registration Page / Sign Up Page from LambdaTest. We will start our discussion with the test cases and process for the registration page of LambdaTest and then move to the Automation part to see how we can increase our browser coverage for efficient cross browser testing and accelerate automation testing through parallel testing on Selenium Grid.

Before moving forward, let’s look at the workflow in a bit more detail and see how Sign Up page of LambdaTest works.

As a first step, we enter URL in any browser to reach the landing page of the LambdaTest website. You can refer following screenshot for the landing page.

From there we are going to click on ‘Free Signup’ button and reach to the Registration page of the LambdaTest.

Now, let us check the Functional fields on this Registration page and list them down.

  • Organization / Company Name (Text field)
  • Full Name of the user (Text field)
  • Work Email Id (Text field)
  • Desired Password (Text field)
  • Phone number of the user (Text field)
  • Terms and Privacy Policy (checkbox)
  • Free Signup (button)

WorkFlow Of The Sign Up Page

Enter all the required fields: Full Name, Work Email, Desired Password, Phone number, Terms and Privacy policy checkbox.

Validate the fields:

  • Work email : Should not be an existing user, valid email.
  • Password : Should provide minimum required length for password.
  • Phone Number
  • Terms and Privacy policy checkbox

Till now, we have discussed all the basic things about the registration page, specifically related to the registration page of LambdaTest. So let us proceed with writing test cases for this page.

Possible Test Scenarios of the Sign Up Page

  • Elements:

Check if all buttons, title, checkboxes are present on the page and if those are working by clicking on all buttons and checkboxes. In case of LambdaTest registration page, we should check the following buttons, text fields, terms and privacy policy checkbox, etc.

  • Links:

Check if all the links present on the page are redirects to the expected pages.

We also need to check if:

  • LambdaTest link redirects to LambdaTest are launching the correct page.

  • Terms of Service link opens a new tab with redirection to the Terms of service page.

  • Privacy Policy link opens a new tab with redirection to the Privacy Policy page.

  • Login link redirects from registration page to login page.

  • Optional Fields:

In case of LambdaTest registration page, only optional is Organization or Company Name. So we shall try to register with and without providing Organization or Company name, and it should be possible to complete the registration in both the cases (considering user has provided all other information correctly).

  • Required Fields:

In case of LambdaTest registration page, we have the following required fields , so let us discuss about the cases related to each field.

  • Full Name:

  • Verify without providing Full name, it should give the respective error and it should not be possible to proceed further the registration page.

  • Verify with providing Full name, it should be possible to complete the registration (considering user has provided all other information correctly).

  • Work Email:

  1. Verify with valid email ID, but have an existing account on LambdaTest platform with that email ID, then in that case, it should not be allowed to register with that email ID and should give a respective error message (considering user has provided all other information correctly).
  2. Verify without providing any details in the Work Email field, it should not be allowed to register without any email ID and should give a respective error message.
  3. Verify with valid email ID, which does not have any account on LambdaTest platform with that email ID, so the user should be able to proceed and register successfully (considering user has provided all other information correctly).

Desired Password:

  1. Verify without providing any password in the Desired Password field, it should give the respected error message to provide the password.
  2. As we can see that there is a minimum length of characters for the password is required, which is at least 8 characters are required. So we can make use of test design technique Boundary Value Analysis (BVA), as we have minimum criteria of 8 characters so we can test with lengths 7, 8 and 9 characters.
  3. When it is less than 7 then it should give the error to the user and user can proceed to complete the registration process. * When it is 8 then it should be possible for the user to complete the registration process successfully without any error. (considering user has provided all other information correctly). * When it is 9 then also it should be possible for the user to complete the registration process successfully without any error. (considering user has provided all other information correctly).
  • Phone:
  1. Verify without providing any phone number in the field, as it is also mandatory field so user should not be able to proceed and complete the registration without providing phone number.
  2. Verify with providing invalid phone number ( phone number with 2-3 digit), in this case also user should not be able to proceed and complete the registration with invalid providing phone number.
  3. Verify with providing valid phone number in the field, in this case the user should be able to register successfully with valid phone number (considering user has provided all other information correctly).
  4. Terms of Service checkbox:
  5. Verify without checking Terms of Services checkbox, as it is required field in the registration process user can not proceed to complete the registration process without checking this checkbox.
  6. Verify with Terms of services checkbox is selected, then user can complete the registration successfully without any error (considering user has provided all other information correctly).

Automating User SignUp Form Using Selenium and Java

So far in this Selenium Java tutorial, you have established a fair understanding of what you need to test on the Signup page. With that in mind, let us roll into action and automate this Signup page by performing Selenium automation testing with Java and TestNG.

We will now come up with a Selenium automation script and execute it on an online Selenium Grid. We will also leverage the power of parallel testing to fast track our automated cross browser testing. But before all that, you should be ready with the below prerequisites.


Before moving to the script, let us go through some basic prerequisites to write and execute Selenium Automation test script.

  1. JDK and JRE – This is required to execute any Java program in our system. You can download it from the official website of Oracle.
  2. Eclipse IDE – We have used Eclipse to write our program or test script. You can download it from the official website of Eclipse or you can use any other IDE as per your choice.
  3. Selenium Jars – To write any Selenium automation testing script, it is required to have Selenium Jars in the project. You can download Selenium Jars from the official website of Selenium.
  4. TestNG Framework – In the following test script we have used TestNG framework for Selenium automation testing which will help us in generating test reports, prioritizing test cases, grouping the test cases and also for parallel execution on different browsers. You can either download TestNG Jars or you can directly add it inside Eclipse from Eclipse Marketplace using the TestNG Eclipse URL or you may refer to TestNG to download.

In the below example, we have integrated our test script with LambdaTest, a cross browser testing tool. Wondering why we are running our Selenium automation tests on cloud-based Selenium testing tool such as LambdaTest?

Although, Selenium empowers you to automate your web application testing across different browsers. You can only perform Selenium automation testing on browsers installed on your machine where the local webdriver is running. Now, installing hundreds of browsers and maintaining the library for your inhouse Selenium infrastructure can be very strenous, not to forget, time-consuming too.

This is why it is recommended to run Selenium automation testing on an online Selenium testing tool such as LambdaTest but that is not the only reason to it. LambdaTest is a lot more!

What is LambdaTest?

LambdaTest is a cross browser testing tool on cloud which offers both manual and automated browser compatibility testing on a Selenium Grid consisting 2000+ real browsers on cloud. LambdaTest allows you to execute parallel testing, generate detailed test reports of Selenium automation testing, provides you with recorded video of the entire test script execution, along with the ability to seamlessly integrate your Selenium automation testing suite with your favourite CI/CD tools. It also offers native plugins for Jenkins, and more.

Selenium Automation Testing For SignUp Page With LambdaTest

So, now let’s discuss the process of how we can integrate our test script with LambdaTest and execute it to see the results. In our selenium test script we initialize the WebDriver as,

WebDriver driver = new ChromeDriver();
WebDriver driver = new FirefoxDriver();
WebDriver driver = new EdgeDriver();

While to start with, when we want to run test script on LambdaTest Selenium grid we have to initialize the WebDriver as

WebDriver driver = new RemoteWebDriver(new URL("https://" + username + ":" + accesskey + "@"),

Now few questions will arise like what are these username and accesskey is for? So we can generate these username and accesskey from LambdaTest Capabilities Generator.

Here once we select the OS, Browser, Selenium WebDriver version etc., we can get the username and accesskey for our users which we can use in the test script.

Note: To generate this username and accesskey, you should be registered and logged in your LambdaTest account.

So after we generate those username and accesskey, we can use those in our test script in integration with LambdaTest. We have created the following test script for the LambdaTest registration page/ Sign Up page, we have covered the test scenarios which we have discussed above as manual test cases and scenarios.

While executing any automation test cases, there are few steps which are common and required to perform at the start of the test suite while few needs to perform before every test case which we can call as pre conditions for the test case.

For example: While executing every test case, we need to open the browser and navigate to the target URL before starting to execute the actual test case, delete cookies, etc…

For this purpose we use @BeforeClass and @BeforeMethod annotations from Test NG, so in our case we will need

  • to set few capabilities (browser, platform etc.)
  • Open the browser
  • Delete cookies
  • Open LambdaTest platform and navigate to Signup page
public String username = "yadneshshah91"; //your LambdaTest username
public String accesskey = "1234ABCD"; //your LambdaTest access key
public static RemoteWebDriver driver = null;
public String gridURL = "@"; //LambdaTest Hub URL
boolean status = false;
//Setting up capabilities to run our test script
@Parameters(value= {"browser","version"})
public void setUp(String browser, String version) throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("browserName", browser);
capabilities.setCapability("version", version);
capabilities.setCapability("platform", "win10"); // If this cap isn't specified, it will just get the any available one
capabilities.setCapability("build", "LambdaTestSampleApp");
capabilities.setCapability("name", "LambdaTestJavaSample");
capabilities.setCapability("network", true); // To enable network logs
capabilities.setCapability("visual", true); // To enable step by step screenshot
capabilities.setCapability("video", true); // To enable video recording
capabilities.setCapability("console", true); // To capture console logs
try {
driver = new RemoteWebDriver(new URL("https://" + username + ":" + accesskey + gridURL), capabilities);
} catch (MalformedURLException e) {
System.out.println("Invalid grid URL");
} catch (Exception e) {
//Opening browser with the given URL and navigate to Registration Page
public void openBrowser()
driver.get("Free Cross Browser Testing Tool on Cloud | Selenium Automation Testing");
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(15, TimeUnit.SECONDS);
WebElement signUpButton = driver.findElement(By.xpath("//a[contains(text(),'Free Signup')]"));;

In the above part of code, notice the DesiredCapabilities object. This object is used to set capabilities like browser, version, operating system etc, and instructs LambdaTest grid to run tests on the desired configurations. If you want to run tests locally, then you would not necessarily need this object. , then we opened the browser, deleted cookies, navigate to default page of the LambdaTest and then click on the Sign Up button to redirect to our target page which is Sign Up page.

Same is the case for the operations/tasks which are required to perform at the end or after the execution of test cases.

For Example: Closing the browser session, etc.

For this we have used @AfterMethod or @AfterMethod annotations from TestNG. If you are new to TestNG, then I suggest you read our detailed article on TestNG annotations.

// Closing the browser session after completing each test case
public void tearDown() throws Exception {
if (driver != null) {
((JavascriptExecutor) driver).executeScript("lambda-status=" + status);

In the above part of the code, you can see that we have closed the browser session which we need to do after every test case.

As we have seen, what and how it works before and after every test case now let us execute Selenium automation testing for the test cases, discussed above. In any Selenium automation test script, to perform any actions on the elements of the web page, we need to locate them first. For this, we make use of Selenium Locators. (Read More)

1 Like