Spike - Selenium vs. Playwright
This page helps evaluate the options of using Selenium or Playwright for the element.
Â
Key items to understand
Can we interact with html elements well, consistently, reliably
How is selenium interacting with:
shadowdom
servicenow
tables
nested iframes
aria selectors
visual validation
websocket support?
Are the selectors methods different from selenium vs. playwright? Which ones are more consistent and more reliable.
scenario | playwright | gtp |
---|---|---|
shadowdom | handles shadom dom natively | needs JavaScript handling with root path |
servicenow | since newer version have shadow dom and service now generally has many iframes, both are taken care natively | since newer version have shadow dom and service now generally has many iframes, switching of iframes and shadwom root path is required |
tables | select record in table based on primary field | select record based on position in table  can break if records are in different order |
nested iframes | automatically considers iframe part of the selector. | need to switch context to iframe |
aria selectors | commonly supported, and very reliable because it is used by | css selector algorithm might consider, not explicitly supported. |
visual validation | natively supports visual validation | third party java library integration for visual library |
websocket support | yes | yes, while executing on cloud |
deciem credit card fields | Â | Â |
STC custom selector | records based on attributes preference of playwright | added support for custom tags from extension as requested by STC which will work for selenium as well |
STC java applet | Â | Â |
brambleberry ??? | Â | Â |
Auto-Wait | Natively waits for the action to be executed | Custom Implementation |
Element selection | Playwright native debugger tool | Custom implementation |
Execution speed | fast | slow |
Support for multiple Front-End frame works (angular, react, etc.) | supports natively | custom implementation |
Actions | support natively | custom implementation |
API Step | custom implementation | custom implementation |
Mobile support | mobile web browser support | mobile web browser support |
MFA Authenticator | Custom Implementation | Custom implementation |
Â
Â
Â
Â
Â
Â
?
References:
Selectors in playwright vs. selenium vs. cyprus:
Playwright vs Selenium vs Cypress: A Detailed Comparison | LambdaTestWebsocket support: WebSocket | Playwright Python
Â
Â
Aspect | Selenium | Playwright |
Pros | Â | Â |
Mature Ecosystem | Well-established ecosystem with extensive community support. | Modern architecture designed for fast, reliable automation. |
 | Supports a wide range of browsers and platforms. | Supports latest browser features out-of-the-box. |
Language Support | Supports multiple programming languages (Java, C#, Python, Ruby, JavaScript). | Primarily supports JavaScript/TypeScript with bindings for Python, C#, Java. |
Extensive Documentation | Comprehensive documentation and numerous tutorials, guides, and resources. | Provides detailed documentation and growing resource base. |
Flexible Integration | Easy integration with CI/CD tools, test frameworks (JUnit, TestNG), and other QA tools. | Built-in features for handling modern web features (network interception, geolocation, etc.). |
Rich Feature Set | Features like handling multiple windows, alerts, iframes, and executing JavaScript. | Handles dynamic content, auto-waits for elements, supports both headless and headed modes. |
 |  | Allows multi-context testing for parallel efficiency. |
Cons | Â | Â |
Performance | Slower compared to newer tools like Playwright, especially for complex interactions. | Limited language support compared to Selenium. |
Element Handling | Challenging to handle dynamic elements, often requiring explicit waits and retries. | Ecosystem and community support are still growing. |
API Complexity | Verbose and sometimes complex API for advanced interactions. | Integration with existing tools and frameworks might require more effort. |
Decision Factors
Existing Infrastructure:
If you already have a well-established Selenium setup and your team is proficient with it, the transition to Playwright might involve a learning curve and migration effort.
Performance Needs:
For modern web applications requiring fast and reliable automation, Playwright could provide better performance and ease of handling dynamic content.
Language Preferences:
If your team prefers working in languages other than JavaScript/TypeScript, Selenium offers better language support, especially for Java.
Future-Proofing:
If you're looking to future-proof your automation framework with the latest web technologies and capabilities, Playwright is a strong contender.
Integration and Ecosystem:
Selenium's mature ecosystem might offer more ready-to-use integrations and community support, which can be a significant advantage.