r/softwaretesting • u/Wide_Researcher_3565 • Mar 27 '24
Selenium VS Playwright
Hi, I'm a manual tester looking to start the automation testing effort for my company's website from scratch. From doing my research on this sub, I noticed that Playwright with JS/TS is the most recommended combo to learn and get started with. However, one of the devs in my team recommended that I start with Selenium because it's more common and has more documentation and community support. I'm confused now. I'm not particularly keen on learning Java for Selenium and Python with Selenium also doesnt sound appealing because the frontend is coded in JS/TS so I figured Playwright would be perfect.
Can someone tell me about their experience working with Playwright-JS/TS. How is the documentation and community support if i were to run into issues? Also, I might be leaving the company in a couple of months so I want to hand over the automation in a way that it can be picked up easily by the new guy.
21
u/NightSkyNavigator Mar 27 '24
I teach courses in both frameworks. You should go with Playwright. It's an easier learning curve, and will provide value faster for both you and your company. Documentation is fine.
If you were experienced in Selenium, but not Playwright, the answer would be Selenium.
If you were experienced with both tools, a lot of other factors would come into play, and it's more difficult to give a clear answer.
This is assuming that you have experience with JS/TS. If not, Python might be a better option, though if you don't have any programming experience at all, it's going to be an uphill struggle no matter the choice, especially with regards to maintainability, extendability and scalability (if needed).
Why do your company want to do automation? What is the goal?
1
u/Wide_Researcher_3565 Mar 27 '24
Hi! I dont have experience with JS/TS but know Python a little bit. Do you think it would be ideal then for me to use Selenium with Python? or Playwright with Python? Honestly, my company hired me as the Senior QA and this role only demanded manual testing. However, right now I'm blocked for testing since the website is still being developed so I only test when a new feature is out. I think to use up my time well, they've asked me to start looking into automation.
I have plans of leaving this company in a few months and head towards more data related roles. Do you think I should look out for myself and learn Selenium with Python that would help me at the job+personal growth or think of the company and pick up JS/TS for playwright?
7
u/NightSkyNavigator Mar 27 '24
I'd lean towards TS and Playwright then. It's the strongest combo for Playwright, and Playwright is easier to be productive with, whereas Selenium requires experience to be really productive with it. The company would also appreciate it, seeing as they likely have people who know TS.
It means you have to learn a bit of TS, but there are plenty of tutorials to get you started, including Playwright's documentation. And if you are only planning to stay a few months, no one should be expecting a completed project anyway, or that it will be particularly good quality.
As for experience, Playwright is taking market shares from Selenium right now, so while there are more Selenium projects, more new projects will be Playwright. At least, that's the situation I see in and around my network. This will perhaps change when both use Webdriver BiDi and the speed difference is negligible.
Frankly, it was probably a mistake for them to ask you to do this, because while you are hired as a senior tester, it sounds like you are a junior test automation engineer, and the expectation should be accordingly. Not saying it can't be done, but it's high risk.
2
u/French_Fried_Taterz Mar 28 '24
if it is just you do Playwright with python. there is no reason to learn a different language when python/pytest/playwright can do all the same stuff. you can learn typescript later if you want to apply for other jobs, but python/playwright is a close second to ts/playwright. It is the #2 playwright language and what I use in a similar situation.
1
u/Tiburanetz Mar 29 '24
In case you are going to look for data related job, I'd recommend you to choose playwright with python because python will be more suitable for data related stuff automation.
1
Mar 27 '24
Do you have any repo where i can take a look on the playwright framework ?
3
u/NightSkyNavigator Mar 27 '24
Just have a look at the official documentation for Playwright, it's easy to follow.
1
Mar 27 '24
Yup but just wanted to know the design patterns
2
1
u/NightSkyNavigator Mar 27 '24
Sorry, I don't work on any open source projects or others I can share.
1
0
u/PlatformDue2937 Jan 31 '26 edited Jan 31 '26
I should say in this AI era there is going to be a winner and is not selenium or playwright. I have checked a couple of cheap services targeted to e2e where you just add a prompt and the service started entering and trying the buttons and menus in your app, like a 5 yo boy first time trying to buy a figurine from ebay with her dad cc. We are living in the future guys, nobody should use this cave men tools anymore
9
u/Gaunts Mar 27 '24
Selenium for a job now, playwright for a job in three years.
23
u/computerjunkie7410 Mar 27 '24
Learning to code and not worrying about tools: job for the next 20 years
3
u/Gaunts Mar 27 '24
Couldn't agree more, it's the path I took, self taught developer landed a job as a full stack c# developer. Then moved into a QA automaion developer role and have been loving it, writing effecient extendable test automation frameworks is great fun. Then when your competition is often god scripts copy pasta'd it's easy to stand out from the crowd even as a below average dev.
2
u/computerjunkie7410 Mar 27 '24
The amount of YouTube automation engineers is so damn high these days but ask them to implement an interface in a technical interview and their eyes glaze over lol
1
u/wekede Jun 02 '24
I'm a self-taught developer who's unfortunately never translated his skills into any kind of programming job. Would you recommend this role? What was your path for getting into it? Any certs or degrees before you got the job?
Just happened to browse by your comment while looking to see if I should switch from Selenium to Playwright...
1
u/Wide_Researcher_3565 Mar 27 '24
Since i'm comfortable with Python(even though Selenium+Java is more commonly used), should I go for that route?
2
u/MasterKindew Mar 27 '24
I can't advocate for what path to take, but I will say you can do test automation with Python. I'm currently in a role using python/selenium as the base.
1
u/Lucky_Mom1018 Mar 27 '24
Me too. I’m self taught selenium/Python and have had no trouble building a great framework.
1
u/Tiburanetz Mar 29 '24
I think selenium is more flexible than playwright for building great framework. But playwright has some killer features like requests interception.
1
u/NoCloudBase May 10 '24
too late for this post, started using Selenium back in mid 2020 + python for web automation for my job upon recently (3 months ago) I discovered Playwright,s witch and never looked back. Selenium was able to do most of my needs but its way harder to setup for quick testing. Playwright within ours of reading docs and playing with it I I had a test setup running for prototypes. Playwright works extremely well with single page java script websites as opposed to selenium which stills works fine but requires extensive knowledge and prep to do the same with playwright which may take you couple of hours to have something working.
1
u/Diligent_Librarian58 Nov 20 '24
A bit late, but since I don't see anybody mentioning it: Both Playwright and Selenium support Python. So Playwright Python would be exactly what you're looking for.
1
1
u/Appropriate_Store850 Jan 25 '26
I'm happy to find this comment 2 years later. Sounds like Playwright is the best choice.
6
u/Additional-Plate-617 Mar 27 '24
Playwrite is easy to learn comparatively but you will find more opportunities in selenium as of now.
1
u/Wide_Researcher_3565 Mar 27 '24
How are the opportunities in using Selenium with Python? I'm slightly familiar with Python over Java/JS/TS
2
16
u/Aragil Mar 27 '24
Selenium is not a test automation framework, it is a browser automation tool. You need to add at least a test runner, assertion library and reporting library in the mix, then orchestrate that properly to make something of it.
Playwright Test is a test automation framework, and it handles most of the complicated stuff like waiting, parallel runs, etc. out of the box (in addition to running the tests, doing reporting, and assertions).
If you start counting, Selenium will have more articles and videos, but most of them are old stuff, not actual anymore, or repeating the same 7-year old best practices. If we talk about working with the current versions of both tools, you will find Playwright to be way better supported.
1
u/insttechno Aug 30 '24
Ive been reading about this tool, is the idea of a test automation framework to test things like load? vs Selenium being more driven towards robotic process automation? Im also learning about it now.
2
Oct 15 '24
Came across this comment looking for general opinions. My perspective as an engineer that writes tests for my software as part of my job:
Easiest way to think about it is selenium handles loading the browser, invoking operations and getting you to a testable state, then you use *another* tool to do whatever flavor of testing you want (e2e, unit, functional, et al). Playwright does the browser handling bit, the test running, results aggregation, etc and provides modern web-semantic support for testing as a complete framework so you don't need to cobble together quite as much duct tape and the result is effectively turn-key
____________________________
Aside:
From what I've seen surveying the space in the last few days, the only people still pushing Selenium are the people who don't want to invest time skilling-up to learn a new language or tool (typically java folks), or those who have a profit motive built up around it and are willing to go hard at the sunk-cost fallacy. It smacks of desperation.
That's not to say that playwright is without its rough edges, I've had PRs declined by Microsoft to make playwright more compatible with non-ubuntu linux distros, for example. We have a fair amount of custom patching built into our tool chain to support it in a redhat ecosystem. Overall though, it's where everything is headed and if you're windows or ubuntu-based, it's hard to beat.
1
u/insttechno Oct 15 '24
I actually rewrote my Selenium stuff in playwright and so far so good. Just found certain functions more easily achievable in playwright
5
u/cepeen Mar 27 '24
After years using selenium I find it very refreshing that playwright works just perfectly. Difference is night and day.
1
Jul 01 '24
hi, can you explain why? I've annoyingly spent a lot of time on selenium recently. And what about automating back end process etc-is there a tool that is leading the way in that? eg etl testing?
2
u/cepeen Jul 01 '24
Playwright has well thought waiters built in, Locator class works well, it’s fast any stable. Does not have limitations of cypress and has great support. Also it’s fully fledged tool with test runner, reporters and even additional “test viewer” where you can check test execution in real time (similarly to cypress).
1
u/TheThirdDoor Mar 27 '24
I just did a comparison between the two on my project recently and playwright came out on top.
I was writing in python and I’ve got to say playwright was refreshing
It just seemed to work, like no faffing around trying to click a button, using .click() just seemed to work.
Install was waaaaaaay easier.
I didn’t really need to mess about with the whole page object model and onerous setup.
No need to install drivers or deal with docker
My project just needed it for a basic browser check on a predominantly API suite so your mileage may vary on larger projects, but it gets my endorsement.
2
6
u/2ERIX Mar 27 '24
People that aren’t on top of industry trends are the ones still recommending Selenium at all. If they actually knew anything they would be saying “for your needs, Cypress” or “Playwright” or “WDIO”.
Because dependant upon your need the tool you use needs to suit the purpose of test AND be supportable by your team if you leave. So language and tool need to suit.
For you, with the minimal amount we know, Playwright would be the best choice.
5
u/TheSeekerOfSanity Mar 27 '24
Most times when hiring they are looking for someone to contribute to an existing automation effort. Most of what I see is Selenium as required skills. This will give you more opportunities because it is so well entrenched in the industry and has been for a while. You will currently find many more Selenium positions available than Playwright.
So, if you are starting a brand new automation effort Playwright may be the way to go. But if you are looking to join an established team and contribute to their current framework then Selenium would be your best choice. There are more opportunities currently available for Selenium.
Some may hate this idea - but if your an absolute beginner it may make sense to download a trial license for a COTS tool just to get familiar with automation in general (how it works, locating and manipulating objects, etc.) You can look at the code that’s generated for these actions and learn a lot of the basics first, and then move on to a more flexible (also more complex/powerful) open-source framework.
So understand basic concepts and then decide if you want to learn what is currently most popular (Selenium) or what’s becoming more popular (Playwright).
2
u/ZealousidealSlice222 Aug 02 '24
Respectfully disagree. I run a Quality Engineering organization for a large media company and I can tell you Selenium WD is still used widely for E2E browser automation in conjunction with a well written test framework. Cypress, which was supposed to be a "Selenium killer" ended up being nothing more than a decent unit/integration testing solution that only compliments Selenium, does not replace it. Playwright, the new "flavor of the day" will likely follow the same hyped path and then get replaced by something else again. Selenium still has broad browser support and a huge community base
1
u/2ERIX Aug 02 '24
With the large shift left of testing across the industry ensuring the quality with Playwright will be better choice than selenium as we move forward.
I may be wrong and Microsoft suddenly decide that Playwright is not to grow any further but I think it very unlikely.
At the moment in the organisation I deliver automation for we use WDIO for the complete SDLC, so Selenium/WebDriver has not been replaced yet, but it’s on its way.
And not preparing for the future is a mistake at an organisational level especially when Selenium has not improved in areas that Playwright is excelling which are outside the ui and into the areas that developers and testers need to be in tune with.
Selenium isn’t going anywhere, but it’s not moving forward either. Playwright is.
2
2
u/Dipsendorf Mar 27 '24
I'm a developer who worked for a large enterprise corporation and they did a ton of research and ultimately went from selenium -> playwright for our front end applications in Angular across the org.
2
u/Jinkxxy Mar 27 '24
I've used both. Selenium has a bigger community but it's a dinosaur. It just turned 20 years old, a lot of it might be stale information by now.
Playwright might be a standalone solution but it does what selenium does with a bigger emphasis on QA Testing. It's my favorite so far.
2
u/CertainDeath777 Mar 27 '24
Your Dev is right, but also so wrong.
There is more documentation for Selenium. But its all over the place in regards of quality and actuality, so you have to find your answers in between truckloads of literal trash.
Playwright documentation is sufficent and its so much easier to set up, as almost everything you need comes in a package with playwright github and vscode. you enter 3 console commands and start writing test cases and start to build a testing framework from the first tests you write.
with selenium after a week you may have decided whats the best test runner for you^^ or you experimented with selenium ide, to find out, theres no way around the actual coding.
i wouldnt even waste a thought about starting with selenium, when you can decide. so if there are no other reasons for selenium, you should just forget about it.
so take yourself an online PW course and start working. you will have a running framework and your first test on day 1 with that method. good luck trying with selenium^^
2
u/Adventurous-Hold7526 Mar 28 '24
I'm looking for load testing of our frontend. What would be the best option in my case?
2
u/Valuable-Ad9157 Mar 28 '24 edited Mar 28 '24
I am new to learning automated testing too. I chose Python with Selenium WebDriver. I did take a look at Playwright after I started to learn Selenium. After I studied the Playwright API docs for a bit, I decided to stay with Selenium because Playwright looked like it would be harder to learn to me. And Playwright itself tells you ways to avoid flakiness with their API, so it's not perfect either. Since I am getting used to the way Selenium works, I didn't see the need to change especially since I am still in the beginner stages of learning how to automate testing...so I need to learn something well first. And, from just looking at the Playwright API, I didn't see a big difference in how you script things compared to Selenium.
I actually like a lot about how Selenium works. I did need to take a Udemy class on it, where he started out using functional programming (which was great) and then went to POM (Page Object Model) which is just using Python OOP. It was a pain in the butt learning how to use Wait, but once you get it you are good to go.
Someone gave me the advice to just start with something and then go from there. This person thought starting with Selenium was just fine.
I have been in the IT related realm for 25 years. I always hear that this new piece of software is going to take over the world! So, dump that old dinosaur and jump onto the band wagon. Well, the truth is many companies will not make the change because the current system works just fine and everyone knows it. Unless Selenium takes a serious dump in quality, it will stay around for a long time still.
1
u/steveshakur May 09 '24
I love this answer! I feel the same way about this. Selenium works quite well if you actually set it up right and you forget about it. Playwright is also good. Some key advantages definitely. I will still learn it but I still love selenium because of it flexibility as well
1
u/Valuable-Ad9157 May 09 '24
Actually, I have recently changed my mind. I am switching to Playwright as it resolves some pretty annoying issues with Selenium. Most importantly wait times are handled way better in Playwright.
For Playwright you are better off using vanilla JavaScript, then add in TypeScript. But, glad I learned Python as it is easier to learn as a first language then JavaScript. So, now learning JavaScript shouldn't be so confusing.
2
u/steveshakur May 09 '24
I think we are in the same boat. I am finishing a course on udemy on PW. I love how one is able to debug so easily. So far im sold. I still love Selenium but definitely PW is much more efficient
2
u/Valuable-Ad9157 May 09 '24
Which class on Udemy are you taking? I just started going through "Automated Web Testing with JavaScript and Playwright" by Rick Schubert
2
u/steveshakur May 09 '24
Playwright: Web automation testing From Zero to Hero by Artem Bondar. Hes using TS to teach
2
Mar 27 '24
You will find that playwright is very easy to start with, has great documentation so I would go there.
If you need cucumber support there are boilerplate repos you can find too.
5
u/2ERIX Mar 27 '24
Upvote for positive Playwright comment, downvote for Cucumber advocate.
+0
1
Mar 27 '24
I don’t think I was advocating at all actually, just stating that if people have preference to use Cucumber then there are boilerplate repos they could use to get started.
2
u/2ERIX Mar 27 '24
Sorry for the assumption, but I am wary of starting any new Automator in a path that even mentions Cucumber as while the intention is good it’s not a great end state and I believe will actively impact their career.
Mocha is a boilerplate for various frameworks. Much more in use than cucumber and in line with development and testing practices.
WDIO with Mocha is a great solution. Cypress use it as well and if you use it with Playwright you can get some useful reuse patterns.
1
u/ThomasBronola May 23 '24
So just to make sure, mocha is better than cucumber for playwright?
Out of curiosity, where is cucumber best to use?
2
u/2ERIX May 23 '24
Mocha every day of the week. But Playwright has their own pattern you can use instead of Mocha. Same same but different. Mocha just allows familiarity of use case from dev to test.
Cucumber is best in salads and sandwiches. 🥗🥪
1
u/Puzzleheaded_Age4413 Mar 27 '24
I used to do automation with c# and selenium, and recently switched to playwright with js/ts. I find playwright easier to work with and it’s definetly easier to learn. Indeed there is less community support for playwright atm because it is relatively new, but the youtube tutorials plus the documentation provided by playwright’s website is more than enough to get you started.
1
u/French_Fried_Taterz Mar 28 '24 edited Mar 28 '24
If it is up to you and you know some python, do Pytest/Python /playwright. Don't bother learning typescript, it won't add that much value.
1
u/emphieishere Aug 22 '24
Selenium is unbearable shit. I can't stand it anymore. Will try Playwright and tell the difference. Selenium is not that bad until some complex stuff. Once you want to add auth proxy - you easier learn how to walk without legs. I mean yeah, there are posts and discussions about adding it with creating an extension, or whatever, but then it turns out dev team deprecated some methods, anything else.. Try to put in Selenium grid with docker - it won't work. I spent 3 days like an idiot, tried everything. Basic auth works, however, while proxy doesn't. Well maybe I am an idiot. But if it turns out that I can do proxauth on Playwright in 15 minutes - then bye-bye dinoSaur
1
u/DaftPunk_94 Sep 25 '25
How was the pivot to PW then ?
1
u/emphieishere Sep 25 '25
Like a breath of fresh air. Everything is indeed WAY simpler. Many things are in-built, including auth proxy, etc. I consider Selenium now to be absolute garbage. It might did its job in the past, but I just don't want to touch anymore
1
u/ikalamtech Oct 16 '24
I would say go with Playwright. Its much more easier compare to learning selenium. Community is growing & support from official team is also great. The best part of playwright is their capability for API Testing & Visual Testing. This is something very difficult to setup with Selenium. Also, the cross browser support with native browser engines is one of the plus point. No need of manually downloading chromedriver & sharing within the repo.
In terms of speed, its very difficult for selenium to beat Playwright because of their TCP connection request with native browser engine compare to javascript execution in selenium.
1
u/Lumpy_Ad_8528 Mar 26 '25
Selenium is a classic choice for web testing. It is very reliable across different browsers and languages. It has been around for a long time, so it has a huge community and plenty of resources. Selenium offers excellent stability and wide compatibility.
Playwright might be newer, but it's attracting attention with its speed and modern features. Developed by Microsoft, it handles complex scenarios better and supports Chrome, Firefox, and WebKit browsers out of the box. Playwright might be the right choice for you if you need best-in-class performance and flexibility.
So, it all comes down to what works best for your project! Please choose accordingly.
22
u/ElaborateCantaloupe Mar 27 '24
For beginners I think playwright is the easiest to understand and get started quickly.
That said, you can use selenium with JavaScript or typescript with webdriver.io so you’re not stuck with either Java or Python.