How to Migrate from Playwright to Selenium

Selenium has been controlling the Automation Testing industry for decades now. Due to the extended presence of this test automation tool, it has managed to get a lot of experience in the application testing segment. However, in modern times, several other competitors have also emerged in the market.

Playwright is one of the most recent companies that has managed to challenge the market domination of Selenium with its promising features. However, since they are new to the industry, their support is quite limited and not as extensive as Selenium. Therefore, many developers who had previously adopted Playwright are willing to migrate back to Selenium.

In this article, we will discuss everything that you need to know to migrate your test scripts from Playwright to Selenium.



Selenium is an open-source tool that automates the web browsers for conducting the testing processes. Using this automation testing tool, developers can write the test scripts in multiple programming languages like JavaScript, C#, Python, etc. Selenium also acts as a browser driver that conducts the testing instances on the browser of the developer’s device. Let us now briefly discuss all the major components of the Selenium library:

  • The Selenium WebDriver: Selenium WebDriver is responsible for conducting all the testing instances on the browsers. Since all the test cases are browser-specific, therefore the developers must remember to install the drivers of the browsers where they intend to conduct the testing processes.
  • Selenium Integrated Development Environment: The Selenium integrated development environment is available as a plugin for the Chrome and Mozilla Firefox browsers. Using this the developers can lock the natural interaction of the browser with the web application. These interactions can in turn be used to develop the test scripts.
  • Selenium 4: Selenium 4 is the latest update of Selenium. It adds various new features including the upliftment of Selenium WebDriver. The tale version was just released and the develprs have to already startedto upgrade. It also removes the support for the legacy protocol. Thus, W3C WebDriver will become standard by default.
  • Selenium Grid: The Selenium grid can minimize the overall testing time for the web application. It achieves this goal with the help of a feature known as parallel testing. Parallel testing is the process of running multiple test instances on different Browsers and operating systems at the same time.

Major Advantages of Selenium

Let us discuss some of the major advantages of using Selenium for performing test automation during the web application development life cycle:

  • Selenium is quite well known for its extensive support for different programming languages and other frameworks. While using this test automation tool, the developers would not feel limited by any form of available resources.
  • The open-source nature of Selenium has made it accessible to almost every developer in the web application Development Industry. Moreover, this feature also allows tech enthusiasts to make necessary changes for the improvement of the community.
  • Currently, Selenium is one of those few test automation tools that supports almost every web browser that is available in the market. It also allows the developers to initiate test instances on older versions of a browser as well. Moreover, you can also use this tool to test the functioning of the web application on Legacy browsers like Internet Explorer.
  • Selenium also plays a vital role in reducing the overall cost during the web application development process. This is because a major portion of the Selenium automation scripts is reusable. This means the developers can use the same script on future development projects as well.
  • The open-source nature of Selenium has also given birth to a massive community of tech lovers and application developers. This community not only supports the Selenium tool but also the new developers as well.



Playwright is also an open-source web automation framework; this tool was initially developed by the contributors of Microsoft. Playwright comes under the category of emerging test automation tools. However, many experts believe that this tool has managed to gather a wide audience in a very short period. This test automation tool is mostly popular with programming languages like JavaScript and NodeJS. It also comes with the Apache 2.0 license. Using this tool, developers can automate chromium, WebKit and Mozilla Firefox by using only a single API.

Major Advantages of Playwright

  • Since it is new to the industry and is somewhat limited in resources, they have initially concentrated the focus on the most important areas. For instance, this tool supports testing on web applications that are most popular in the industry.
  • The test execution process in Playwright is very fast and reliable. It helps to simplify the test authoring process by implementing auto wait in the elements of the web application.
  • The Playwright test automation tool comes with very powerful automation capabilities. This test automation tool is not limited to the JavaScript in-page execution process. Instead, it can execute the testing processes on multiple pages at the same time.
  • The installation and initiation process for Playwright is very simple. This means the developers do not have to waste multiple hours setting up the testing environment.
  • Although the community of Playwright isn’t as big as Selenium, it has various other alternatives. For instance, the official website of Playwright has many tutorial videos revolving around the common errors in the testing process. However, a major disadvantage of this tutorial process is that all of the data is available in the form of documentation without enough examples.

The Differences Between Selenium and Playwright


To properly understand the gap between Selenium and Playwright, we need to have a proper discussion about the major differences between these two test automation tools:

  • Language Support: Selenium supports almost every programming language that exists in the current generation. It also supports those programming languages that are rarely used in a test script development process. However, Playwright has diverted all of the focus to supporting only those programming languages that are currently popular.
  • Browser Support: The story of browser support is similar to that of programming language support. On one hand, Selenium supports almost every browser that exists in the current generation. It also includes the older versions of these browsers. It has also maintained its support for Legacy web browsers like Internet Explorer. On the other hand, Playwright has allocated its resources to supporting the major browsers like Chrome and Mozilla Firefox.
  • Working with Different Elements: Selenium performs all the interactions with the help of web elements. The developers also have to use different locators to link the web elements with all the different elements on the web application. On the other hand, Playwright conducts all the interactions directly with the help of locators.

Migrating From Playwright to Selenium

Now, it’s time to discuss the main topic of this article, the migration process from Playwright to Selenium. There are various ways that a developer can move the test scripts from Playwright to a Selenium-based development environment. The most common way of performing this process is to use a test automation tool or framework. Various cloud-based test automation platforms like LambdaTest can help the developers easily accomplish this goal.

The first step in the migration process is to move the test scripts from a local grid to a cloud-based web environment. This can not only help in the easy migration but also improve the accessibility of the testing feature. The next step in this process is to use a Selenium jar file. This JAR file will help the developers to conduct the testing processes both locally and also on remote servers. To implement this JAR file, the developers have to use the code: selenium-standalone-server-‘{‘version’}’.jar. In case you are an existing Selenium user, you can also use this Jar file to implement the Selenium remote control.

Role of Tools and Platforms in the Migration Process


In the earlier part of this article, we said that tools and platforms easily help the developers to migrate the test scripts from Playwright to Selenium. This is because certain cloud-based platforms can work on multiple test automation frameworks. For instance, it can help the developers to run Test scripts from Selenium, Cypress and even Playwright. The developers have to make minimal changes in the main script to make them compatible with other test automation tools.

The easiest way to complete this process is to create a checklist according to your testing requirements. This checklist must consist of important factors like your knowledge of multiple programming languages, the trustworthiness of the tool and the overall time limit for the development project. Now, let us use the example to understand how you can convert Playwright scripts to Selenium with cloud-based platforms:

On the other hand, Playwright test scripts allow you to conduct the testing processes on more than 40 different browsers. For the conversion process, first, the developers need to ensure that they can execute the test scripts. You can use the “Playwright[‘chromium’].launch” command to launch a new chromium window for running this test. Then, you have to add a CDP endpoint so that you can connect both of these tools. You can use the “chromium.connect” method.

The Conclusion

So, we can conclude that even though Playwright seems to have a promising future, it hasn’t yet reached such a point that it can upfront challenge the domination of Selenium. This is the main reason why many veteran developers still want to stick to Selenium. However, many market experts believe that the future might have something completely different in store for all of us. Therefore, as a developer, you must know both of these test automation tools and also the ability to migrate between these two. You should also have a proper idea about all the recent developments in the market in terms of different Browsers and operating systems. These ideas will help you to be in proper synchronization with these evolving market standards.

Radulovic Jovica
Radulovic Jovica

I started my career at following the completion of my studies in Agricultural Economics at the University of Belgrade. My fascination with this field arose from recognizing the pivotal role marketing plays in companies' business strategies.