{"id":28663,"date":"2025-07-23T08:04:13","date_gmt":"2025-07-23T12:04:13","guid":{"rendered":"https:\/\/www.h2kinfosys.com\/blog\/?p=28663"},"modified":"2025-07-23T08:06:36","modified_gmt":"2025-07-23T12:06:36","slug":"how-to-extract-dynamic-text-in-tosca-using-xb-xbparametername","status":"publish","type":"post","link":"https:\/\/www.h2kinfosys.com\/blog\/how-to-extract-dynamic-text-in-tosca-using-xb-xbparametername\/","title":{"rendered":"How to Extract Dynamic Text in TOSCA Using XB {XB[ParameterName]}"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Introduction<\/strong><\/h2>\n\n\n\n<p>Dynamic content is one of the biggest challenges when it comes to automated testing. When you&#8217;re working with tools like Tricentis TOSCA, which emphasize model-based testing, handling dynamic text values that change across sessions becomes crucial. A frequent use case arises where a confirmation message or receipt text includes variable data like transaction amounts, timestamps, or user-specific messages.<\/p>\n\n\n\n<p>This blog post will walk you through exactly how to extract dynamic text in TOSCA using XB {XB[ParameterName]}, and configure your modules so TOSCA reliably recognizes and verifies ever-changing screen content.<\/p>\n\n\n\n<p>Whether you&#8217;re preparing for a TOSCA Certification Course, just starting out with <a href=\"https:\/\/www.h2kinfosys.com\/courses\/tosca-automation-tool-training-and-certification-program\/\">TOSCA Online Training for Beginners<\/a>, or looking to master practical automation strategies from a TOSCA Tutorial, this guide covers everything you need.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What is Dynamic Text in TOSCA?<\/strong><\/h2>\n\n\n\n<p>Dynamic text refers to screen content that changes between executions. For example, a success message might say:<\/p>\n\n\n\n<p>\u201cPurchase completed! We charged the total amount of $1284.1 to your credit card!\u201d<\/p>\n\n\n\n<p>Here, the dollar amount is a dynamic value. This poses a problem because if you scan this as a static text field and use the InnerText property, TOSCA may not be able to identify it during the next run. The amount may change, making the previously scanned value obsolete.<\/p>\n\n\n\n<p>Thus, to Extract Dynamic Text in TOSCA, we use dynamic placeholders like <code><strong>XB[ParameterName]<\/strong><\/code> to capture and reuse variable values.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Understanding the Use of InnerText and Why to Uncheck It<\/strong><\/h2>\n\n\n\n<p>When scanning elements using TOSCA&#8217;s module wizard, the property <code><strong>InnerText<\/strong><\/code> is often selected by default. This works fine for static messages. But in scenarios with dynamic text, such as financial confirmations, the content keeps changing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Example from Tricentis Obstacle Course<\/strong><\/h3>\n\n\n\n<p>In the page at<a href=\"https:\/\/obstaclecourse.tricentis.com\/Obstacles\/81012\" rel=\"nofollow noopener\" target=\"_blank\"> Obstacle Course &#8211; ID 81012<\/a>, the confirmation reads:<\/p>\n\n\n\n<p><strong>&#8220;<\/strong>Purchase completed! We charged the total amount of $1284.1 to your credit card!&#8221;<\/p>\n\n\n\n<p>If <code><strong>InnerText<\/strong><\/code> is selected, TOSCA expects this exact sentence in every test run, which leads to failure when the amount changes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Solution:<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Uncheck the<code><strong> InnerText<\/strong><\/code> property after scanning the text field.<br><\/li>\n\n\n\n<li>Instead, use the <code><strong>InterText<\/strong><\/code> property to validate and extract the changing portion.<br><\/li>\n<\/ul>\n\n\n\n<p>This small change is key to Extract Dynamic Text in TOSCA reliably.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to Extract Dynamic Text in TOSCA: Step-by-Step<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Scan the Success Message Element<\/strong><\/h3>\n\n\n\n<p>Use the TOSCA Scan feature to capture the success message after a simulated purchase.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Modify Properties<\/strong><\/h3>\n\n\n\n<p>In the module view:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Uncheck<\/strong> the property InnerText.<br><\/li>\n\n\n\n<li><strong>Check<\/strong> the InterText property if available or add it manually.<br><\/li>\n<\/ul>\n\n\n\n<p>This allows TOSCA to read the text content without enforcing exact static values.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Parameterize with XB<\/strong><\/h3>\n\n\n\n<p>Now, in your test case:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.InnerText == *We charged the total amount of {XB&#91;Amount]} to your credit card!*<\/code><\/pre>\n\n\n\n<p>Here\u2019s what happens:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>TOSCA captures the amount dynamically into the<code><strong> {XB[Amount]}<\/strong><\/code> variable.<br><\/li>\n\n\n\n<li>This allows you to Extract Dynamic Text in TOSCA and use it for further steps (e.g., logging or comparing with expected values).<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXfNZvSrBhvbHi_ARuyU8P0N9G4T0P8J-oH3M-SZZktzyGd0aOugur4gSzI7rhLjyPAGAdAaNgAgKOgp8gikOuHAuONLcZ45FntDsZrKV9oGvE692ERUP5IabMI5A22w2MzeTD4K?key=zm6F7y1X1qgPtU_pQp6VBA\" alt=\"Extract Dynamic Text in TOSCA\" title=\"\"><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXfl2izRuAbOQ7gxBeS6oKc6xihKmOFuzHin88XZahJa1P6DGKKGBQJKKW7BP9OKT3J7yyZEhXO9Yjt1X-o6yFy_sPrve0yU-PIk2xE2fFtw6uV9mjskhOJxFU2itJmmObgCQgVQ1A?key=zm6F7y1X1qgPtU_pQp6VBA\" alt=\"Extract Dynamic Text in TOSCA\" title=\"\"><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Use Captured Value<\/strong><\/h3>\n\n\n\n<p>You can now reuse <code><strong>{XB[Amount]}<\/strong><\/code> in later steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>For validation<br><\/li>\n\n\n\n<li>For log comparison<br><\/li>\n\n\n\n<li>For conditional decisions in your test flow<br><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Visual Reference from Test Setup<\/strong><\/h2>\n\n\n\n<p>From the screenshot, we can observe:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Success Message<\/strong> node configured with <code><strong>XB[Amount]<\/strong><\/code><br><\/li>\n<\/ol>\n\n\n\n<p>A value verification step for:<br><br>&#8230;total amount of {XB[Amount]} to your credit card!<\/p>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<p>This setup allows testers to Extract Dynamic Text in TOSCA and ensure the test case remains stable across changing values.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Logging Dynamic Values Using the Log Viewer<\/strong><\/h2>\n\n\n\n<p>Tricentis provides extensive support for logging during execution, as documented<a href=\"https:\/\/documentation.tricentis.com\/tosca\/2420\/en\/content\/tbox\/execution_logging.htm\" rel=\"nofollow noopener\" target=\"_blank\"> here<\/a>.<\/p>\n\n\n\n<p>When you Extract Dynamic Text in TOSCA using XB parameters, the log captures those values clearly. This is helpful for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Debugging<br><\/li>\n\n\n\n<li>Auditing automation results<br><\/li>\n\n\n\n<li>Verifying captured dynamic data<br><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Key Features of the TOSCA Log Viewer:<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>View test step outcomes<br><\/li>\n\n\n\n<li>See XB parameter values (like {XB[Amount]})<br><\/li>\n\n\n\n<li>Trace dynamic data flow throughout execution<br><\/li>\n\n\n\n<li>Identify failures caused by missing or mismatched dynamic text<br><\/li>\n<\/ul>\n\n\n\n<p>You can even export logs for team review or compliance records.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Why Not Use Static Verification?<\/strong><\/h2>\n\n\n\n<p>Let\u2019s explore a scenario:<\/p>\n\n\n\n<p><strong>Hardcoded Approach (Incorrect):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.InnerText == Purchase completed! We charged the total amount of $1284.1 to your credit card!<\/code><\/pre>\n\n\n\n<p>This will work <strong>only once<\/strong> and fail when the amount changes.<\/p>\n\n\n\n<p><strong>Dynamic Approach (Correct):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.InnerText == *We charged the total amount of {XB&#91;Amount]} to your credit card!*<\/code><\/pre>\n\n\n\n<p>The asterisk * is used for pattern matching, and {XB[Amount]} dynamically captures the number.<\/p>\n\n\n\n<p>This dynamic strategy ensures that TOSCA can handle live, changing data on real-world applications.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Common Use Cases for Extracting Dynamic Text<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>E-Commerce Platforms<\/strong><strong><br><\/strong>\n<ul class=\"wp-block-list\">\n<li>Capture transaction amounts<br><\/li>\n\n\n\n<li>Extract dynamic order numbers<br><\/li>\n\n\n\n<li>Log shipping confirmation messages<br><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Banking Applications<\/strong><strong><br><\/strong>\n<ul class=\"wp-block-list\">\n<li>Capture balances or transfer confirmations<br><\/li>\n\n\n\n<li>Validate dynamic interest rates or values<br><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Healthcare Systems<\/strong><strong><br><\/strong>\n<ul class=\"wp-block-list\">\n<li>Capture dynamically generated patient IDs<br><\/li>\n\n\n\n<li>Extract appointment confirmation details<br><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>By using the XB parameter model, you ensure reusability and stability in your test automation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to Reuse Extracted Values<\/strong><\/h2>\n\n\n\n<p>Once you Extract Dynamic Text in TOSCA, you can reuse it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>As input in later steps<\/strong><strong><br><\/strong><br>Input field = {XB&#91;Amount]}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>In conditional checks<\/strong><strong><br><\/strong><br>If {XB&#91;Amount]} &gt; 1000 \u2192 Apply discount logic<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>For logging or reporting<\/strong><strong><br><\/strong><br>Log: Transaction amount captured: {XB&#91;Amount]}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><\/li>\n<\/ul>\n\n\n\n<p>This is a key benefit of mastering how to Extract Dynamic Text in TOSCA.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Troubleshooting Dynamic Text Extraction<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Issue<\/strong><\/td><td><strong>Cause<\/strong><\/td><td><strong>Solution<\/strong><\/td><\/tr><tr><td>Text not captured<\/td><td>InnerText selected<\/td><td>Uncheck InnerText, use InterText<\/td><\/tr><tr><td>Value not reusable<\/td><td>Variable not defined<\/td><td>Define XB[ParameterName] properly<\/td><\/tr><tr><td>Pattern mismatch<\/td><td>No wildcards used<\/td><td>Add * for pattern flexibility<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Ensure your module and test case are both configured with dynamic intent, not hard-coded assumptions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Best Practices for Extracting Dynamic Text in TOSCA<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li> Always check for dynamically generated values during scan.<br><\/li>\n\n\n\n<li> Use * for wildcard pattern matching.<br><\/li>\n\n\n\n<li> Parameterize everything using XB[].<br><\/li>\n\n\n\n<li> Document what each parameter captures.<br><\/li>\n\n\n\n<li> Use Log Viewer to confirm your dynamic values are stored correctly.<br><\/li>\n\n\n\n<li> Avoid overreliance on InnerText.<br><\/li>\n<\/ul>\n\n\n\n<p>Mastering these practices to Extract Dynamic Text in TOSCA will elevate your TOSCA test design from brittle to robust.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Real-World Example Recap<\/strong><\/h2>\n\n\n\n<p>Let\u2019s revisit the example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Success Message:\u00a0\n\n.InnerText == *We charged the total amount of {XB&#91;Amount]} to your credit card!*<\/code><\/pre>\n\n\n\n<p>This approach ensures:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Stability across test runs<br><\/li>\n\n\n\n<li>Dynamic value capture<br><\/li>\n\n\n\n<li>Reusability in other test steps<br><\/li>\n<\/ul>\n\n\n\n<p>This is how you Extract Dynamic Text in TOSCA effectively and professionally.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Summary<\/strong><\/h2>\n\n\n\n<p>Dynamic content is common in real-world applications. TOSCA gives testers the power to capture and work with these changing values if configured correctly. By disabling the InnerText property and enabling parameterized InterText matching with XB[], your test cases become smarter, more flexible, and future-proof. These skills are foundational in any <a href=\"https:\/\/www.h2kinfosys.com\/courses\/tosca-automation-tool-training-and-certification-program\/\">TOSCA Certification Course<\/a>, especially when mastering advanced scenarios in a TOSCA Online Training For Beginners or hands-on TOSCA Tutorial.<\/p>\n\n\n\n<p>This guide demonstrated:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Why dynamic text extraction matters<br><\/li>\n\n\n\n<li>How to configure your TOSCA modules correctly<br><\/li>\n\n\n\n<li>The role of XB[ParameterName] for reusable values<br><\/li>\n\n\n\n<li>How logging with the TOSCA Log Viewer provides transparency<br><\/li>\n\n\n\n<li>Practical examples and best practices<br><\/li>\n<\/ul>\n\n\n\n<p>You now have a full toolkit to Extract Dynamic Text in TOSCA confidently and effectively in your automation projects. <\/p>\n\n\n\n<p><strong>Start applying the XB dynamic extraction model in your next TOSCA project and transform the way you handle dynamic content.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Dynamic content is one of the biggest challenges when it comes to automated testing. When you&#8217;re working with tools like Tricentis TOSCA, which emphasize model-based testing, handling dynamic text values that change across sessions becomes crucial. A frequent use case arises where a confirmation message or receipt text includes variable data like transaction amounts, [&hellip;]<\/p>\n","protected":false},"author":18,"featured_media":28664,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1994],"tags":[2178,331,2002],"class_list":["post-28663","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tosca-automation","tag-dynamic-text-extraction","tag-test-case-design","tag-tosca-automation"],"_links":{"self":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/28663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/comments?post=28663"}],"version-history":[{"count":0,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/28663\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media\/28664"}],"wp:attachment":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media?parent=28663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/categories?post=28663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/tags?post=28663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}