Spike - Selenium vs. Playwright

This page helps evaluate the options of using Selenium or Playwright for the element.

 

Key items to understand

  1. Can we interact with html elements well, consistently, reliably

  2. How is selenium interacting with:

    1. shadowdom

    2. servicenow

    3. tables

    4. nested iframes

    5. aria selectors

    6. visual validation

    7. websocket support?

  3. Are the selectors methods different from selenium vs. playwright? Which ones are more consistent and more reliable.

scenario

playwright

gtp

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
(android/chrome, IOS/safari)

mobile web browser support
(android/chrome, IOS/safari)

MFA Authenticator

Custom Implementation

Custom implementation

 

 

 

 

 

 

?

References:

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

  1. 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.

  2. Performance Needs:

    • For modern web applications requiring fast and reliable automation, Playwright could provide better performance and ease of handling dynamic content.

  3. Language Preferences:

    • If your team prefers working in languages other than JavaScript/TypeScript, Selenium offers better language support, especially for Java.

  4. Future-Proofing:

    • If you're looking to future-proof your automation framework with the latest web technologies and capabilities, Playwright is a strong contender.

  5. Integration and Ecosystem:

    • Selenium's mature ecosystem might offer more ready-to-use integrations and community support, which can be a significant advantage.

Related pages