<?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 Ismailsobhy on Medium]]></title>
        <description><![CDATA[Stories by Ismailsobhy on Medium]]></description>
        <link>https://medium.com/@ismailsobhy?source=rss-e3d4f1e9ddd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FdbqAH88th8sb3YTZPNrbQ.jpeg</url>
            <title>Stories by Ismailsobhy on Medium</title>
            <link>https://medium.com/@ismailsobhy?source=rss-e3d4f1e9ddd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 16:50:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ismailsobhy/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[AI-Powered Test Automation Part 4: Complete Guide to Playwright Agents (Planner, Generator, Healer)]]></title>
            <link>https://medium.com/@ismailsobhy/ai-powered-test-automation-part-4-complete-guide-to-playwright-agents-planner-generator-healer-d418166afe34?source=rss-e3d4f1e9ddd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d418166afe34</guid>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[playwright-test]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Ismailsobhy]]></dc:creator>
            <pubDate>Sat, 18 Oct 2025 20:24:41 GMT</pubDate>
            <atom:updated>2025-10-27T06:20:19.624Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qmTLxpue8Sz2bKsx-i1dVw.png" /></figure><h3>AI Powered Test Automation Part 4: Complete Guide to Playwright Agents: Planner, Generator, and Healer for Web Test Automation</h3><p>In October 2025, Playwright provided a highly structured approach to build and manage your test automation. After experimenting with the official <a href="https://github.com/microsoft/playwright-mcp">playwright-mcp</a> (covered in our <a href="https://medium.com/@ismailsobhy/smarter-test-automation-with-ai-agents-exploring-model-context-protocol-with-playwright-for-test-1545c2aa7d67">previous article</a>), we now explore a structured and interactive way to create web tests called <a href="https://playwright.dev/docs/test-agents"><strong>Playwright</strong> <strong>Agents</strong></a>. This method is built into Playwright itself as a native feature. No need for any configurations as we did with MCP.</p><p>The Playwright Agents work together in a powerful three-stage workflow, where each agent completes a piece of the puzzle:</p><ul><li><strong>Planner</strong> discovers the website and produces a Markdown test plan with scenarios</li><li><strong>Generator</strong> converts the Markdown test plan into executable Playwright test files</li><li><strong>Healer</strong> runs the generated tests and automatically fixes failing tests</li></ul><p>This article will demonstrate how to set up <strong>Playwright Agents</strong> and show how they work through hands-on experiments. We will start from scratch and provide detailed explanations of what is happening at each stage using <a href="http://www.saucedemo.com/"><strong>www.saucedemo.com</strong></a> as our test web application.</p><h3><strong>Setup</strong></h3><p>You have to install VS Code v1.105 (currently on the <a href="https://code.visualstudio.com/insiders/">VS Code Insiders channel</a>). Copilot was selected after setup.</p><p>You will need the latest Playwright and install chromium.</p><pre>npm install -D @playwright/test@latest<br>npx playwright install chromium</pre><p>Then, you will type:</p><pre>npx playwright init-agents --loop=vscode</pre><p>The command generates agents and seed file used for three AI-powered agents: <strong>Planner, Generator, and Healer</strong>, which work together to build Playwright tests. Note you will get the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-P7VXL0XB4-7CtaXOkzVVw.png" /><figcaption>These files are generated after running the command init-agent command</figcaption></figure><p>Without getting into much detail, when looking at each of the .chatmode.md configuration files, we will get an idea of the behavior and instructions for each agent.</p><p>Make sure your folder structure matches the one below (we will add one more folder later in the article).</p><pre>repo/<br>  .github/                   <br>  specs/<br>    &lt;The test plan will be here&gt;<br>    &lt;If specs folder is not created, it will be created in root of project&gt;<br>  tests/                     <br>    seed.spec.ts<br>    &lt;Your generated tests will be here&gt;<br>  playwright.config.ts</pre><p>GPT-5 mini will be used in the experiments below. When prompting, make sure to:</p><ul><li>Set the <strong>mode</strong> using the dropdown menu below the prompt input</li><li>Set the <strong>context</strong> above the prompt by selecting a file from your project”</li></ul><h3>Planner</h3><p>To be able to use this, We selected <strong>planner</strong> mode <em>(below the prompt </em>input<em>)</em> and <strong>seed.spec.ts</strong> as context <em>(above the prompt </em>input<em>).</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*mzOGK2uQ8lv8x7DtHd5aNA.png" /><figcaption>Prompt for Planner</figcaption></figure><p>The result will be saved in specs folder under the name <strong>saucedemo-checkout-test-plan.md . </strong>The planner<strong> </strong>discovers the website and produces a test plan for several scenarios as in the following video.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DclfUOuq7xdA&amp;type=text%2Fhtml&amp;schema=youtube&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FclfUOuq7xdA%3Ffeature%3Doembed" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e87b511ed5394de54781d27584552e5b/href">https://medium.com/media/e87b511ed5394de54781d27584552e5b/href</a></iframe><p>The plan is created with the following sections:</p><ul><li><strong>Executive summary:</strong> Top-level summary along with scope of what is tested and what is excluded.</li><li><strong>Test environment &amp; prerequisites:</strong> Testing setup, URL, credentials, and browser requirements.</li><li><strong>Page areas and primary controls:</strong> Brief description of the UI elements on each page.</li><li><strong>Test scenarios:</strong> 10 detailed scenarios with steps including expected results and failure conditions. These scenarios include login, cart operations, checkout completion with price verification, form validation, edge cases, ..etc.</li><li><strong>Test data matrix:</strong> In the experiment we are doing, which data (user accounts) is used for which tests.</li><li><strong>Reporting / success criteria:</strong> When should the tests be marked as pass/fail?</li><li><strong>Optional automation suggestions:</strong> Helper functions recommended for Playwright automation.</li><li><strong>Attachments / Evidence:</strong> What artifacts to collect (screenshots, traces).</li><li><strong>Appendix.</strong></li></ul><p>Out of this plan, we will apply <strong><em>Scenario#2, Scenario#3, and Scenario#4</em></strong> Scenarios in the rest of the experiments. You can use the <strong>Generator</strong> for specific scenario as will be shown in the next section.</p><pre>### 2. Add a single item to cart and complete checkout (happy path)<br><br>Assumptions: Logged in as `standard_user`. Fresh session.<br><br>Steps:<br>1. From the inventory page, click `Add to cart` for the product &quot;Sauce Labs Backpack&quot;.<br>2. Verify the cart badge increments to `1`.<br>3. Click the cart icon to go to the cart page.<br>4. Verify the added item appears in the cart with the correct name and price.<br>5. Click `Checkout`.<br>6. On the Checkout: Your Information page, fill First Name `Test`, Last Name `User`, Postal Code `12345`.<br>7. Click `Continue`.<br>8. On the Overview page, verify:<br>   - The item appears with the same name and price.<br>   - Item total equals the sum of item prices.<br>   - Tax is displayed and &gt; 0.<br>   - Total equals item total + tax.<br>9. Click `Finish`.<br><br>Expected results:<br>- After Finish, user sees the completion page with text like &quot;THANK YOU FOR YOUR ORDER&quot;.<br>- Cart badge is cleared (often back to zero) after completion or on returning home.<br><br>Success criteria: Order completes and confirmation page is shown.<br>Failure conditions: Price mismatch, missing tax, incomplete flow, or errors on Finish.<br><br>---<br><br>### 3. Add multiple items and verify totals (2 or more items)<br><br>Assumptions: Logged in as `standard_user`.<br><br>Steps:<br>1. Add 3 different items to the cart (e.g., Backpack, Bike Light, Bolt T-Shirt).<br>2. Verify the cart badge shows `3`.<br>3. Go to cart, verify 3 items listed with individual prices.<br>4. Click `Checkout` -&gt; fill information -&gt; `Continue`.<br>5. On Overview, compute expected item total (sum of prices). Verify displayed Item total equals computed value.<br>6. Verify Tax calculation and that Total = Item total + Tax.<br>7. Finish and confirm completion page.<br><br>Expected results:<br>- Item total, tax, and total are correct and consistent with item prices.<br><br>Edge checks:<br>- If any price text uses currency formatting (e.g., `$`), parse accordingly.<br><br>Failure conditions: Any mismatch in totals or missing items.<br><br>---<br><br>### 4. Remove an item from the cart before checkout<br><br>Assumptions: Logged in as `standard_user` and at least 2 items in cart.<br><br>Steps:<br>1. Add two items.<br>2. Open cart and click `Remove` for one item.<br>3. Verify cart badge decrements accordingly.<br>4. Proceed to Checkout -&gt; fill info -&gt; Continue.<br>5. Verify Overview only lists the remaining item and totals match.<br><br>Expected results:<br>- Removed item not present at overview and totals adjusted.<br><br>Failure conditions: Removed item still appears or totals don&#39;t change.<br><br>---</pre><h3>Generator</h3><p>To demonstrate things easily, we will first do <strong><em>Scenario#2</em></strong> called “<strong>### 2.<em> Add a single item to cart and complete checkout (happy path)”, </em></strong>but we will show the other <strong><em>Scenario#3 and Scenario#4</em></strong> later in the article. This will create interactions, validations, and capture locators.</p><p>After selecting <strong>Generator</strong> mode <em>(below the prompt input)</em> and <strong>saucedemo-checkout-test-plan.md</strong> as context <em>(above the prompt input). </em>Note it says from line 82 to line 83 as this is where <strong>Scenario#2</strong> is written.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wfxTWhlCFTT8Hkqkxq7Lbg.png" /><figcaption>Prompt for Generator for Scenario#2</figcaption></figure><p>The scenario was generated and is stored in <strong><em>tests/add-single-item-complete-checkout.spec.ts</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DsQQY0ZQibbo&amp;type=text%2Fhtml&amp;schema=youtube&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FsQQY0ZQibbo%3Ffeature%3Doembed" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/78bc0f24a36bbe3be2197cca1ad60076/href">https://medium.com/media/78bc0f24a36bbe3be2197cca1ad60076/href</a></iframe><p>You can also generate two scenarios in one prompt. We used the following prompt: <strong><em>Generate ### 3. Add multiple items and verify totals (2 or more items) and ### 4. Remove an item from the cart before checkout. </em></strong>Both are generated and stored in <strong><em>tests/add-multiple-items-verify-totals.spec.ts </em></strong>and <strong><em>tests/remove-item-before-checkout.spec.ts </em></strong>respectively<strong><em>. </em></strong>This can be seen in the video below.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FujV5fJ2wZbw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DujV5fJ2wZbw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FujV5fJ2wZbw%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/92f802267534b3b4e388f1baffa12e07/href">https://medium.com/media/92f802267534b3b4e388f1baffa12e07/href</a></iframe><h3>Healer</h3><p>The next video shows <strong>Scenario#2</strong> after generation, it fails. The <strong>Healer</strong> will help us fix this.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D6oozqqmSvR4&amp;type=text%2Fhtml&amp;schema=youtube&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F6oozqqmSvR4%3Ffeature%3Doembed" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/eacdef03d706d6cd9be9deac0ab99a29/href">https://medium.com/media/eacdef03d706d6cd9be9deac0ab99a29/href</a></iframe><p>You will notice, the reason of failure is the error below:</p><pre> Error: expect(locator).toBeVisible() failed<br><br>    Locator: getByText(&#39;$29.99&#39;)<br>    Expected: visible<br>    Error: strict mode violation: getByText(&#39;$29.99&#39;) resolved to 2 elements:<br>        1) &lt;div class=&quot;inventory_item_price&quot; data-test=&quot;inventory-item-price&quot;&gt;$29.99&lt;/div&gt; aka locator(&#39;[data-test=&quot;inventory-item-price&quot;]&#39;)<br>        2) &lt;div data-test=&quot;subtotal-label&quot; class=&quot;summary_subtotal_label&quot;&gt;Item total: $29.99&lt;/div&gt; aka locator(&#39;[data-test=&quot;subtotal-label&quot;]&#39;)<br><br>    Call log:<br>      - Expect &quot;toBeVisible&quot; with timeout 5000ms<br>      - waiting for getByText(&#39;$29.99&#39;)<br><br><br>      50 |     // 12. On the Overview page, verify item, item total, tax and total.<br>      51 |     await expect(page.getByText(&#39;Sauce Labs Backpack&#39;)).toBeVisible();<br>    &gt; 52 |     await expect(page.getByText(&#39;$29.99&#39;)).toBeVisible();<br>         |                                            ^<br>      53 |     await expect(page.getByText(&#39;Item total: $29.99&#39;)).toBeVisible();<br>      54 |     await expect(page.getByText(/Tax: \$\d+\.\d{2}/)).toBeVisible();<br>      55 |     // Verify total equals item total + tax by parsing values from the page<br>        at /Users/Workspace/playwright-agents/tests/add-single-item-complete-checkout.spec.ts:52:44<br><br>    Error Context: test-results/add-single-item-complete-c-2d775-mplete-checkout-happy-path-/error-context.md<br><br>  1 failed<br>    tests/add-single-item-complete-checkout.spec.ts:7:7 › Add a single item to cart and complete checkout (happy path) › Add a single item to cart and complete checkout (happy path) </pre><p>To understand the error is in this line, <em>it gets the element with text </em><strong><em>$29.99 </em></strong><em>and check it is visible</em>. It is failing because <strong><em>getByText</em></strong> in this line gets two elements.</p><pre>await expect(page.getByText(&#39;$29.99&#39;)).toBeVisible();</pre><p>No worries, the Healer will come to the rescue. <strong>We will use this prompt with the test file as</strong> <strong>context</strong> <strong><em>above the prompt input</em></strong> and <strong><em>select from mode drop down below the prompt input the Healer.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*i9HwQYbpft__S01HCHggdA.png" /><figcaption>Prompt for Healer</figcaption></figure><p>The <strong>Healer</strong> recognized the same error we noticed and suggests:</p><blockquote>I’ll update the Overview page price assertion to use a specific locator for the line-item price (to avoid the ambiguous getByText match), then re-run the tests to verify everything passes.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A-4TEKLwGzQfkGaqat0tTw.png" /><figcaption>Proposed Fix</figcaption></figure><p>This is very handy: the <strong>Healer</strong> helped in identifying the issue. Instead of using <strong><em>getByText</em></strong> to get the element and check if it is visible, <em>it now gets the element by the CSS locator </em><strong><em>.cart_item .inventory_item_price</em></strong><em> and validates the text content</em>. So it still kept the validation, but not as a visibility check of the element with the text</p><p>The next video shows the <strong>Healer</strong> agent in action doing what is mentioned above:</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhWTWtZpsoBk&amp;type=text%2Fhtml&amp;schema=youtube&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FhWTWtZpsoBk%3Ffeature%3Doembed" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5842a9cb71c17be8d25a9c7f5c591707/href">https://medium.com/media/5842a9cb71c17be8d25a9c7f5c591707/href</a></iframe><p>Now <strong>Scenario#2</strong> passes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*amEGlechhSj8mo1V6nxuEg.png" /><figcaption>Scenario#2 passes</figcaption></figure><h3>Running All generated scenarios</h3><p>Prior to this, when we ran the other scenarios and we noticed that no healing is needed. Now, when we run the 3 Scenarios, all of them pass.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FYjYfTDULUj0%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DYjYfTDULUj0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FYjYfTDULUj0%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e70855373b8984a44406fc86bc8af8f4/href">https://medium.com/media/e70855373b8984a44406fc86bc8af8f4/href</a></iframe><h3>Extra: Page Objects</h3><p>After finishing the above experiments, if you need to have page objects, this prompt can be used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kcYBigvbdSP-XT55ohCsLw.png" /><figcaption>Prompt For Page Objects</figcaption></figure><p>This will create page object structure as in the screenshot. This will create a pages/ folder and create the pages inside. Thus changing project folder structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*690jgcwyUfBYGdJyENzZBQ.png" /><figcaption>Converted Page objects and tests pass</figcaption></figure><p>The tests pass after the update. This shows that you can accommodate the code generated to suit your needs.</p><h3>Conclusion</h3><p><strong>Playwright Agents</strong> revolutionize test automation through three specialized Agents: <strong>Planner (providing a test plan with scenarios), Generator (automating the scenarios), and the Healer (identifying the failures and maintaining them)</strong>. While human interaction is still required, this transforms hours of manual work/complex test automation into minutes of guided automation with minimal setup.</p><p>Our experiments revealed valuable flexibility. For instance, the <strong>Planner</strong> creates scenarios <strong>without user stories</strong> by discovering the system, making it perfect for both smoke tests. <strong>Imagine what could happen when you provide user stories?</strong> The coverage can become significantly more comprehensive and tailored to your specific requirements.</p><p>These experiments showcase promising results, though further exploration with more complex websites and scenarios will help understand the full scope of what these agents can achieve.</p><p>The successful refactoring to <strong>Page Object Model</strong> proves that you can adapt the output to existing <strong>frameworks and organizational standards. Additionally, the generated tests can be integrated into CI/CD pipelines using platforms like GitHub Actions</strong></p><p>Above all, <strong>Playwright Agents will boost efficiency rather than replace the experienced test automation engineer</strong>. They are powerful assistants that serve as <strong>productivity multipliers</strong>, amplifying human expertise. This allows engineers to focus on strategy and quality while the agents handle repetitive implementation tasks. <strong>As mentioned in the previous articles, the future of test automation is not about eliminating skilled test automation engineers. It is about elevating what they can achieve.</strong></p><p>You can see the code for this article in this <a href="https://github.com/ismailsobhy/playwright-agents-demo">repo</a>.</p><h3>References</h3><ul><li><a href="https://playwright.dev/docs/test-agents">Agents | Playwright</a></li><li><a href="https://medium.com/@ismailsobhy/smarter-test-automation-with-ai-agents-exploring-model-context-protocol-with-playwright-for-test-1545c2aa7d67">AI-Powered Test Automation: Using Model Context Protocol with Playwright for Smarter Testing: Part…</a></li><li><a href="https://github.com/microsoft/playwright-mcp">GitHub - microsoft/playwright-mcp: Playwright MCP server</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d418166afe34" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI-Powered Test Automation (Part 3): Android Mobile Testing with Journeys for Android Studio]]></title>
            <link>https://medium.com/@ismailsobhy/ai-powered-test-automation-part-3-android-mobile-testing-with-journeys-for-android-studio-2df233012c19?source=rss-e3d4f1e9ddd------2</link>
            <guid isPermaLink="false">https://medium.com/p/2df233012c19</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[mcp-protocol]]></category>
            <dc:creator><![CDATA[Ismailsobhy]]></dc:creator>
            <pubDate>Sat, 28 Jun 2025 21:14:24 GMT</pubDate>
            <atom:updated>2025-11-26T11:56:33.283Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9T1PeuY1tjjz9G-_sJvexQ.png" /></figure><p><a href="https://medium.com/@ismailsobhy/ai-powered-test-automation-part-2-ios-mobile-testing-with-model-context-protocol-mcp-530b314e3c14">In the previous article</a>, we showed how <a href="https://github.com/mobile-next/mobile-mcp"><strong>mobile-mcp</strong></a><strong> </strong>from the <a href="https://mobilenexthq.com/"><strong>mobile-next</strong></a> is applied in iOS physical devices and simulators.</p><p>In this article we will explore<a href="https://developer.android.com/studio/preview/gemini/journeys"> <strong>Journeys for Android Studio</strong></a>. This was presented in <a href="https://android-developers.googleblog.com/2025/05/google-io-2025-whats-new-in-android-development-tools.html"><strong>Google I/O 2025</strong></a><strong> </strong>as an experimental feature. Additionally, there was an insightful LinkedIn post regarding the topic by <a href="https://www.linkedin.com/posts/qamar-elsafadi_androiddev-kotlin-journeys-activity-7331377495214067713-2N3h?rcm=ACoAAAYK8YEB-m2An-q1ZnwrwBCkgRHENTac7So">Qamar-elsafadi</a>.</p><p>Journeys can test the feature you just created or critical paths (aka Journeys). No extensive code. Just build the app and you can run on your emulator and physical devices. You can run on local or remote devices. Journeys must be run <strong>from within your Android project. It will not run on a standalone apk.</strong></p><p>There is no need for an MCP server configuration as the MCPs we mentioned in pervious articles.</p><p>Journeys depends on Gemini.</p><p>Moreover, We will use this app <a href="https://github.com/android/nowinandroid">nowinandoird</a> app. You will need the <a href="https://developer.android.com/studio/preview">Canary version of Android Studio</a>. Version used: Android Studio Narwhal Feature Drop | 2025.1.2 Canary.</p><h3>Trying on Emulator</h3><p>To be able to use Journeys, you have to create a folder and inside it a journey file. We created <em>journeysTest/</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W3I9Eb6DRd8SEIPinNNblg.png" /><figcaption>Journey file creation can be found <a href="https://developer.android.com/studio/preview">Canary version of Android Studio</a></figcaption></figure><p>According to the documentation, Gemini can handle complex multi-step actions, but validations should be kept in separate steps. Here’s our journey:</p><blockquote>Open Now in android app<br>Select Ul and click done<br>Click on the save icon for the first article<br>Go To Saved tab<br>Check if the same article exists<br>Click the saved icon for the article<br>Check if the text “No saved updates” appear</blockquote><p>And it managed the test successfully as seen below in the video, notice the passed status on the bottom left side of the screen and the green box that appears on Journey 7 actions out 7 are successful.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fpm_AKUp26KM&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dpm_AKUp26KM&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2Fpm_AKUp26KM%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/76f272c7637ac8a2e621170874b3c5a8/href">https://medium.com/media/76f272c7637ac8a2e621170874b3c5a8/href</a></iframe><p>Notice each action it takes it produces for it a screenshot as you see in the video. If you click on the screenshot next to each step that you created, you will find details about the action taken</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*icS6ltRFZ2a2YaS_ejBWNQ.png" /><figcaption>Performed Action and Reasoning</figcaption></figure><p>We then intentionally switched two steps to fail the scenario, when you click on the image for that action, you will find an <strong>x</strong> where it failed, and also you will find it was not able to take the action and you will find the failure reason:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PAFgvJyMit5zwahBTHd2sw.png" /><figcaption><strong>x</strong> designate failure, while 🚫 designated did not run</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*6jbm4fUKO8zAzEHIQmj0AQ.png" /><figcaption>Failure Reason</figcaption></figure><p>Despite the user-friendly interface that breaks down journeys into individual actions and shows the step-by-step execution with screenshots and reasoning, <strong>the underlying format is XML</strong>.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;!-- @formatter:off --&gt;<br>&lt;journey name=&quot;My first Journey&quot;&gt;<br>    &lt;description&gt;A Journey that tests ...&lt;/description&gt;<br>    &lt;actions&gt;<br>        &lt;action&gt;Open Now in android app&lt;/action&gt;&lt;action&gt;Select Ul and click done&lt;/action&gt;&lt;action&gt;Click on the save icon for the first article&lt;/action&gt;&lt;action&gt;Go To Saved tab&lt;/action&gt;&lt;action&gt;Check if the same article exists&lt;/action&gt;&lt;action&gt;Click the saved icon for the article&lt;/action&gt;&lt;action&gt;Check if the text &quot;No saved updates&quot; appear&lt;/action&gt;<br>    &lt;/actions&gt;<br>&lt;/journey&gt;</pre><h3>Trying on Physical Device</h3><p>We will try another scenario with more steps but on <strong>Physical device</strong>:</p><blockquote>Open Now in android app<br>Click on the plus next to compose and click done button<br>Click on the saved icon for first icon<br>Print the article title<br>Verify if the same article exists<br>Click on the saved icon<br>Print the article title<br>Check if the text “No saved update” appear<br>Go to interests tab<br>Verify that compose is ticked</blockquote><p>The test executed successfully, as demonstrated in the video. It automatically navigated to the saved tab to verify the article’s presence, <strong>even though “Go To Saved tab ” step was not explicitly included in the predefined actions</strong>. “Journey 10 actions out of 10 Successful.” is seen in the video.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FTAs_jQh5SiE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DTAs_jQh5SiE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTAs_jQh5SiE%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a322b6b9df4ee68f867dc1649f939a9a/href">https://medium.com/media/a322b6b9df4ee68f867dc1649f939a9a/href</a></iframe><p>You will notice we added a <em>“print the article title“ </em>— this is not necessary for the automation, but we wanted to verify that Journeys correctly identifies and reads the article text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*BiDeiYWRpXVqtbKDZHrr6Q.png" /><figcaption>Text for the first article is correct</figcaption></figure><p>Also you can traverse through the action and see the reasonings and actions taken and see test status, on bottom left as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*WlWcJsxKIC82TLEhYK-DQw.gif" /><figcaption>Action and reasoning additional view, with test status</figcaption></figure><h3>Conclusion</h3><p>Although <a href="https://developer.android.com/studio/preview/gemini/journeys"><strong>Journeys for Android Studio</strong></a> remains an experimental, ongoing enhancements will likely expand its capabilities to handle more complex and varied testing situations.</p><p>Our trials demonstrate that it delivers impressive results in automated testing scenarios for the <a href="https://github.com/android/nowinandroid">nowinandoird</a> app. For other apps, results may vary based on App-specific factors or the type of user flow, but we are confident that this feature will continue to improve over time</p><p>This capability enables testers and developers to test features early in the development cycle, further advancing shift-left testing practices and significantly reducing the time required for manual testing and helps in finding bugs in an earlier and efficient way.</p><p>Notably, even users unfamiliar with Android Studio can use it effectively, and any project build issues that arise can be easily resolved.</p><p>Journeys for Android Studio can provide significant impact — even without an existing test automation framework. Imagine the possibilities when you use Journeys or test automation MCPs (as mentioned in the previous articles) in addition to an existing test automation framework and a robust testing process: this combination can deliver better quality and enhanced test coverage simultaneously.</p><p>You can refer <a href="https://developer.android.com/studio/preview/gemini/journeys">here</a> for additional official recommendations and known issues.</p><p>Stay tuned for upcoming articles that will dive deeper into test automation. We will explore how Artificial Intelligence is adding to this field, alongside other emerging and exciting topics :).</p><p><em>For part two in the series titled AI-Powered Test Automation: Part 2 — iOS Mobile Testing with Model Context Protocol (MCP) (mobile-mcp), check </em><a href="https://medium.com/@ismailsobhy/ai-powered-test-automation-part-2-ios-mobile-testing-with-model-context-protocol-mcp-530b314e3c14"><em>here</em></a><em>.</em></p><p><em>For part one in the series titled AI-Powered Test Automation: Part 1 — Web Testing with Model Context Protocol (MCP) and Playwright, check </em><a href="https://medium.com/@ismailsobhy/smarter-test-automation-with-ai-agents-exploring-model-context-protocol-with-playwright-for-test-1545c2aa7d67"><em>here.</em></a></p><h3><strong>References</strong></h3><ul><li><a href="https://developer.android.com/studio/preview/gemini/journeys?gclsrc=aw.ds">Journeys for Android Studio | Android Developers</a></li><li><a href="https://android-developers.googleblog.com/2025/05/google-io-2025-whats-new-in-android-development-tools.html">Google I/O 2025: What&#39;s new in Android development tools</a></li><li><a href="https://www.linkedin.com/posts/qamar-elsafadi_androiddev-kotlin-journeys-activity-7331377495214067713-2N3h?utm_source=share&amp;utm_medium=member_desktop&amp;rcm=ACoAAAYK8YEB-m2An-q1ZnwrwBCkgRHENTac7So">𝐖𝐫𝐢𝐭𝐞 𝐲𝐨𝐮𝐫 𝐚𝐩𝐩 𝐣𝐨𝐮𝐫𝐧𝐞𝐲 𝐚𝐬 𝐭𝐞𝐱𝐭... | Qamar A. Safadi</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2df233012c19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI-Powered Test Automation (Part 2): iOS Mobile Testing with Model Context Protocol (MCP)…]]></title>
            <link>https://medium.com/@ismailsobhy/ai-powered-test-automation-part-2-ios-mobile-testing-with-model-context-protocol-mcp-530b314e3c14?source=rss-e3d4f1e9ddd------2</link>
            <guid isPermaLink="false">https://medium.com/p/530b314e3c14</guid>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[mobile-testing]]></category>
            <category><![CDATA[appium]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[test-automation]]></category>
            <dc:creator><![CDATA[Ismailsobhy]]></dc:creator>
            <pubDate>Mon, 26 May 2025 20:50:34 GMT</pubDate>
            <atom:updated>2025-11-26T11:57:00.947Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K2r42zRWIby7R2bVS3JXHw.png" /></figure><h3>AI-Powered Test Automation (Part 2): iOS Mobile Testing with Model Context Protocol (MCP) (<a href="https://github.com/mobile-next/mobile-mcp">mobile-mcp</a>)</h3><p><a href="https://medium.com/@ismailsobhy/smarter-test-automation-with-ai-agents-exploring-model-context-protocol-with-playwright-for-test-1545c2aa7d67">In the previous article</a>, we introduced <a href="https://github.com/microsoft/playwright-mcp">Playwright-mcp</a>, which demonstrated a seamless approach to web test automation. In the example we provided, it interacted totally with a website without manually capturing locators, and offered a straightforward configuration process.</p><p>This naturally raises the question: <strong>Can we do the same concept with mobile test automation? </strong><em>Yes, we can.</em></p><p>To achieve this, we use <a href="https://github.com/mobile-next/mobile-mcp"><strong>mobile-mcp</strong></a><strong> </strong>from the <a href="https://mobilenexthq.com/"><strong>mobile-next</strong></a><strong>.</strong> The project aims to utilize <strong>mcp</strong> with <strong>mobile test automation</strong>. At the time of writing this article, this project is actively maintained and continues to show great promise.</p><p>According to the <a href="https://github.com/mobile-next/mobile-mcp"><strong>mobile-mcp</strong></a> repository, it leverages <strong>accessibility data</strong> and <strong>view hierarchy coordinates</strong> to interact with the app. If both are unavailable, it falls back to <strong>screenshot-based analysis</strong>.</p><h3>Preparation</h3><p>We will use <a href="https://cline.bot/"><strong>Cline</strong></a> within <strong>VS Code</strong>, following the <a href="https://github.com/mobile-next/mobile-mcp/wiki/">official mobile-mcp documentation</a>, along with <strong>WebDriverAgent (WDA)</strong>. You can also set up Claude Desktop and other tools as described in the documentation.</p><p>After setup, to check if a simulator or device is connected in Cline, use this prompt:</p><blockquote>list devices</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lztb0veMIR1zGqCdkMa-pQ.png" /></figure><p><strong>You will get a response</strong> with this device</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vKhexWzGMHMCNLZm3zpxhw.png" /></figure><p>You can also get the <strong>bundle ids for the apps</strong> on the device</p><blockquote>list apps</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P81TFhV0AoO602JlIdTqOQ.png" /></figure><h3>Experiment with iOS simulator</h3><p>We will set up a <strong><em>sample food-ordering app</em></strong> from Apple’s developer codebase, available [<a href="https://developer.apple.com/documentation/foundation/building_a_localized_food-ordering_app">here</a>]. The app uses <strong>SwiftUI</strong>.</p><p>Open the <strong>Xcode</strong> project inside Caffe folder <strong>(Caffe.xcodeproj)</strong></p><p>In <strong>Xcode</strong>, select the <strong>simulator</strong> you will use and build the project and click on the play <strong>(it will build and play)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*xa1ruIRoVntwb2iM5sPxpA.gif" /><figcaption>Opening the app from xcode</figcaption></figure><h3><strong>Simulator — Scenario A</strong></h3><p>Using the default <strong><em>anthropic/claude-sonnet-4,</em></strong> type this prompt (we will call it <strong>Scenario A</strong>)</p><blockquote>On iphone 16 pro max simulator, Open caffe app, order 2 medium pizzas and check the price in the receipt is ok</blockquote><p>It scans and lists the connected running <strong>simulators</strong> and the <strong>apps</strong> installed. It detects everything by itself.</p><p><strong>If you are repeatedly prompted to approve or reject each step</strong>, please refer to the appendix for guidance on how to manage this efficiently.</p><p><strong>As you can see below</strong>, It clicked on <em>sandwich</em> button instead of <em>pizza</em>, tried to correct itself by clicking or swiping in middle of screen (swiping from top to bottom could have worked). It showed promising behavior, even though it did not fully complete the task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*62F9m7lg3nk8PWxksh7YTA.gif" /><figcaption>Clicking on Sandwich instead of Pizza for <strong>Scenario A</strong>— <strong><em>anthropic/claude-sonnet-4</em></strong></figcaption></figure><p>We repeated the same prompt with another model <strong><em>google/gemini-2.5-pro-preview </em></strong>and at this time, pizza was selected correctly and scenario continued normally until price is confirmed in the receipt page. Success!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FS3IhD4WBfhg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DS3IhD4WBfhg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FS3IhD4WBfhg%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6369dd88a8459093affa24019d3c9cac/href">https://medium.com/media/6369dd88a8459093affa24019d3c9cac/href</a></iframe><h3>Simulator — Scenario B</h3><p><em>The next stage: </em>We will make a scenario that requires a lot of interactions back and forth on the <strong><em>sample food-ordering app </em></strong><em>we used in Scenario A</em>, to see if the interactions work reliably across different views/pages. We will call this prompt (<strong>Scenario B)</strong>.</p><blockquote>On iphone 16 pro max simulator, Open caffe app, order 1 large pizzas, 1 large sandwich, 1 large juice, 1 small salad, check the price in the receipt is correct</blockquote><p>It works correctly, selecting all needed items, going back when selecting items. Also clicking <strong>correctly</strong> on the buttons at the bottom that sometimes struggled with in other experiments with this app when not using <strong><em>google/gemini-2.5-pro-preview</em></strong>. So it achieved what we needed for this scenario as you can see in the video . And finally it checked the price is correct. <strong>Success!</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhaMXsmlgWOY&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FhaMXsmlgWOY" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2037e2aec7d76b917cd33f616f68259f/href">https://medium.com/media/2037e2aec7d76b917cd33f616f68259f/href</a></iframe><h3>Experiment with iOS physical device — Scenario C</h3><p>This time, we will use <a href="https://apps.apple.com/eg/app/jumia-online-shopping/id925015459">Jumia app</a>, which is installed on a physical iPhone — a real life example.</p><p>Using <strong>Cline</strong> also, we will call this <strong>Scenario C.</strong></p><blockquote>open jumia app on iphone 13 pro max physical device, search for hoho kettle , select the first one and add it to cart. And then check the cart has it with same price</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DCOOwL-LaqYk&amp;type=text%2Fhtml&amp;schema=youtube&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FCOOwL-LaqYk%3Ffeature%3Doembed" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/af575f356d06ca02876e3d16f07af9ab/href">https://medium.com/media/af575f356d06ca02876e3d16f07af9ab/href</a></iframe><p>It performed <strong>perfectly</strong> in this scenario (<strong>Scenario C) </strong>as in the video. It did the following:</p><ul><li>Scanning and list the <strong>physical devices </strong>connected and <strong>apps</strong> — as it did with the simulator</li><li>Open main page and searched for the kettle and added to cart.</li><li>Check the price of the added item</li></ul><h3>Conclusion</h3><p>After the experimentation with <a href="https://github.com/mobile-next/mobile-mcp"><strong>mobile-mcp</strong></a> , the advantages are clear:<br> ✅ No need to set up an <strong>Appium server</strong>.<br> ✅ No need to manually capture locators using <strong>Appium Inspector.</strong><br> ✅ Minimal setup — just configure <strong>Cline (or something else)</strong>, <a href="https://github.com/mobile-next/mobile-mcp"><strong>mobile-mcp</strong></a>, and <strong>WebDriverAgent</strong> (WDA).<br> ✅ Automatically detects and works efficiently with <strong>connected simulators and physical devices.</strong><br>✅ Scans installed apps to retrieve <strong>bundle IDs</strong>.</p><p>What makes <a href="https://github.com/mobile-next/mobile-mcp">mobile-mcp</a> especially exciting is its ability to turn simple prompts into real app interactions — a remarkable achievement in the world of mobile testing.</p><p>Although not our original focus, We noticed that the model choice significantly influenced the results. <strong>google/gemini-2.5-pro-preview</strong> consistently outperformed the alternatives.</p><p>While success depends on good app structure and accessibility practices, this approach dramatically reduces setup and maintenance overhead. <strong>QA and test automation engineers remain essential </strong>— but can now focus more on exploratory testing, edge cases, and expanding coverage, or automating other tests.</p><p><strong>Looking Ahead:</strong> Stay tuned for more articles exploring innovative topics such as AI-powered test automation and beyond. Exciting insights are on the way! 😊</p><p>The same article is on Linkedin <a href="https://www.linkedin.com/pulse/ai-powered-test-automation-part-2-ios-mobile-testing-model-sobhy-xuorf?utm_source=share&amp;utm_medium=member_ios&amp;utm_campaign=share_via">here</a>.</p><p><strong>References</strong></p><ul><li><a href="https://mobilenexthq.com/">Mobile Next - Modern Mobile App Testing Automation</a></li><li><a href="https://github.com/mobile-next/mobile-mcp">GitHub - mobile-next/mobile-mcp: Model Context Protocol Server for Mobile Automation and Scraping (iOS, Android, Emulators, Simulators and Physical Devices)</a></li><li><a href="https://marketplace.visualstudio.com/items?itemName=saoudrizwan.claude-dev">Cline - Visual Studio Marketplace</a></li><li><a href="https://developer.apple.com/documentation/foundation/building_a_localized_food-ordering_app">Building a Localized Food-Ordering App | Apple Developer Documentation</a></li></ul><h3>Appendix</h3><p><strong>Setting Auto approval so that i does not ask to approve each step,</strong></p><p>Just click on</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*01HoclSjHWKwln0TA4WJgw.png" /></figure><p>But if this does not work, click on auto approve here when try first for each command or new command it works</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u1kP3cNnWbSKNfLBuWrz6Q.png" /></figure><p>When setting <strong>WebDriverAgent and then run it</strong></p><pre>xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -allowProvisioningUpdates -configuration Debug -destination &#39;id=udid&#39; test</pre><p>In terminal, this will be the output you this if all is ok</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZLFwXEvSpPx5roJ2j1xniw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=530b314e3c14" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI-Powered Test Automation: Using Model Context Protocol with Playwright for Smarter Testing: Part…]]></title>
            <link>https://medium.com/@ismailsobhy/smarter-test-automation-with-ai-agents-exploring-model-context-protocol-with-playwright-for-test-1545c2aa7d67?source=rss-e3d4f1e9ddd------2</link>
            <guid isPermaLink="false">https://medium.com/p/1545c2aa7d67</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[mcps]]></category>
            <dc:creator><![CDATA[Ismailsobhy]]></dc:creator>
            <pubDate>Fri, 25 Apr 2025 09:48:13 GMT</pubDate>
            <atom:updated>2025-06-01T13:31:59.230Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w2JyHRGEKd8a0YL82rHYyg.png" /></figure><h3>AI-Powered Test Automation: Part 1 — Web Testing with Model Context Protocol (MCP) and Playwright</h3><p>The same article exists on Linkedin <a href="https://www.linkedin.com/posts/activity-7321494077949026305-zDfX?utm_source=share&amp;utm_medium=member_ios&amp;rcm=ACoAAAYK8YEB-m2An-q1ZnwrwBCkgRHENTac7So">here</a>.</p><p><strong>Model Context Protocol (MCP)</strong> is a standardized interface or mechanism that allows <strong>LLMs</strong> to interact with external tools, APIs, and environments by passing structured context and instructions.</p><p><strong>MCP</strong> helps make AI models more tool-aware. You can think of LLMs as speaking one language, while external tools — like Slack, GitHub, Google Meet, and others as mentioned <a href="https://github.com/modelcontextprotocol/servers">here</a> — speak different ones. <strong>MCP</strong> acts as a translator, enabling smooth communication between them. This allows LLMs to interact seamlessly with a wide range of tools, expanding their capabilities beyond just generating text.</p><p>As of the time this article was written, <strong>MCP</strong> is a relatively new topic. But still, some <strong>MCP</strong> approaches have already been explored with Selenium and Playwright. In this article, we will explain how to use <a href="https://github.com/microsoft/playwright-mcp"><strong>Playwright-mcp</strong></a>, officially released by the <strong><em>Microsoft Playwright team</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*Gi-RfkxlYSpu1OgLbXKpIQ.png" /></figure><p>We will be using the default setup, <strong>Snapshot Mode</strong>, which depends on parsing the DOM. This is in contrast to <strong>Vision Mode</strong>, which relies on screenshots and coordinates and is generally considered less accurate. The motive of the experimentation in this article and follow-ups is to explore the Snapshot mode and discover the following:</p><ul><li><strong>Is it easy to setup?</strong></li><li><strong>Determine what is needed from the user to interact with a web application in test? Do we need steps or locators or just prompts?</strong></li><li><strong>Provide an initial assessment of AI-driven test automation using MCP and Playwright.</strong></li></ul><h3><strong>For this experimentation, these steps were followed:</strong></h3><p><strong>1- Install Claude client on your local from </strong><a href="https://claude.ai/download"><strong>here</strong></a><strong>.</strong></p><p><strong>2- Run from your terminal:</strong></p><pre>npx @playwright/mcp@latest --port 8931</pre><p><strong>3. The output will be the following:</strong></p><pre><br>{<br>  &quot;mcpServers&quot;: {<br>    &quot;playwright&quot;: {<br>      &quot;url&quot;: &quot;http://localhost:8931/sse&quot;<br>    }<br>  }<br>}</pre><p><strong>4. Copy what is in step 3 to </strong><strong>claude_desktop_config.json (as we will use Claude), go to</strong></p><ul><li>macOS: ~/Library/Application Support/Claude/claude_desktop_config.json</li><li>Windows: %APPDATA%\Claude\claude_desktop_config.json</li></ul><p><strong>5. Open Claude and add this prompt.</strong></p><blockquote>Use the Playwright MCP Server to navigate to https://opensource-demo.orangehrmlive.com/. execute and validate the following login scenario: - Valid Login</blockquote><p><strong>6. This will open the browser and for the first scenario this will happen:</strong></p><p>It will continue on the steps until the login scenario ends, notice that the correct username and password are written on the website first page and they are acquired automatically from the DOM.</p><p>Note it does not ask for permissions except at the beginning.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FK9hNCrvxqfA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DK9hNCrvxqfA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FK9hNCrvxqfA%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a95beaf31582dc1c8a5c2323d064218e/href">https://medium.com/media/a95beaf31582dc1c8a5c2323d064218e/href</a></iframe><p><strong>7. For scenario 2, we use this prompt for invalid login:</strong></p><blockquote>Do the scenario for invalid login</blockquote><p>What is remarkable, It notices that it is logged in, so it logs out and tries with invalid credentials to login.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhL46caddQAA&amp;type=text%2Fhtml&amp;schema=youtube&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FhL46caddQAA%3Ffeature%3Doembed" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/11d83321f3002c96f75b7f16e10603b3/href">https://medium.com/media/11d83321f3002c96f75b7f16e10603b3/href</a></iframe><h3><strong>Thoughts and Conclusion</strong></h3><p><strong>So is it easy to setup?</strong></p><p>Yes, With few instructions, we were able to setup and run scenarios. No hard installations whatsoever.</p><p><strong>Other than setup and prompts? Do we need anything else such as steps and locators?</strong></p><p>The traditional approach will involve, testers testing manually and in addition for test automation, there is an effort to capture locators or writing code.</p><p>But here<strong> </strong>with few commands, we were able to try scenarios for website with absolutely no intervention, <strong>Claude</strong> or any other LLM will do the heavy lifting. We just gave a prompt. This can save time and effort for testers and make them focus on other matters.</p><p><strong>What are the initial assessment of this experiment?</strong></p><p><strong>A significant advantage for the snapshot mode </strong>is that it uses<strong> </strong>the <strong>DOM</strong> of the website is parsed and this can be seen how it got the selectors (locators) and also how it acquired the username and password. Furthermore, it logged out to continue the invalid login scenario. It directed itself flawlessly for these simple test cases.</p><p>However, the website we used is<strong> well structured and with good selectors locators</strong>. This might be challenging for other websites that lack a <strong>well-structured DOM </strong>or good <strong>selectors/locators</strong>. We need to try additional use cases, maybe with poorly structured websites, and other scenarios. We will explore other elements and use cases in subsequent articles.</p><p>Imagine you can ask it after these steps, to produce the test automation code for what it did. So you can also continue.</p><p><strong>As an additional side note</strong>, people might ask about the cost, and that largely depends on the LLM you choose. For paid models, the cost is directly related to usage and whether the value justifies upgrading from a free plan. However, even with open-source or local models, there are still trade-offs to consider, such as compute resource requirements, setup time, and ongoing maintenance.</p><p>A proper cost-analysis should compare the total effort, time, and money involved in using this approach versus traditional test automation. In some cases, a hybrid approach like combining traditional test automation with AI-enhanced automation as discussed here, might be the most effective solution.</p><p><strong>The main question</strong> is to what extent this will replace testers as it improves in the future. I think testers will still be needed and will not be replaced, but their responsibilities will be augmented. This technology will assist them greatly in delivering better quality products and enhancing coverage. This is always the main goal.</p><p>But as an initial trial, this looks very promising. Expect more articles like this with different AI experiments to test automation in the future :) .</p><p><em>For part two in the series titled AI-Powered Test Automation: Part 2 — iOS Mobile Testing with Model Context Protocol (MCP) (mobile-mcp), check </em><a href="https://medium.com/@ismailsobhy/ai-powered-test-automation-part-2-ios-mobile-testing-with-model-context-protocol-mcp-530b314e3c14"><em>here</em></a><em>.</em></p><p><strong>References:</strong></p><ul><li><a href="http://modelcontextprotocol.io/quickstart/user">For Claude Desktop Users - Model Context Protocol</a></li><li><a href="https://huggingface.co/blog/lynn-mikami/microsoft-playwright-mcp">Microsoft Playwright MCP: Tutorial for Beginners</a></li><li><a href="https://github.com/microsoft/playwright-mcp">GitHub - microsoft/playwright-mcp: Playwright MCP server</a></li><li><a href="https://medium.com/@sumit.somanchd/ai-driven-test-automation-with-playwright-mcp-server-cursorai-c974f2d6b191">AI-driven Test Automation with Playwright + MCP Server + CursorAI</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1545c2aa7d67" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>