Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 14, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 14, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 14, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 14, 2025

      I test a lot of AI coding tools, and this stunning new OpenAI release just saved me days of work

      May 14, 2025

      How to use your Android phone as a webcam when your laptop’s default won’t cut it

      May 14, 2025

      The 5 most customizable Linux desktop environments – when you want it your way

      May 14, 2025

      Gen AI use at work saps our motivation even as it boosts productivity, new research shows

      May 14, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Strategic Cloud Partner: Key to Business Success, Not Just Tech

      May 14, 2025
      Recent

      Strategic Cloud Partner: Key to Business Success, Not Just Tech

      May 14, 2025

      Perficient’s “What If? So What?” Podcast Wins Gold at the 2025 Hermes Creative Awards

      May 14, 2025

      PIM for Azure Resources

      May 14, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Windows 11 24H2’s Settings now bundles FAQs section to tell you more about your system

      May 14, 2025
      Recent

      Windows 11 24H2’s Settings now bundles FAQs section to tell you more about your system

      May 14, 2025

      You can now share an app/browser window with Copilot Vision to help you with different tasks

      May 14, 2025

      Microsoft will gradually retire SharePoint Alerts over the next two years

      May 14, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Understanding Java Enum ConditionType in Katalon Studio. Pt2

    Understanding Java Enum ConditionType in Katalon Studio. Pt2

    June 29, 2024

    Introduction

    In this follow-up blog, we will explore the remaining condition types available in the ConditionType enum. Understanding these additional condition types will further enhance your ability to create robust and flexible test automation scripts in Katalon Studio. Each condition type serves a unique purpose in defining criteria for identifying and interacting with web elements, ensuring the reliability and accuracy of your automated tests.

     

    ConditionType Overview

    MATCHES_REGEX

    The MATCHES_REGEX condition type checks if a web element’s attribute or text content matches a specific regular expression pattern. This is similar to the EXPRESSION condition type but allows you to use a pre-defined regular expression instead of creating a custom expression.

    Example: To check if a text input field’s value matches a phone number format, you can use the MATCHES_REGEX condition type:

    TestObject phoneField = new TestObject(“phoneInput”);

    phoneField.addProperty(“value”, ConditionType.MATCHES_REGEX, “^\d{3}-\d{3}-\d{4}$”);

     

    In this example, Katalon Studio will verify if the phone input field’s value matches the pattern XXX-XXX-XXXX.

     

    NOT_CONTAIN

    The NOT_CONTAIN condition type is the opposite of the CONTAINS condition type. It checks if a web element’s attribute or text content does not contain a specific value.

    Example: To ensure that a button’s text does not contain the word “Cancel”, use the NOT_CONTAIN condition type:

    TestObject button = new TestObject(“submitButton”);

    button.addProperty(“text”, ConditionType.NOT_CONTAIN, “Cancel”);

     

    Here, Katalon Studio will identify buttons whose text does not include the word “Cancel”.

     

    NOT_EQUAL

    The NOT_EQUAL condition type is the opposite of the EQUALS condition type. It checks if a web element’s attribute or text content does not exactly match a specific value.

    Example: To verify that a text input field’s value is not “John Doe”, use the NOT_EQUAL condition type:

    TestObject nameField = new TestObject(“nameInput”);

    nameField.addProperty(“value”, ConditionType.NOT_EQUAL, “John Doe”);

     

    In this scenario, Katalon Studio will ensure that the input field’s value is not “John Doe”.

     

    NOT_MATCH_REGEX

    The NOT_MATCH_REGEX condition type is the opposite of the MATCHES_REGEX condition type. It checks if a web element’s attribute or text content does not match a specific regular expression pattern.

    Example: To ensure that a text input field’s value does not match a phone number format, use the NOT_MATCH_REGEX condition type:

    TestObject phoneField = new TestObject(“phoneInput”);

    phoneField.addProperty(“value”, ConditionType.NOT_MATCH_REGEX, “^\d{3}-\d{3}-\d{4}$”);

     

    Here, Katalon Studio will verify that the phone input field’s value does not match the pattern XXX-XXX-XXXX.

     

    STARTS_WITH

    The STARTS_WITH condition type checks if a web element’s attribute or text content starts with a specific value. This can be useful for verifying that an element’s content has a specific prefix.

    Example: To check if a link’s URL starts with “https://”, use the STARTS_WITH condition type:

    TestObject link = new TestObject(“websiteLink”);

    link.addProperty(“href”, ConditionType.STARTS_WITH, “https://”);

     

    In this example, Katalon Studio will identify link elements whose href attribute starts with “https://”.

     

    Practical Examples

    Let’s explore some comprehensive practical examples that demonstrate how to use these condition types in real-world scenarios.

    Scenario 1: Validate Phone Number Format

    You need to verify that a phone number input field matches the format XXX-XXX-XXXX.

    TestObject phoneField = new TestObject(“phoneInput”);

    phoneField.addProperty(“value”, ConditionType.MATCHES_REGEX, “^\d{3}-\d{3}-\d{4}$”);

    WebUI.verifyElementPresent(phoneField, 10);

     

    Scenario 2: Ensure Button Text Excludes Specific Word

    To ensure that a button’s text does not contain the word “Cancel”, use the NOT_CONTAIN condition type.

    TestObject button = new TestObject(“submitButton”);

    button.addProperty(“text”, ConditionType.NOT_CONTAIN, “Cancel”);

    WebUI.verifyElementPresent(button, 10);

     

    Scenario 3: Verify Non-Matching Input Value

    To check that a text input field’s value is not “John Doe”, use the NOT_EQUAL condition type.

    TestObject nameField = new TestObject(“nameInput”);

    nameField.addProperty(“value”, ConditionType.NOT_EQUAL, “John Doe”);

    WebUI.verifyElementPresent(nameField, 10);

     

    Scenario 4: Validate Non-Matching Pattern

    Ensure that a text input field’s value does not match a specific phone number pattern.

    TestObject phoneField = new TestObject(“phoneInput”);

    phoneField.addProperty(“value”, ConditionType.NOT_MATCH_REGEX, “^\d{3}-\d{3}-\d{4}$”);

    WebUI.verifyElementPresent(phoneField, 10);

     

    Scenario 5: Check URL Prefix

    To verify that a link’s URL starts with “https://”, use the STARTS_WITH condition type.

    TestObject link = new TestObject(“websiteLink”);

    link.addProperty(“href”, ConditionType.STARTS_WITH, “https://”);

    WebUI.verifyElementPresent(link, 10);

     

    Best Practices

    To maximize the effectiveness of the ConditionType enum in Katalon Studio, follow these best practices:

    Clear Naming: Name your TestObject instances descriptively to reflect their purpose.
    Combine Conditions: Use multiple properties and condition types to refine element identification.
    Validate Regularly: Regularly validate your tests to ensure condition types are correctly implemented.
    Optimize Performance: Avoid overly complex expressions that might impact test execution performance.
    Document Tests: Provide comments and documentation for complex condition types to aid future maintenance.

     

    Conclusion

    The additional ConditionType options in Katalon Studio provide even more flexibility and precision in defining criteria for identifying and interacting with web elements. By understanding and effectively utilizing these condition types, you can create more robust and reliable automated tests.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous Articledragon-code/laravel-deploy-operations
    Next Article Look out, Meta Ray-Bans: These are the world’s first smart glasses with GPT-4o

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 15, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-4695 – PHPGurukul Cyber Cafe Management System SQL Injection

    May 15, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    European Accessibility Act : What You Need to Know

    Development

    Getting Started with Azure DevOps Boards and Repos

    Development

    EU’s Breton vs. X’s Musk: The Duo Spar after the Latter’s Platform was Found in Breach of the Digital Services Act

    Development

    Twilio Unveils Next-Generation Customer Engagement Platform Built for an AI and Data-Powered World at SIGNAL 2025

    Tech & Work

    Highlights

    Volaris for Desktop – wrapper for Volaris

    February 26, 2025

    Volaris GUI is a sleek and modern application designed to streamline the process of file…

    A bizarre iOS 18.4 bug is surprising iPhone users with random app installs

    April 3, 2025

    Cybersecurity Week in Review: Ransomware Busts, Data Breaches & More

    July 28, 2024

    Exploring Model Training Platforms: Comparing Cloud, Central, Federated Learning, On-Device Machine Learning ML, and Other Techniques

    April 26, 2024
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.