<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Arpita Biswas on Medium]]></title>
        <description><![CDATA[Stories by Arpita Biswas on Medium]]></description>
        <link>https://medium.com/@biswasarpita?source=rss-b33ca3c818a9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*UmU5QRlA6UGnGQTR.jpg</url>
            <title>Stories by Arpita Biswas on Medium</title>
            <link>https://medium.com/@biswasarpita?source=rss-b33ca3c818a9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 00:47:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@biswasarpita/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Playwright Naming Conventions: Why Test Files Use .spec.ts Instead of .ts]]></title>
            <link>https://biswasarpita.medium.com/playwright-naming-conventions-why-test-files-use-spec-ts-instead-of-ts-8a5a96a81883?source=rss-b33ca3c818a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a5a96a81883</guid>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[playwright-test]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[automation-testing]]></category>
            <dc:creator><![CDATA[Arpita Biswas]]></dc:creator>
            <pubDate>Wed, 22 Jul 2026 10:09:51 GMT</pubDate>
            <atom:updated>2026-07-23T07:57:09.408Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JgWUBNWoxsgj6tyXOA-i3A.png" /><figcaption>A quick visual guide to understanding why Playwright uses .spec.ts for test files and .ts for reusable code.</figcaption></figure><h3>Why Playwright Test Files Are Named .spec.ts Instead of .ts</h3><p>When you start working with Playwright, one of the first things you notice is that most test files are named with the .spec.ts extension instead of simply .ts. This often leads to a common question. Is .spec.ts mandatory, or is it just a convention?</p><p>The answer is that .spec.ts is a convention that Playwright uses by default to identify test files. It is not a TypeScript requirement.</p><p>Example:</p><p>with <strong><em>.spec.ts</em></strong> extension: No error: From my editor:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*PGOU-SlML-NlJBKn0_OpkA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*hgBth-rO3m6EO5xC_VcseA.png" /></figure><p>With <strong><em>.ts</em></strong> extension: Getting error: “No tests found”: From my editor:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*xVgTBFVOlHDBmYIGHoD_aA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*qCV92iZYc7yzekfVo9NEkg.png" /></figure><h3>Understanding the Difference</h3><p>A file with the .ts extension is simply a TypeScript file. It can contain any TypeScript code such as utility functions, page objects, configuration classes, data models, or helper methods.</p><p>A file with the .spec.ts extension is intended to contain automated test cases. The word &quot;spec&quot; stands for specification because the file describes how the application is expected to behave.</p><p>For example, a Playwright project might look like this:</p><pre>tests<br>    login.spec.ts<br>    checkout.spec.ts<br>    search.spec.ts</pre><pre>pages<br>    LoginPage.ts<br>    CheckoutPage.ts</pre><pre>utils<br>    helpers.ts</pre><p>In this structure, the files ending with .spec.ts contain the test scenarios, while the .ts files contain reusable code that supports those tests.</p><h3>How Playwright Finds Test Files</h3><p>When you execute the following command:</p><pre>npx playwright test</pre><p>Playwright searches for files that match its default naming pattern. By default, it looks for files ending with .spec.ts or .test.ts.</p><p>This allows Playwright to automatically discover all your test cases without any additional configuration.</p><p>If you create a file named login.ts inside the tests folder, Playwright will ignore it unless you modify the configuration.</p><h3>Why Use .spec.ts Instead of .ts</h3><p>Using .spec.ts makes the purpose of the file immediately clear. Anyone opening the project can quickly distinguish between test files and supporting code.</p><p>For example:</p><p>login.spec.ts</p><p>This file contains test cases.</p><p>LoginPage.ts</p><p>This file contains the Page Object Model implementation.</p><p>testData.ts</p><p>This file stores reusable test data.</p><p>This naming convention improves readability and makes the project easier to maintain as it grows.</p><h3>Can You Use .ts for Test Files</h3><p>Yes, you can.</p><p>Playwright allows you to customize the file pattern using the testMatch option in playwright.config.ts.</p><p>For example:</p><pre>import { defineConfig } from &#39;@playwright/test&#39;;</pre><pre>export default defineConfig({<br>  testDir: &#39;./tests&#39;,<br>  testMatch: &#39;**/*.ts&#39;,<br>});</pre><p>With this configuration, Playwright treats every .ts file inside the test directory as a test file.</p><p>Although this is possible, it is generally not recommended.</p><h3>The Problem with Using Only .ts</h3><p>Imagine your project contains the following files:</p><pre>tests<br>    login.ts<br>    helpers.ts<br>    users.ts</pre><p>When Playwright scans the directory, it attempts to execute every .ts file.</p><p>Files like helpers.ts and users.ts are not test files. Since they do not contain any test cases, Playwright may report messages indicating that no tests were found or unnecessarily process files that are not meant to be executed.</p><p>Using .spec.ts avoids this confusion by clearly separating executable tests from reusable code.</p><h3>Benefits of Using .spec.ts</h3><p>Using .spec.ts offers several advantages.</p><p>It makes test discovery automatic.</p><p>It separates tests from business logic and helper classes.</p><p>It improves project organization.</p><p>It follows the Playwright community standard.</p><p>It makes onboarding easier for new team members.</p><p>It helps IDEs and development tools identify test files more accurately.</p><h3>Recommended Project Structure</h3><p>A clean Playwright project usually follows a structure like this:</p><pre>project<br>│<br>├── tests<br>│   ├── login.spec.ts<br>│   ├── checkout.spec.ts<br>│   └── search.spec.ts<br>│<br>├── pages<br>│   ├── LoginPage.ts<br>│   ├── CheckoutPage.ts<br>│   └── SearchPage.ts<br>│<br>├── utils<br>│   ├── helpers.ts<br>│   └── constants.ts<br>│<br>├── playwright.config.ts<br>└── package.json</pre><p>This organization makes it easy to locate tests, reusable page objects, utility methods, and configuration files.</p><h3>Best Practices</h3><p>Use .spec.ts for all Playwright test files.</p><p>Use .ts for Page Object Model classes, utility functions, test data, fixtures, and helper methods.</p><p>Avoid placing helper files inside the test folder unless necessary.</p><p>Keep test cases focused on validating application behavior while moving reusable logic into separate TypeScript files.</p><h3>Conclusion</h3><p>The .spec.ts extension is not mandatory, but it is the recommended convention for Playwright projects. It helps Playwright automatically discover test files, keeps your project organized, and makes the codebase easier to understand.</p><p>While you can configure Playwright to execute any .ts file, following the standard .spec.ts naming convention is considered a best practice. It improves readability, reduces confusion, and aligns your project with the conventions used by most Playwright developers and teams.</p><p>If you are interested in these topics and found this helpful, feel free to follow me on medium and LinkedIn. I’d appreciate your suggestions and feedback</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a5a96a81883" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Playwright Workers: Master Parallel Execution for Faster and Scalable Test Automation]]></title>
            <link>https://biswasarpita.medium.com/playwright-parallel-execution-explained-understanding-workers-browsers-and-test-distribution-9a0a5e11b57c?source=rss-b33ca3c818a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a0a5e11b57c</guid>
            <category><![CDATA[playwrights]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[parallelism]]></category>
            <category><![CDATA[test-automation]]></category>
            <dc:creator><![CDATA[Arpita Biswas]]></dc:creator>
            <pubDate>Fri, 10 Jul 2026 16:37:28 GMT</pubDate>
            <atom:updated>2026-07-10T17:01:13.506Z</atom:updated>
            <content:encoded><![CDATA[<h3>A deep dive into how Playwright executes tests using workers, why workers: 3 does not always mean three parallel tests, and how to design faster test suites.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Dd3ZwqKN4-CPm7VzzVvDw.png" /><figcaption><strong>Understanding Playwright Parallel Execution</strong><br> <em>How Workers, Browsers, and Test Distribution Really Work</em></figcaption></figure><p>Modern automation framework suites can contain hundreds or thousands of tests. Running them sequentially can take hours.</p><p>To solve this problem, Playwright provides <strong>parallel execution using workers</strong>.</p><p>But many automation engineers misunderstand one thing:</p><blockquote><em>“If I set </em><em>workers: 3, will Playwright run three tests at the same time?&quot;</em></blockquote><p>The answer depends on how your tests are organized.</p><p>Understanding the worker model is critical for designing a fast and stable Playwright framework.</p><p>A common assumption is:</p><blockquote><em>“If I configure </em><em>workers: 3, Playwright will run three tests at the same time.&quot;</em></blockquote><p>But that is not always true.</p><p>To use Playwright parallel execution effectively, we need to understand:</p><ul><li>What a worker actually is</li><li>How Playwright distributes tests</li><li>The relationship between workers, browsers, contexts, and pages</li><li>Why tests inside one file run sequentially by default</li><li>How to enable parallel execution inside a test file</li></ul><p>Let’s break it down.</p><h3>What Is a Worker in Playwright?</h3><p>A <strong>worker</strong> is an independent process created by Playwright to execute tests.</p><p>Think of workers as multiple employees working on different tasks.</p><p>If your configuration contains:</p><p><em>// playwright.config.js</em></p><pre>export default defineConfig({<br>    workers: 3<br>});</pre><p>You are telling Playwright:</p><blockquote><em>“You can create up to three workers to execute my test suite.”</em></blockquote><p>The important word here is <strong>up to</strong>.</p><p>Playwright will not always use all three workers. It depends on how much work is available.</p><h3>Understanding Playwright Execution Architecture</h3><p>Before understanding parallel execution, let’s understand the hierarchy.</p><pre>                    Playwright Test Runner<br>                              |<br>          -----------------------------------------<br>          |                   |                   |<br>       Worker 1            Worker 2            Worker 3<br>          |                   |                   |<br>      Browser             Browser             Browser<br>          |                   |                   |<br>   Browser Context   Browser Context   Browser Context<br>          |                   |                   |<br>        Page              Page              Page<br>          |<br>        Test</pre><p>Each worker is isolated.</p><p>A worker has:</p><ul><li>Its own Node.js process</li><li>Its own browser instance</li><li>Its own browser context</li><li>Its own page</li><li>Its own test execution lifecycle</li></ul><h3>Does workers: 3 Mean Three Browsers?</h3><p>The answer is:</p><p><strong>Not exactly.</strong></p><p>workers: 3 means:</p><blockquote><em>Playwright can create three independent execution processes.</em></blockquote><p>Because every worker usually launches its own browser, you may see:</p><p>Worker 1 → Chromium Browser<br>Worker 2 → Chromium Browser<br>Worker 3 → Chromium Browser</p><p>But the main concept is the <strong>worker</strong>, not the browser.</p><h3>How Does Playwright Distribute Tests?</h3><p>The most important thing to remember:</p><blockquote><em>By default, Playwright distributes work at the test file level.</em></blockquote><p>Let’s take an example.</p><p>Project:</p><p><em>tests/</em></p><p><em>login.spec.js</em></p><p><em>cart.spec.js</em></p><p><em>checkout.spec.js</em></p><p>Configuration:</p><p>workers: 3</p><p>Playwright can execute:</p><p>Worker 1 → login.spec.js<br>Worker 2 → cart.spec.js<br>Worker 3 → checkout.spec.js</p><p>All three files can run at the same time.</p><p>This is where parallel execution provides a huge speed improvement.</p><h3>Example: More Test Files Than Workers</h3><p>Suppose we have:</p><p><em>login.spec.js<br>cart.spec.js<br>checkout.spec.js<br>profile.spec.js<br>orders.spec.js</em></p><p>And:</p><pre>workers: 3</pre><p>Execution flow:</p><p>Time →</p><p>Worker 1:<br><em>login.spec.js</em> — — — — profile.spec.js</p><p>Worker 2:<br><em>cart.spec.js </em>— — — — — orders.spec.js</p><p>Worker 3:<br><em>checkout.spec.js</em></p><p>When one worker finishes its assigned file, Playwright assigns another available file.</p><p>Workers stay busy until the complete test suite finishes.</p><h3>The Most Common Confusion</h3><p>Now let’s look at a scenario where many people get confused.</p><p>Imagine we have only one test file:<br><em>login.spec.js</em></p><p>Test 1<br>Test 2<br>Test 3<br>Test 4<br>Test 5</p><p>Configuration:</p><pre>workers: 3</pre><p>Many people expect:</p><p>Worker 1 → Test 1</p><p>Worker 2 → Test 2</p><p>Worker 3 → Test 3</p><p>But this is NOT the default behaviour.</p><p>The actual execution:</p><p>Worker 1<br> |<br> <em>login.spec.js</em><br> |<br> Test 1<br> |<br> Test 2<br> |<br> Test 3<br> |<br> Test 4<br> |<br> Test 5</p><p>Worker 2<br> |<br> Idle</p><p>Worker 3<br> |<br> Idle</p><p>Only one worker is used.</p><h3>Why Doesn’t Playwright Split One File Automatically?</h3><p>Because the default scheduling unit is:</p><p>Test File</p><p>not:</p><p>Individual Test</p><p>Think about workers as employees.</p><p>You have:</p><p>Employee 1<br>Employee 2<br>Employee 3</p><p>But only one assignment:</p><p><em>login.spec.js</em></p><p>One employee takes the assignment.</p><p>The others have nothing to do.</p><p>Worker 1 → login.spec.js</p><p>Worker 2 → Waiting</p><p>Worker 3 → Waiting</p><h3>How Does Playwright Maintain Test Order?</h3><p>Consider:</p><pre>test(&quot;Login&quot;, async ({page}) =&gt; {<br>});</pre><pre>test(&quot;Search&quot;, async ({page}) =&gt; {<br>});</pre><pre>test(&quot;Checkout&quot;, async ({page}) =&gt; {<br>});</pre><p>When Playwright loads the file, it registers tests in order:</p><p>1. Login<br>2. Search<br>3. Checkout</p><p>Execution:</p><p>Worker 1</p><p>Login<br> |<br> ↓<br>Search<br> |<br> ↓<br>Checkout</p><p>Because only one worker owns that file, the order is maintained.</p><h3>What Happens If One Test Fails?</h3><p>By default:</p><p>Test 1 ❌</p><p>↓</p><p>Test 2 ✅</p><p>↓</p><p>Test 3 ✅</p><p>Playwright continues executing remaining tests.</p><p>Each test receives a fresh browser context, which prevents tests from affecting each other.</p><h3>Running Tests Inside One File in Parallel</h3><p>Playwright allows parallel execution inside a file.</p><p>Example:</p><pre>test.describe.configure({<br>    mode: &quot;parallel&quot;<br>});</pre><p>Now tests can be distributed across workers.</p><p>Example:</p><p>Worker 1 → Test 1</p><p>Worker 2 → Test 2</p><p>Worker 3 → Test 3</p><p>After completion:</p><p>Worker 1 → Test 4</p><p>Worker 2 → Test 5</p><p>Now multiple workers are being utilized.</p><h3>Sequential vs Parallel Execution</h3><h3>Default ModeWorker 1</h3><p>Worker 1</p><p>Test 1<br> |<br>Test 2<br> |<br>Test 3<br> |<br>Test 4</p><p>One file runs sequentially.</p><h3>Parallel Mode</h3><p>Multiple tests execute simultaneously.</p><p>Worker 1 → Test 1</p><p>Worker 2 → Test 2</p><p>Worker 3 → Test 3</p><p>Multiple tests execute simultaneously.</p><h3>Worker vs Browser vs Context</h3><p>A common interview question:</p><h3>Does every worker have its own browser?</h3><p>Usually yes.</p><p>Example:</p><p>Worker 1<br> |<br> Browser<br> |<br> Context<br> |<br> Page<br> |<br> Test</p><p>and:</p><p>Worker 2<br> |<br> Browser<br> |<br> Context<br> |<br> Page<br> |<br> Test</p><p>Workers are isolated from each other.</p><h3>Best Practices for Playwright Parallel Execution</h3><h3>1. Keep Tests Independent</h3><p>Avoid this:</p><p>Test 1:<br>Create user</p><p>Test 2:<br>Use same user</p><p>Test 3:<br>Delete user</p><p>Parallel execution may create conflicts.</p><h3>2. Split Large Test Files</h3><p>Instead of:</p><p><em>application.spec.js</em></p><p>100 tests</p><p>Prefer:</p><p><em>login.spec.js<br>cart.spec.js<br>checkout.spec.js<br>profile.spec.js</em></p><p>This allows Playwright to distribute work across workers.</p><h3>3. Do Not Increase Workers Blindly</h3><p>More workers do not always mean faster execution.</p><p>Too many workers can cause:</p><ul><li>High CPU usage</li><li>Memory issues</li><li>Browser crashes</li><li>Application overload</li></ul><p>Choose a reasonable worker count based on your machine and application.</p><h3>Common Interview Questions</h3><h3>Q1: Does workers: 3 mean three tests execute together?</h3><p>Answer:</p><p>No.</p><p>It means Playwright can create three parallel workers. By default, workers execute different test files.</p><h3>Q2: I have one file with 50 tests. Will increasing workers make it faster?</h3><p>Answer:</p><p>No.</p><p>Without parallel mode, one worker executes that file sequentially.</p><h3>Q3: How can tests inside the same file run in parallel?</h3><p>Answer:</p><p>Use:</p><pre>test.describe.configure({<br>    mode: &quot;parallel&quot;<br>});</pre><h3>Q4: Why not enable parallel mode everywhere?</h3><p>Because tests must be independent.</p><p>Shared data, users, files, or environments can create failures.</p><h3>Final Mental Model</h3><p>Remember this simple hierarchy:</p><pre>Workers<br>   |<br>   |<br>Test Files<br>   |<br>   |<br>Test Cases</pre><p>Default:</p><pre>Worker → Test File → Tests sequentially</pre><p>Parallel mode:</p><pre>Workers → Individual Tests</pre><h3>Conclusion</h3><p>Playwright workers are powerful, but understanding their execution model is the key to using them correctly.</p><p>workers: 3 does not simply mean three tests will run simultaneously.</p><p>It means Playwright has three independent execution engines available.</p><p>By default:</p><ul><li>Workers execute test files in parallel</li><li>Tests inside a file run sequentially</li><li>One file usually uses one worker</li></ul><p>For maximum performance:</p><ul><li>Create smaller independent test files</li><li>Use appropriate worker counts</li><li>Enable parallel mode only when tests are truly independent</li></ul><p>Once you understand workers, Playwright parallel execution becomes predictable, scalable, and much easier to optimize.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a0a5e11b57c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[First Listen, Then Trigger: Avoiding Flaky Tests in Playwright | Why Promise.all]]></title>
            <link>https://biswasarpita.medium.com/why-promise-all-83bb7c6c2a12?source=rss-b33ca3c818a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/83bb7c6c2a12</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <dc:creator><![CDATA[Arpita Biswas]]></dc:creator>
            <pubDate>Sat, 04 Jul 2026 07:34:17 GMT</pubDate>
            <atom:updated>2026-07-10T14:14:45.236Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>First Listen, Then Trigger: Avoiding Flaky Tests in Playwright | </strong>Why Promise.all Works in Playwright When Waiting for a New Page</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KBBPTmOdDQdlLMDYD3UM4Q.png" /><figcaption><strong>First Listen, Then Trigger: Avoiding Flaky Tests in Playwright</strong></figcaption></figure><p>Understanding why event listeners must be set before triggering actions when using Promise.all to handle new pages and other asynchronous events.</p><p>When working with Playwright, one of the most common automation scenarios is handling a newly opened browser tab or window. At first glance, the code looks straightforward, but the order in which asynchronous operations are executed makes a huge difference.</p><p>Consider the following implementation.</p><pre>const [newPage] = await Promise.all([<br>  context.waitForEvent(&#39;page&#39;),<br>  newWindowBtn.click()<br>]);</pre><p>This works perfectly.</p><p>However, many beginners try something like this.</p><pre>await Promise.all([<br>  newWindowBtn.click(),<br>  context.waitForEvent(&#39;page&#39;)<br>]);</pre><p>Surprisingly, this often fails.</p><p>Understanding why requires a deeper look into asynchronous execution and event listeners in JavaScript.</p><h3>The Problem</h3><p>When a button click opens a new browser tab, Playwright emits a page event on the browser context.</p><p>To capture that event successfully, Playwright must already be listening for it before the click happens.</p><p>In the working example, the event listener is registered first.</p><pre>context.waitForEvent(&#39;page&#39;)</pre><p>At this point, Playwright is ready and waiting.</p><p>Immediately afterward, the click action is executed.</p><pre>newWindowBtn.click()</pre><p>The click triggers the creation of the new tab, and because the listener is already active, Playwright catches the event successfully.</p><p>Both operations run concurrently through Promise.all, which means Playwright starts waiting for the event at the same time the click action is initiated.</p><p>The Promise.all call completes only when both promises are fulfilled.</p><h3>Why Reversing the Order Can Fail</h3><p>Now consider this version.</p><pre>await Promise.all([<br>  newWindowBtn.click(),<br>  context.waitForEvent(&#39;page&#39;)<br>]);</pre><p>The click action is initiated first.</p><p>If the browser opens the new page very quickly, the page event may fire before Playwright has finished attaching the listener.</p><p>By the time waitForEvent begins listening, the event has already happened.</p><p>As a result, Playwright keeps waiting for an event that has already been emitted, causing the test to hang or eventually timeout.</p><p>This situation is similar to missing a phone call.</p><p>If someone calls before you pick up your phone, you miss the call.</p><p>Waiting for the event first is like having the phone in your hand before the call arrives.</p><p>Clicking first is like reaching for your phone after it has already stopped ringing.</p><h3>Understanding Promise.all</h3><p>Many developers assume Promise.all executes tasks sequentially, but that is not how it works.</p><p>Promise.all starts all provided promises immediately.</p><p>However, the expressions inside the array are evaluated from left to right.</p><p>That subtle detail is important.</p><p>In this example:</p><pre>await Promise.all([<br>  context.waitForEvent(&#39;page&#39;),<br>  newWindowBtn.click()<br>]);</pre><p>Playwright begins listening for the page event before initiating the click.</p><p>That ordering ensures the event is never missed.</p><p>This pattern is considered a best practice whenever an action triggers an event.</p><p>Examples include:</p><p>Waiting for a popup window</p><p>Waiting for a file download</p><p>Waiting for a network request</p><p>Waiting for a dialog box</p><p>Waiting for navigation</p><p>For example:</p><pre>const [download] = await Promise.all([<br>  page.waitForEvent(&#39;download&#39;),<br>  page.locator(&#39;#downloadButton&#39;).click()<br>]);</pre><p>Or:</p><pre>await Promise.all([<br>  page.waitForNavigation(),<br>  page.locator(&#39;#submit&#39;).click()<br>]);</pre><p>The principle remains the same.</p><p>Always start waiting before triggering the action that causes the event.</p><h3>Key Takeaway</h3><p>When handling events in Playwright, the safest approach is to register the listener first and then perform the action.</p><p>Instead of this:</p><pre>await Promise.all([<br>  newWindowBtn.click(),<br>  context.waitForEvent(&#39;page&#39;)<br>]);</pre><p>Use this:</p><pre>const [newPage] = await Promise.all([<br>  context.waitForEvent(&#39;page&#39;),<br>  newWindowBtn.click()<br>]);</pre><p>The difference may seem minor, but it can eliminate flaky tests and make browser automation significantly more reliable.</p><p>A good rule of thumb is simple:</p><p>First listen, then trigger.</p><p>Your future self debugging intermittent test failures will thank you for it.</p><p><em>If you found this helpful, feel free to follow me on here and </em><a href="http://linkedin.com/in/arpita-biswas10"><em>LinkedIn</em></a><em> for more content on test automation and Playwright best practices.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83bb7c6c2a12" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing Playwright on ECS: The Power of Caching Speed in CI/CD Pipelines]]></title>
            <link>https://biswasarpita.medium.com/optimizing-playwright-on-ecs-the-power-of-caching-speed-in-ci-cd-pipelines-d99ac9d840b1?source=rss-b33ca3c818a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/d99ac9d840b1</guid>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws-ecs]]></category>
            <dc:creator><![CDATA[Arpita Biswas]]></dc:creator>
            <pubDate>Sun, 28 Jun 2026 18:29:13 GMT</pubDate>
            <atom:updated>2026-06-28T18:29:13.575Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZxUqBdQ310yWe2XgMLYdjQ.png" /><figcaption><strong>Optimizing Playwright on ECS: The Power of Caching Speed in CI/CD Pipelines</strong><br> How Docker layer caching, GitHub Actions, and ECS Fargate can reduce Playwright pipeline execution time by up to 80%</figcaption></figure><h3>What is Caching Speed in CI/CD Pipelines?</h3><p>Caching speed refers to how much faster a system becomes when it reuses previously stored results instead of repeating the same work again. In CI/CD pipelines, caching is one of the most effective ways to reduce build time and improve efficiency.</p><h3>Understanding the Basic Idea</h3><p>Without caching, every pipeline run starts from scratch. With caching, previously completed work is reused instead of being recomputed.</p><p>In simple terms:</p><p>Without cache: do everything again<br> With cache: reuse previous work</p><p>The improvement in time is called caching speed.</p><h3>Example in a CI/CD Pipeline</h3><h3>Without caching</h3><p>Every GitHub Actions run:</p><pre>npm install<br>docker build -t my-app .</pre><p>This means:</p><ul><li>dependencies are installed every time</li><li>Docker rebuilds everything from scratch</li></ul><h3>With caching</h3><p>When caching is enabled, repeated work is skipped:</p><ul><li>npm dependencies are reused</li><li>Docker layers are reused</li></ul><p>This reduces execution time significantly.</p><h3>What Caching Speed Means</h3><p>Caching speed is the improvement in execution time achieved by reusing stored results instead of recomputing everything from scratch.</p><h3>Where Caching Helps in CI/CD</h3><h3>1. npm dependency caching (Docker level)</h3><p>Bad approach:</p><pre>COPY . .<br>RUN npm install</pre><p>Better approach:</p><pre>COPY package*.json ./<br>RUN npm ci</pre><pre>COPY . .</pre><p>Why this is better:</p><ul><li>dependencies are installed only when package.json changes</li><li>Docker can reuse cached layers</li></ul><h3>2. GitHub Actions Docker caching</h3><p>Using GitHub Actions cache for Docker builds:</p><pre>- name: Build Docker Image<br>  uses: docker/build-push-action@v5<br>  with:<br>    context: .<br>    tags: my-app:latest<br>    cache-from: type=gha<br>    cache-to: type=gha,mode=max</pre><p>This allows:</p><ul><li>reuse of previous Docker layers</li><li>faster builds on subsequent runs</li></ul><h3>3. Plain Docker build (without caching)</h3><pre>- name: Build Docker Image<br>  run: |<br>    docker build -t my-app:latest .</pre><p>This works, but:</p><ul><li>no advanced caching control</li><li>slower for large projects</li></ul><h3>Real Impact on Performance</h3><p>Without caching:</p><pre>Docker build time: 4 to 8 minutes<br>npm install: repeated every run</pre><p>With caching:</p><pre>Docker build time: 1 to 3 minutes<br>npm install: reused from cache</pre><p>This can reduce pipeline time by 30 to 80 percent.</p><h3>Why Caching Speed Matters</h3><p>Caching speed improves:</p><ul><li>developer productivity</li><li>CI/CD efficiency</li><li>deployment frequency</li><li>feedback loops during development</li></ul><p>In large systems, caching is essential, not optional.</p><h3>Lesson learned</h3><p>In modern CI/CD:</p><p>-&gt;&gt; Speed is not about more resources<br> It’s about doing less repeated work</p><p>-&gt;&gt;Caching is not an optimization.<br> It’s a requirement.</p><p>Example, typical <strong>Playwright + Docker + GitHub Actions + ECS/Fargate pipelines</strong> usually fall into these ranges:</p><ul><li><strong>Unoptimized setup:</strong> 8–15 minutes<br> (full npm install + full Docker rebuild + full test run)</li><li><strong>Reasonably optimized:</strong> 4–8 minutes<br> (some Docker caching + partial layer reuse)</li><li><strong>Well-optimized (your target state):</strong> 2–5 minutes<br> (good Docker layer caching + GitHub Actions cache + reused images in ECS)</li><li><strong>Very optimized setups (rare):</strong> &lt;2 minutes for CI build + smoke tests<br> (heavy caching + split test strategy + prebuilt images)</li></ul><h3>Final Thoughts</h3><p>Caching speed is not about making operations faster individually. It is about avoiding unnecessary work by reusing previous results.</p><p>In modern CI/CD pipelines using Docker, Playwright, and GitHub Actions, proper caching can dramatically improve performance and reduce build times.</p><p>It is one of the highest impact optimizations in DevOps workflows.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d99ac9d840b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Common Playwright Mistake: Misunderstanding Locator Scoping]]></title>
            <link>https://biswasarpita.medium.com/a-common-playwright-mistake-misunderstanding-locator-scoping-2fab1d814f25?source=rss-b33ca3c818a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fab1d814f25</guid>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <dc:creator><![CDATA[Arpita Biswas]]></dc:creator>
            <pubDate>Sat, 20 Jun 2026 13:53:46 GMT</pubDate>
            <atom:updated>2026-06-20T13:53:46.897Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lw9AkJjaEK-sxa6GbfA3yQ.png" /><figcaption><strong>Locator scoping determines where Playwright searches for elements. Starting from the right container makes the difference between a reliable test and a failing one</strong></figcaption></figure><p>When working with Playwright, small changes in how you structure locators can completely change whether your test passes or fails. A common confusion happens when comparing a container-based locator with a text-based chained locator.</p><p>Let’s understand this with a real example.</p><h3>Working Code</h3><pre>await page<br>  .locator(&#39;div.p-5&#39;, {<br>    has: page.locator(&#39;h3&#39;, { hasText: productName })<br>  })<br>  .getByRole(&#39;button&#39;, { name: /Add to Cart/i })<br>  .click();</pre><p>This code works because it is correctly scoped.</p><p>It starts from the product card container div.p-5. Inside that container, it ensures the correct product is selected by matching the h3 text. Then it searches for the Add to Cart button inside the same container.</p><p>In simple terms, everything happens inside the correct product box.</p><h3>Non Working Code</h3><pre>await page<br>.getByText(productName)<br>.getByRole(&#39;button&#39;, { name: &#39;Add to Cart&#39; })<br>.click();</pre><p>This version fails because of incorrect scoping.</p><h3>What actually happens</h3><p>First, getByText(productName) finds the product name element, which is the h3.</p><p>So the locator now points to something like this</p><p><em>&lt;h3&gt;Bluetooth Headphones&lt;/h3&gt;</em></p><p>Then Playwright tries to find a button inside this element using getByRole.</p><p>At this point it is effectively searching for a button inside the h3.</p><p>But the real DOM structure is like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*UPYMbhera0QlU5zwIwVCWw.png" /><figcaption><strong>DOM structure</strong></figcaption></figure><p><em>&lt;div class=”p-5&quot;&gt;</em></p><p><em>&lt;h3&gt;Bluetooth Headphones&lt;/h3&gt;</em></p><p><em>&lt;button&gt;Add to Cart&lt;/button&gt;</em></p><p><em>&lt;/div&gt;</em></p><p>The button is not inside the h3. It is a sibling element inside the parent container.</p><p>Because Playwright only searches downward inside the matched element, it cannot find the button and the test fails.</p><h3>Key Concept</h3><p>Playwright locators always work from parent to child.</p><p>When you chain locators, you are always narrowing the search inside the previously found element.</p><p>So this pattern means</p><p>A getBySomething B means find B inside A</p><p>It does not mean find B near A or related to A.</p><h3>Why the second approach fails</h3><p>In the failing code, Playwright first selects the h3 element. Then it looks for a button inside it. Since the button is not inside the h3, the search returns nothing.</p><h3>Can it be fixed</h3><p>It can be fixed by moving up to the parent element first, but this approach is not reliable.</p><pre>await page<br>.getByText(productName)<br>.locator(&#39;..&#39;)<br>.getByRole(&#39;button&#39;, { name: &#39;Add to Cart&#39; })<br>.click();</pre><p>This works, but it depends heavily on DOM structure and can break easily if the UI changes.</p><h3>Best Practice</h3><p>The recommended approach is to always anchor your locator to a stable container and then search inside it.</p><p>A good pattern is to</p><p>Start from the product card container<br>Confirm the correct product using text matching<br>Find interactive elements using roles inside the container</p><p>This makes the test more stable and less dependent on exact HTML structure.</p><h3>Key Takeaway</h3><p>The second code fails because it searches for the button inside the product title element instead of the parent container where the button actually exists.</p><p>#</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fab1d814f25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[If Playwright Has Auto-Waiting, Why Do We Still Need Explicit Waits?]]></title>
            <link>https://biswasarpita.medium.com/if-playwright-has-auto-waiting-why-do-we-still-need-explicit-waits-fb45c7581371?source=rss-b33ca3c818a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb45c7581371</guid>
            <category><![CDATA[playwright-test]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <dc:creator><![CDATA[Arpita Biswas]]></dc:creator>
            <pubDate>Mon, 15 Jun 2026 15:26:37 GMT</pubDate>
            <atom:updated>2026-06-17T14:05:03.015Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A7woQTo2fWMxA-GVSu3x2w.png" /><figcaption>Playwright Auto-Waiting vs Explicit Waits — Explained Visually</figcaption></figure><p>One of the most common questions from engineers transitioning to Playwright is:</p><p><em>“If Playwright already has auto-waiting, why do we still need explicit waits?”</em></p><p>At first glance, it seems like auto-waiting should eliminate synchronization issues entirely. After all, Playwright is designed to automatically wait for elements before interacting with them.</p><p>However, while auto-waiting significantly reduces the need for manual waits, it does not completely replace them. Understanding the difference is essential for writing stable, reliable, and maintainable tests.</p><h3>Understanding Playwright Auto-Waiting</h3><h3>Auto-waiting (Recommended)</h3><p>Playwright automatically waits for elements to become actionable before performing actions like:</p><ul><li>click()</li><li>fill()</li><li>check()</li><li>hover()</li><li>selectOption()</li></ul><p>When you perform an action such as:</p><pre>await page.locator(&#39;#submit&#39;).click();</pre><p>Playwright automatically waits until the element is:</p><ul><li>Present in the DOM</li><li>Visible</li><li>Stable (not moving or animating)</li><li>Enabled</li><li>Able to receive user interactions</li></ul><p>Similarly, assertions automatically retry until the expected condition becomes true or a timeout occurs:</p><pre>await expect(locator).toHaveText(&#39;Success&#39;);</pre><p>This means many traditional Selenium-style waits are no longer necessary.</p><p>For example, this pattern is usually redundant:</p><pre>await page.waitForSelector(&#39;#submit&#39;);<br>await page.click(&#39;#submit&#39;);</pre><p>Playwright already performs the required waiting before the click.</p><p>This is one of the reasons Playwright tests are often cleaner and less flaky than tests written with older automation frameworks.</p><h3>Advantages</h3><ul><li>Less code</li><li>More reliable</li><li>Fewer flaky tests</li><li>Faster when elements are already ready</li></ul><h3>The Limitation of Auto-Waiting</h3><p>Auto-waiting only understands <strong>element readiness</strong>.</p><p>It can determine:</p><ul><li>Is the element visible?</li><li>Is it enabled?</li><li>Can it be clicked?</li></ul><p>What it cannot determine is whether your application is actually ready from a business perspective.</p><p>This distinction is critical.</p><p>Consider:</p><pre>await page.locator(&#39;#save&#39;).click();</pre><p>Playwright can ensure the button is clickable.</p><p>But it cannot answer questions such as:</p><ul><li>Has the backend finished processing?</li><li>Has all data loaded from the API?</li><li>Has a background job completed?</li><li>Has the application state been initialized?</li></ul><p>These are application-specific conditions that Playwright cannot automatically determine.</p><p>That’s where explicit waits become useful.</p><h3>When Explicit Waits Are Still Necessary</h3><h3>1. Waiting for Business Logic</h3><p>A common scenario is when a button becomes visible before the underlying data has loaded.</p><p>For example:</p><pre>await page.waitForResponse(<br>  response =&gt;<br>    response.url().includes(&#39;/api/users&#39;) &amp;&amp;<br>    response.status() === 200<br>);</pre><p>Here we’re waiting for an API call to complete before continuing.</p><p>Auto-waiting cannot know that your next action depends on this particular network response.</p><h3>2. Waiting for Loading Indicators to Disappear</h3><p>Many applications display spinners or loading overlays while processing data.</p><p>In these cases, you may need to wait until the loading state disappears:</p><pre>await page.waitForSelector(&#39;.spinner&#39;, { state: &#39;hidden&#39; });</pre><p>A better Playwright-style approach is:</p><pre>await expect(page.locator(&#39;.spinner&#39;)).toBeHidden();</pre><p>This ensures the application has completed loading before moving to the next step.</p><h3>3. Waiting for Navigation or URL Changes</h3><p>After actions such as login, Playwright may need explicit guidance about the expected destination.</p><p>Example:</p><pre>await page.waitForURL(&#39;**/dashboard&#39;);</pre><p>This verifies that navigation has successfully completed before continuing with the test.</p><p>Without this check, subsequent actions may execute before the application reaches the intended page.</p><h3>4. Waiting for Network Activity</h3><p>Modern Single Page Applications (SPAs) often make multiple asynchronous API calls after a page loads.</p><p>In some situations, you may need:</p><pre>await page.waitForLoadState(&#39;networkidle&#39;);</pre><p>This waits until network activity has settled.</p><p>However, use this carefully.</p><p>Many applications maintain long-running connections, polling requests, or analytics calls, making networkidle unreliable in some environments.</p><p>Whenever possible, wait for specific UI states or API responses instead.</p><h3>5. Waiting for Custom Application Conditions</h3><p>Sometimes readiness is defined by internal application state.</p><p>Example:</p><pre>await page.waitForFunction(() =&gt;<br>  window.appState?.loaded === true<br>);</pre><p>This allows the test to wait for a condition that only your application understands.</p><p>Again, this is something Playwright cannot automatically determine.</p><h3>Example based on a practical scenario:</h3><p>A common example is a product listing page, where several components and data requests load in parallel. To handle this reliably, we can use networkidle to wait until all network requests have completed and the page is fully rendered.</p><pre>await this.menuOption.click();<br>// Verify that the user is redirected to the Products page<br>await expect(this.page).toHaveURL(<br>  &quot;https://www.passthenote.com/app/products&quot;<br>);<br>// Wait until all network requests have finished<br>await this.page.waitForLoadState(&#39;networkidle&#39;);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rbEbEmpUB5mwfu5AUU9v_Q.png" /></figure><h3>What You Should Avoid</h3><p>One of the biggest anti-patterns in test automation is using arbitrary sleeps:</p><pre>await page.waitForTimeout(5000);</pre><p>While it may appear to solve timing issues, it usually creates flaky and inefficient tests.</p><h3>Why Fixed Delays Are Bad</h3><ul><li>Five seconds may not be enough on a slow environment.</li><li>Five seconds may be unnecessarily long on a fast environment.</li><li>Test execution becomes slower.</li><li>Flakiness increases over time.</li></ul><p>A test should wait for a condition, not for an arbitrary amount of time.</p><h3>The Practical Rule of Thumb</h3><p>Use the following approach when writing Playwright tests:</p><h3>Use Auto-Waiting For</h3><ul><li>click()</li><li>fill()</li><li>check()</li><li>selectOption()</li><li>Most element interactions</li></ul><h3>Use Assertions For</h3><ul><li>Visibility checks</li><li>Text validation</li><li>State verification</li></ul><p>Examples:</p><pre>await expect(locator).toBeVisible();<br>await expect(locator).toHaveText(&#39;Success&#39;);</pre><h3>Use Explicit Waits Only For</h3><ul><li>Network responses</li><li>Navigation or URL changes</li><li>Loading indicators/ spinners disappearing</li><li>Dynamic content appearing/disappearing</li><li>Application-specific readiness conditions/ Custom application events</li></ul><p>Examples:</p><pre>await page.waitForResponse(...);<br>await page.waitForURL(...);<br>await expect(spinner).toBeHidden();<br>await page.waitForFunction(...);</pre><h3>Final Thoughts</h3><p>Auto-waiting is one of Playwright’s most powerful features because it eliminates a large percentage of synchronization problems automatically.</p><p>However, auto-waiting only understands <strong>element readiness</strong>, not <strong>application readiness</strong>.</p><p>Think of it this way:</p><ul><li><strong>Auto-waiting</strong> = Playwright automatically figures out when an element is ready for interaction.</li><li><strong>Explicit waits</strong> = You tell Playwright what condition means your application is ready.</li></ul><p>In a well-designed Playwright test suite, most synchronization is handled through <strong>locators and assertions</strong>, while explicit waits are reserved for situations where the framework cannot understand the application’s internal state.</p><p>The goal isn’t to eliminate explicit waits completely — it’s to use them only when they communicate meaningful application behaviour.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb45c7581371" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating n8n Workflows Using Selenium, Java, Maven & Cucumber: A Complete End-to-End Framework]]></title>
            <link>https://biswasarpita.medium.com/automating-n8n-workflows-using-selenium-java-maven-cucumber-a-complete-end-to-end-framework-c35005f6fcc7?source=rss-b33ca3c818a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c35005f6fcc7</guid>
            <category><![CDATA[n8n]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <dc:creator><![CDATA[Arpita Biswas]]></dc:creator>
            <pubDate>Sun, 22 Mar 2026 15:45:30 GMT</pubDate>
            <atom:updated>2026-06-29T10:09:20.748Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vU_gmqi1lhLgGQjLlJ20_g.png" /></figure><p>Automation is no longer limited to testing traditional web applications — modern workflow automation tools like <strong>n8n</strong> can also benefit greatly from UI automation, especially when validating workflow creation, integrations, and user journeys.</p><p>As workflow automation platforms like <strong>n8n</strong> grow more powerful, ensuring their reliability through automated testing becomes increasingly important. While tools such as Selenium are traditionally used for web UI testing, integrating them with n8n’s visual workflow builder unlocks new possibilities: validating workflow creation, node configuration, and entire automation pipelines end-to-end.</p><p>In this article, I walk through how I created a <strong>complete automation framework</strong> using <strong>Selenium, Java, Maven, Cucumber BDD, and Page Factory</strong> to automate n8n Cloud — covering login, dashboard validation, and a full workflow using OpenAI, Jira, Gmail, and Google Sheets nodes.</p><p>This automation framework is now capable of validating real-world workflow automation scenarios, and acts as a regression suite for n8n functionality.</p><h3>Technology Stack Used</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*wveEhBPnk_g8WJr1gl3usA.png" /></figure><h3>Objective</h3><p>To automate:</p><ul><li>Login to n8n Cloud</li><li>Dashboard validation</li><li>End-to-end workflow creation</li><li>Adding + configuring multiple workflow nodes</li><li>Triggering the AI agent and validating workflow components</li></ul><h3>Framework Architecture</h3><p>A solid automation suite begins with the right structure. My framework includes everything required for scalability and maintainability.</p><h3>1. Page Object Model with Page Factory</h3><p>Each UI page in n8n (Login, Dashboard, Workflow Editor, Node Modals, etc.) has:</p><ul><li>A dedicated <strong>Page Class</strong></li><li>WebElements initialized using PageFactory</li><li>Modular methods for UI actions</li></ul><p>This keeps step definitions clean and readable.</p><h3>2. Cucumber BDD</h3><p>I created structured feature files representing user behavior:</p><ul><li>Login feature</li><li>Dashboard visibility feature</li><li>End-to-end workflow automation feature</li></ul><p>Each feature file has its own Step Definition class.</p><h3>3. Configurations &amp; Utilities</h3><p>To keep the framework flexible, I used:</p><ul><li>config.properties → URL, timeouts, browser types</li><li>extent.properties → report customizations</li><li>log4j2.xml → logging pattern</li><li><strong>ExcelReader Utility</strong> → parameterized login/user data</li></ul><h3>4. Browser Setup in Base Class</h3><p>Base class includes:</p><ul><li>WebDriver initialization</li><li>Browser configuration</li><li>Driver cleanup</li><li>Common reusable hooks</li></ul><h3>5. Hooks for Before/After Scenarios</h3><p>Cucumber hooks ensure:</p><ul><li>Browser launches before each test</li><li>Screenshots captured on failure</li><li>Logs generated for each step</li></ul><h3>6. Reporting &amp; Logging</h3><ul><li><strong>Extent Reports</strong> for visual HTML reports</li><li><strong>Log4j2</strong> for detailed execution logs</li><li>Screenshots embedded for failed steps</li></ul><h3>7. Automated Execution via Batch File</h3><p>I created a .bat file to trigger Maven test execution in one click:</p><p>mvn clean test</p><p>This helps in CI/CD integration as well.</p><h3>Automated Features Developed</h3><p>Here are the key n8n functionalities I automated.</p><h3>1. n8n Login Automation</h3><p>Feature: <em>Login Functionality<br></em> Scenario validates:</p><ul><li>Account name entry</li><li>Username/password authentication</li><li>Redirection to the Dashboard</li></ul><p><strong>BDD Steps Used:</strong></p><p><strong><em>Given the user is on the login page</em></strong></p><p><strong><em>When user enters valid account name</em></strong></p><p><strong><em>And enters valid username and password</em></strong></p><p><strong><em>And clicks Login</em></strong></p><p><strong><em>Then the user is redirected to Dashboard</em></strong></p><h3>2. Dashboard Workflow Visibility</h3><p>After login, the script verifies:</p><ul><li>Workflow list</li><li>“New Workflow” button visibility</li><li>Correct redirection</li></ul><p>This ensures user-specific workflows are properly loaded for the account.</p><h3>3. End-to-End Workflow Creation (AI + Jira + Sheets + Gmail)</h3><p>This is the most exciting part.</p><p>I automated the entire process of creating a workflow with multiple nodes:</p><h3>The workflow includes:</h3><ul><li><strong>AI Agent</strong></li><li><strong>OpenAI Chat Model node</strong></li><li><strong>Memory node</strong></li><li><strong>Jira Create Issue node</strong></li><li><strong>Jira Delete Issue node</strong></li><li><strong>Gmail node</strong></li><li><strong>Google Sheets node</strong></li><li><strong>Chatbox interaction to trigger logic</strong></li></ul><h3>Key automated steps:</h3><p>✔ Open a new workflow<br> ✔ Add nodes by searching<br> ✔ Configure credentials for Jira &amp; Gmail<br> ✔ Map fields where required<br> ✔ Add Google Sheets node<br> ✔ Open AI chatbox and send a command:</p><p><em>“Create and read bug list from Google Sheet, then create Jira tickets and send report via Gmail.”</em></p><p>This replicates how users automate bug-logging directly from Google Sheets into Jira, with Gmail notifications.</p><h3>Example Cucumber Feature (E2E Workflow)</h3><p><strong><em>Scenario: Create workflow with AI, Jira, Google Sheet &amp; Gmail nodes</em></strong></p><p><strong><em>Given user logs in successfully</em></strong></p><p><strong><em>And user clicks on “+ New Workflow”</em></strong></p><p><strong><em>Then a blank workflow canvas is displayed</em></strong></p><p><strong><em>When I add AI Agent</em></strong></p><p><strong><em>And I add an “OpenAI” Chat Model node</em></strong></p><p><strong><em>And I add a Memory node</em></strong></p><p><strong><em>When I add a Jira node for Create Issue</em></strong></p><p><strong><em>And I add another Jira node for Delete Issue</em></strong></p><p><strong><em>When I add a Gmail node</em></strong></p><p><strong><em>Then the Gmail node is configured</em></strong></p><p><strong><em>When I add a Google Sheet node</em></strong></p><p><strong><em>Then the Google Sheet node is configured</em></strong></p><p><strong><em>And I open the chatbox</em></strong></p><p><strong><em>And I type the automation request in chat</em></strong></p><p>All steps were automated in Selenium using canvas interactions, modals, selectors, and action classes.</p><h3>Challenges Solved</h3><p>Automating n8n wasn’t straightforward. Some key challenges included:</p><ul><li>Handling dynamic node IDs</li><li>SVG-based canvas interaction</li><li>Precise drag-and-drop operations</li><li>Modal timing issues</li><li>Multiple popups and overlays</li><li>Synchronizing asynchronous loading of nodes</li><li>Handling OAuth credential setup modals</li></ul><p>The PageFactory model and utility classes helped solve these efficiently.</p><h3>Final Outcome</h3><p>By the end of the project, I built a <strong>full, scalable, reusable automation framework</strong> that can:</p><p>✔ Automate n8n login<br> ✔ Validate dashboard workflows<br> ✔ Create + configure complex workflows<br> ✔ Interact with AI agents<br> ✔ Integrate Jira, Google Sheets, OpenAI, Gmail, Memory nodes<br> ✔ Generate logs, reports &amp; screenshots<br> ✔ Run through a single command or batch file</p><p>This automation suite now acts as a regression backbone for validating n8n workflow creation across environments.</p><h3>Conclusion</h3><p>Automating n8n workflows introduced unique challenges — from handling SVG-based workflow canvases to configuring dynamic nodes and synchronizing asynchronous events. But with the right architecture, patterns, and tooling, these challenges can be transformed into a scalable automation framework.</p><p>By combining the power of <strong>Cucumber BDD</strong>, <strong>Selenium WebDriver</strong>, and <strong>Java</strong>, this framework now automates:</p><ul><li>Login</li><li>Dashboard validation</li><li>Workflow creation</li><li>Node configuration</li><li>Full end-to-end multi-node automation flows</li></ul><p>It’s reusable, maintainable, and easily extendable for future n8n features. Whether you’re testing workflow builders or large-scale automation tools, this approach provides a proven blueprint for success.</p><h3>Future Enhancements for n8n Test Automation Framework</h3><p>While the current implementation demonstrates the potential of AI-driven workflow automation testing, several enhancements are being evaluated to make the framework more scalable, enterprise-ready, and production-friendly.</p><h3>Enhanced Test Reporting</h3><ul><li>Integrate <strong>Extent Reports</strong> alongside <strong>Cucumber Reports</strong> to provide rich dashboards, execution summaries, screenshots, and historical trends.</li><li>Improve test visibility with consolidated reporting across UI, API, and infrastructure validation.</li></ul><h3>Improved Test Design with Cucumber</h3><ul><li>Refactor feature files by separating:</li><li><strong>Workflow Creation</strong></li><li><strong>Configuration Logic Validation</strong></li><li><strong>Workflow Execution</strong></li><li>This separation enhances maintainability, readability, and reusability of BDD scenarios.</li></ul><h3>UI-Based Workflow Execution</h3><ul><li>Transition workflow execution from the conversational chat interface to direct UI interaction by triggering workflows through the <strong>“Execute Workflow”</strong> button.</li><li>Align automation with real-world user behavior and production usage patterns.</li></ul><h3>Automated Defect Management</h3><p>An intelligent defect management workflow has been implemented to streamline the reporting process by:</p><ul><li>Reading defect details from Google Sheets</li><li>Automatically creating Jira tickets</li><li>Sending execution summaries and defect reports via Gmail</li></ul><p>The implementation is currently under validation to confirm successful Jira ticket creation, email delivery, and end-to-end defect lifecycle execution in real-world scenarios. Once validated, this capability will significantly reduce manual effort involved in defect triaging, tracking, and reporting.</p><h3>Production Environment Validation</h3><ul><li>Enable workflow execution through <strong>production chat URLs</strong>.</li><li>Validate workflows in environments closely aligned with real production deployments.</li></ul><h3>End-to-End Platform Automation</h3><ul><li>Expand coverage to support complete <strong>end-to-end automation of n8n and similar workflow orchestration platforms</strong>.</li><li>Cover workflow creation, configuration, execution, monitoring, and validation.</li></ul><h3>CI/CD Integration</h3><p>Integrate automation pipelines with:</p><ul><li><strong>Jenkins</strong></li><li><strong>GitHub Actions</strong></li></ul><p>This enables:</p><ul><li>Continuous Testing</li><li>Automated regression suites</li><li>Faster release cycles</li><li>Quality gates for deployments</li></ul><h3>Containerization and Cloud-Native Deployment</h3><p>Adopt modern DevOps practices through:</p><ul><li><strong>Docker</strong> containerization</li><li><strong>AWS</strong> deployment strategies</li><li><strong>Terraform</strong> for Infrastructure as Code (IaC)</li><li><strong>Ansible</strong> for configuration and environment management</li></ul><h3>Observability and Monitoring</h3><p>Introduce enterprise-grade observability capabilities using:</p><ul><li><strong>Grafana</strong></li><li><strong>ELK Stack</strong></li><li><strong>Datadog</strong></li></ul><p>This facilitates:</p><ul><li>Centralized logging</li><li>Performance monitoring</li><li>Distributed tracing</li><li>Faster troubleshooting</li></ul><h3>Cross-Browser Validation</h3><p>Extend browser compatibility testing using cloud-based platforms such as:</p><ul><li>BrowserStack</li><li>Sauce Labs</li><li>LambdaTest</li></ul><p>Ensuring consistent behavior across browsers and operating systems.</p><h3>Scalable Test Execution</h3><p>Improve execution efficiency through:</p><ul><li>Selenium Grid</li><li>Parallel test execution</li><li>Distributed browser infrastructure</li></ul><p>Reducing overall execution time for large regression suites.</p><h3>API Testing Integration</h3><p>Enhance validation by incorporating:</p><ul><li><strong>Rest Assured</strong></li><li>API contract testing</li><li>Service-level validation</li><li>Backend workflow verification</li></ul><h3>Unified Quality Engineering Pipeline</h3><p>Build a comprehensive testing ecosystem by combining:</p><ul><li>Functional Testing</li><li>Performance Testing</li><li>Security Testing</li></ul><p>within a single CI/CD pipeline, enabling continuous quality assurance throughout the software delivery lifecycle.</p><p><strong><em>Note</em></strong><em>: Subsequent sections will include additional details on this automation guidance.</em></p><p><em>If you liked this post please consider following me on </em><a href="https://medium.com/@biswasarpita"><em>Medium </em></a><em>and </em><a href="https://www.linkedin.com/in/arpita-biswas10"><em>LinkedIn</em></a><em> for more Automation content.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c35005f6fcc7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OWASP Top 10: SQL Injection-with demonstration on Error-Based SQL Injection]]></title>
            <link>https://biswasarpita.medium.com/owasp-top-10-sql-injection-with-demonstration-on-error-based-sql-injection-c87bf4e7e5d6?source=rss-b33ca3c818a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c87bf4e7e5d6</guid>
            <category><![CDATA[cyber-security-awareness]]></category>
            <category><![CDATA[owasp-top-10]]></category>
            <category><![CDATA[error-based-sql-injection]]></category>
            <category><![CDATA[sql-injection]]></category>
            <category><![CDATA[information-security]]></category>
            <dc:creator><![CDATA[Arpita Biswas]]></dc:creator>
            <pubDate>Fri, 30 Apr 2021 13:48:17 GMT</pubDate>
            <atom:updated>2026-06-01T16:24:02.386Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>WARNING: This material is provided solely for educational purposes. Please use it responsibly and refrain from any misuse.</strong></p><p>SQL injection is a technique used to take advantage of non-validated input vulnerabilities to pass SQL commands through a web application for execution by a backend database. It is a basic attack used to either gain unauthorized access to a database or to retrieve information directly from the database. It is a flaw of web applications and not a database or web server issue.</p><p>The following are the three types of SQL injection attacks:</p><p><strong>Union-Based SQL Injection</strong></p><p>It is the most popular type of SQL injection. This type of attack uses the UNION statement, which is the integration of two select statements, to obtain data from the database.</p><p><strong>Error-Based SQL Injection</strong></p><p>An error-based SQL injection is the simplest type; but, the only difficulty with this method is that it runs only with MS-SQL Server. In this attack, we cause an application to show an error to extract the database. Normally, you ask a question to the database, and it responds with an error including the data you asked for.</p><p><strong>Blind SQL Injection</strong></p><p>Blind SQL injection is the hardest type. In this attack, no error messages are received from the database; hence, we extract the data by asking questions to the database. The blind SQL injection is further divided into two kinds: 1. Boolean-based SQL injection 2. Time-based SQL injection The above techniques can be used to obtain the data in the database by either asking a question or inducing a time delay.</p><p>Below I shared some case study on <strong>Error-Based SQL Injection:</strong></p><p><strong>Case study1:</strong></p><p>I searched for a vulnerable site with the Google dork: Go to Google and simply copy and paste one of those dorks and click search.</p><p>Google dork: inurl:user.php?id=</p><p>After you have googled the dorks, click on any site.</p><p>I found a vulnerable website: <a href="http://www.nezzwerk.com/seven/user.php?id=1">http://www.nezzwerk.com/seven/user.php?id=1</a></p><p>I cross verified whether the website is vulnerable or not by the below process:</p><p>I have added a bad character (i.e. quote („) ) at the end of the site URL just to see how the site behaves, the URL now looks like this :</p><p><a href="http://www.nezzwerk.com/seven/user.php?id=1">http://www.nezzwerk.com/seven/user.php?id=1</a>&quot;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u7hnJBozIFwzqUFr" /></figure><p>Error: “Could not retrieve data (1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘\” and site_id = ‘seven’’ at line 1) “</p><p>This error occurred because the site is not properly sanitizing or filtering for bad characters. We need to use Prepared Statements (with Parameterized Queries), Stored Procedures for sanitization. We can whitelist Input Validation.</p><p>Now with this error, it is confirmed that the site is using MySQL as its backend database and the site is vulnerable to SQL injection.</p><p>Now to exploit the database performed the following steps:</p><p>Step 1: Access kali Linux from my machine</p><p>Step 2: Open SQLMAP</p><p>To exploit the database of the above web application: Enter the below command in your terminal</p><p>#sqlmap -u “url of the website” — dbs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LMxJfZsPibHSSZwA" /></figure><p>After getting database schema info to enter the below command to fetch table info:</p><p>#sqlmap -u “url of the website” -D “db schema name” — tables</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BaUdc_U78t5PMAnG" /></figure><p>After getting a list of table name enters the below command to fetch column info of a particular table:</p><p>#sqlmap -u “url of the website” -D “db schema name” -T “table name” — columns</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BhgfeIaFw9Ypd0yz" /></figure><p>Now try to fetch data of each column with the below command:</p><p>#sqlmap -u “url of the website” -D “db schema name” -T “table name” -C “column name” — dump</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ary8k5WHu-wHBu3D" /></figure><p><strong>Case study2:</strong></p><p>I searched for a vulnerable site with the Google dork: Go to Google and simply copy and paste one of those dorks and click search.</p><p>login.php?id=</p><p>index.php?id=</p><p>After you have googled the dorks, click on any site.</p><p>I found a vulnerable website: <a href="http://waytogonatural.com/product_detail.php?ID=4526">http://waytogonatural.com/product_detail.php?ID=4526</a></p><p>Now to exploit the database performed the following steps:</p><p>Step 1: Access kali Linux from my machine</p><p>Step 2: Open SQLMAP</p><p>To exploit the database of the above web application: Enter the below command in your terminal</p><p>#sqlmap -u “url of the website” — dbs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9H6PC-swuiUJE1q3" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FOAn7oZ61eQhy6-y" /></figure><p>After getting database schema info to enter the below command to fetch table info:</p><p>#sqlmap -u “url of the website” -D “db schema name” — tables</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jP6_HMBfSyuZ3nXt" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u9IQ1DTOKONAcFZn" /></figure><p>After getting a list of table name enters the below command to fetch column info of a particular table:</p><p>#sqlmap -u “url of the website” -D “db schema name” -T “table name” — columns</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KIs2qQZAkEWTBZVG" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pwc3Il70uN3SUP3S" /></figure><p>Now try to fetch data of each column with the below command:</p><p>#sqlmap -u “url of the website” -D “db schema name” -T “table name” -C “column name” — dump</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KrABvNBRkU5q_OGB" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Cug_dL067dlBNLOa" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c87bf4e7e5d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScriptExecutor in Selenium WebDriver with Example]]></title>
            <link>https://biswasarpita.medium.com/javascriptexecutor-in-selenium-webdriver-with-example-4fe356f41b62?source=rss-b33ca3c818a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fe356f41b62</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[javascriptexecutor]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <dc:creator><![CDATA[Arpita Biswas]]></dc:creator>
            <pubDate>Sun, 25 Apr 2021 06:27:08 GMT</pubDate>
            <atom:updated>2021-04-25T06:27:08.801Z</atom:updated>
            <content:encoded><![CDATA[<p>JavaScriptExecutor is an Interface that helps to execute JavaScript through Selenium Webdriver. Sometimes we face a lot of issues when performing actions on web elements. Then this concept comes into the picture.</p><p><strong>Required package:</strong></p><p><em>import org.openqa.selenium.JavascriptExecutor;</em></p><p><strong>Methods of JavaScriptExecutor:</strong></p><ol><li>executeAsyncScript(java.lang.String script, java.lang.Object… args)</li></ol><p>Execute an asynchronous piece of JavaScript in the context of the currently selected frame or window.</p><p>2. executeScript(java.lang.String script, java.lang.Object… args)</p><p>Executes JavaScript in the context of the currently selected frame or window.</p><p>Syntax:</p><p><em>JavascriptExecutor js = (JavascriptExecutor) driver;</em></p><p><em>js.executeScript(Script,Arguments);</em></p><p>Handle different scenarios with JavaScriptExecutor:</p><p><strong>Use of executeAsyncScript: </strong><em>js.executeAsyncScript(“window.setTimeout(arguments[arguments.length — 1], 5000);”)</em></p><p><strong>Below is the code snippets from eclipse editor:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/0*akYz_SjlyoTabPaC" /></figure><p><strong>Use of executeScript:</strong></p><p><strong>Below is the demo application:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BSKCsglUWPeixVl9" /></figure><ol><li><strong>To click a button without using click() method:</strong></li></ol><p><em>js.executeScript(“arguments[0].click();”, loginButton);</em></p><p><strong>Below is the code snippets from eclipse editor:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/0*QOk12lHD3yi5Z9vj" /></figure><p><strong>2. To type Text without using sendKeys() method:</strong> <em>js.executeScript(“document.getElementById(‘some id’).value=’someValue’;”);</em></p><p><strong>Below is the code snippets from eclipse editor:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/0*iBgqWli64KzjAIDQ" /></figure><p><strong>3. To select checkbox:</strong></p><p><em>js.executeScript(“document.getElementById(‘enter element id’).checked=false;”);</em></p><p><strong>4. To generate Alert Pop window:</strong></p><p><em>js.executeScript(“alert(‘Hello World’);”);</em></p><p><strong>5. To refresh browser window:</strong></p><p><em>js.executeScript(“history.go(0)”);</em></p><p><strong>6. To get innertext of the entire webpage:</strong></p><p><em>String sText = js.executeScript(“return document.documentElement.innerText;”).toString();</em></p><p><strong>7. To get the Title of a webpage:</strong></p><p><em>String sText = js.executeScript(“return document.title;”).toString();</em></p><p><strong>8. To get the domain:</strong></p><p><em>String sText = js.executeScript(“return document.domain;”).toString();</em></p><p><strong>9. To get the URL of a webpage:</strong></p><p><em>String sText = js.executeScript(“return document.URL;”).toString();</em></p><p><strong>10. To perform Scroll operations:</strong></p><p>//Vertical scroll down by 500 pixels:</p><p><em>js.executeScript(“window.scrollBy(0,500)”);</em></p><p>//scroll down till the bottom of the webpage:</p><p>j<em>s.executeScript(“window.scrollBy(0,document.body.scrollHeight)”);</em></p><p><strong>Below is the code snippets from eclipse editor:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/0*74stbguefg3GnOyY" /></figure><p><strong>11. To click on a SubMenu which is only visible on mouse hover on Menu:</strong></p><p><em>js.executeScript(“$(‘ul.menus.menu-secondary.sf-js-enabled.sub-menu li’).hover()”);</em></p><p><strong>12. To navigate to different page:</strong></p><p><em>js.executeScript(“window.location = ‘pageUrl’”);</em></p><p><strong>13. To find hidden element:</strong></p><p><em>js.executeScript(“arguments[0].click();”, element);</em></p><p><strong>14. To select option from dropdown list:</strong></p><p>// set the dropdown value to ‘mango’ using javascript</p><p><em>js.executeScript(“arguments[0].value=’mango’”, listbox);</em></p><p><strong>15. To perform drag and drop action:</strong></p><p><em>js.executeScript(“function createEvent(typeOfEvent) { var event = document.createEvent(\”CustomEvent\”); event.initCustomEvent(typeOfEvent, true, true, null); event.dataTransfer = { data: {}, setData: function (key, value) { this.data[key] = value; }, getData: function (key) { return this.data[key]; } }; return event; } function dispatchEvent(element, event, transferData) { if (transferData !== undefined) { event.dataTransfer = transferData; } if (element.dispatchEvent) { element.dispatchEvent(event); } else if (element.fireEvent) { element.fireEvent(\”on\” + event.type, event); } } function simulateHTML5DragAndDrop(element, target) { var dragStartEvent = createEvent(‘dragstart’); dispatchEvent(element, dragStartEvent); var dropEvent = createEvent(‘drop’); dispatchEvent(target, dropEvent, dragStartEvent.dataTransfer); var dragEndEvent = createEvent(‘dragend’); dispatchEvent(element, dragEndEvent, dropEvent.dataTransfer); } var elementToDrag = arguments[0]; var target = arguments[1]; simulateHTML5DragAndDrop(elementToDrag, target);”, sourceLocator, targetLocator);</em></p><p><strong>16. To Handle datePicker:</strong></p><p>//This will select From date</p><p><em>WebElement FromDate = driver.findElement(By.id(“id”));</em></p><p><em>((JavascriptExecutor)driver).executeScript (“document.getElementById(‘id’).removeAttribute(‘readonly’,0);”); </em>// Enables the from date box</p><p><em>FromDate.clear();</em></p><p><em>FromDate.sendKeys(“21-Oct-2020”);</em> //Enter date in required format</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fe356f41b62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Selecting dropdown option with Selenium]]></title>
            <link>https://biswasarpita.medium.com/selecting-dropdown-option-with-selenium-19ef06e1d5fa?source=rss-b33ca3c818a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/19ef06e1d5fa</guid>
            <category><![CDATA[drop-down-menu]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Arpita Biswas]]></dc:creator>
            <pubDate>Mon, 19 Apr 2021 13:01:07 GMT</pubDate>
            <atom:updated>2021-04-19T13:01:07.818Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I will discuss dropdown selection with Selenium WebDriver which is an important element of any webpage. There are two types of dropdowns: Single value Dropdown and Multi-Value Dropdown. We can select dropdown options using different techniques based on the situations. Here, I will cover all these techniques. Moreover, there are some cases where the dropdown menu is developed without the HTML select tag, in that situation we cannot use the Select class. So that part I will cover as well.</p><p><strong>1. Select a particular value in a dropdown using the methods of Select class in Selenium</strong></p><p>Select class implement select tag, providing helper methods to select and deselect options.</p><p>WebElement dropdownlist = driver.findElement(By.xpath(locator));</p><p>Select listbox = new Select(dropdownlist);</p><p>Below is the sample demo application dropdown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gYbci7AJ7PvcMwBN" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1HzEjHAwHtz7ZEbz" /></figure><p><strong>Use of methods of select class with examples:</strong></p><p><strong><em>selectByIndex(int index): </em></strong>Select the option at the given index.</p><p>listbox.selectByIndex(2);</p><p><strong>Below is the code snippets from eclipse editor:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/0*d5QOBj8jvY0hUiDU" /></figure><p><strong><em>selectByVisibleText(java.lang.String text):</em></strong> Select all options that display text matching the argument</p><p>listbox.selectByVisibleText(“Date”);</p><p><strong>Below is the code snippets from eclipse editor:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/0*Z4L9HzXcY26rIuWs" /></figure><p><strong><em>selectByValue(java.lang.String value):</em></strong><em> </em>Select all options that have a value matching the argument.</p><p>listbox.selectByValue(“1”);</p><p><strong>Below is the code snippets from eclipse editor:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/0*npjlT_WLq1HwteAO" /></figure><p><strong><em>getOptions():</em></strong> Get all options from the dropdown list.</p><p>List &lt;WebElement&gt; elementCount = listbox.getOptions();</p><p>System.out.println(elementCount.size());</p><p><strong><em>isMultiple():</em> </strong>Verify whether element support selecting multiple options at the same time. This is done by checking the value of the “multiple” attribute. It will return boolean (true or false) value.</p><p>boolean value = listbox.isMultiple();</p><p><strong><em>getFirstSelectedOption():</em> </strong>The first selected option in this select tag (or the currently selected option in a normal select)</p><p>listbox.getFirstSelectedOption( );</p><p><strong><em>getAllSelectedOptions():</em> </strong>All selected options belonging to this select tag</p><p>WebElement element = driver.findElement(By.xpath(locator));</p><p>Select select = new Select(element);</p><p>List&lt;WebElement&gt; selectedOptions = select.getAllSelectedOptions();</p><p><strong><em>deselectAll():</em></strong> Clear all selected entries. This is only valid when the SELECT supports multiple selections.</p><p>listbox.deselectAll();</p><p><strong><em>deselectByIndex(int index):</em></strong> Deselect the option at the given index.</p><p>listbox.deselectByIndex(0);</p><p><strong><em>deselectByValue(java.lang.String value):</em></strong> Deselect all options that have a value matching the argument.</p><p>listbox.deselectByValue(“aaa”);</p><p><strong><em>deselectByVisibleText(java.lang.String text):</em></strong> Deselect all options that display text matching the argument.</p><p>listbox.deselectByVisibleText(“mango”);</p><p><strong>2. Select a particular value in a dropdown without using the methods of Select class in Selenium</strong></p><p><strong><em>Using sendkeys method:</em></strong></p><p>driver.findElement(By.id(“dropdownField”)).sendKeys(“English”); //send required option in dropdown field</p><p>driver.findElement(By.id(“option1”)).click(); //click on required value</p><p><strong><em>Using keyboard actions commands:</em></strong></p><p>WebElement products=Driver.findElement(By.xpath(“//input[@id=’react-select-3-input’]”));</p><p>products.sendKeys(“Uttar Pradesh”);</p><p>products.sendKeys(Keys.ARROW_DOWN);</p><p>products.sendKeys(Keys.ENTER);</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/0*lotFfIhatiwtQXAA" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yNzzQY30liTXnAlh" /></figure><p><strong>Below is the code snippets from eclipse editor:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/0*sUBIRV-rqJybwhBn" /></figure><p><strong><em>Using findElements method fetch all options:</em></strong></p><p>List&lt;WebElement&gt; options = driver.findElements(By.xpath(“”));</p><p>for(WebElement option : options) {</p><p>if (option.getText().contains(“FA Productivity”)) {</p><p>option.click();</p><p>break;</p><p>}</p><p>}</p><p><strong><em>Using Action class or Mouse-Hover on Option:</em></strong></p><p>WebElement wb1 = webDriver.findElement(By.xpath(“//*[@id=’1692&#39;]”));</p><p>Actions mouse = new Actions(webDriver);</p><p>mouse.moveToElement(wb1).click(); //click the dropdown menu</p><p>WebElement wb2 = webDriver.findElement(By.xpath(“//*[@id=’30241&#39;]”));</p><p>mouse.moveToElement(wb2).click(); //click the required option</p><p>mouse.build().perform(); //perform the operation</p><p><strong><em>Using click method:</em></strong></p><p>//To click the dropdown menu</p><p>driver.findElement(By.xpath(“.//*[@id=’type’]”)).click();</p><p>//To click the required option</p><p>driver.findElement(By.xpath(“.//*[@id=’type’]/option[3]”)).click();</p><p><strong><em>Using JavascriptExecutor Interface:</em></strong></p><p>WebElement listbox = driver.findElement(By.xpath(“//button[@id=’custom’]”));</p><p>// casting a driver instance into JavascriptExecutor instance</p><p>JavascriptExecutor js = (JavascriptExecutor) driver;</p><p>// set the dropdown value to ‘mango’ using javascript</p><p>js.executeScript(“arguments[0].value=’mango’”, listbox);</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19ef06e1d5fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>