<?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 Diyana_Hewage on Medium]]></title>
        <description><![CDATA[Stories by Diyana_Hewage on Medium]]></description>
        <link>https://medium.com/@diy2hewage?source=rss-2f05392fa468------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BLvMNQnOT3IDj7HoY01dNw.jpeg</url>
            <title>Stories by Diyana_Hewage on Medium</title>
            <link>https://medium.com/@diy2hewage?source=rss-2f05392fa468------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 20:35:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@diy2hewage/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[Click with Confidence: Testing Button Actions Using Selenium WebDriver]]></title>
            <link>https://medium.com/@diy2hewage/click-with-confidence-testing-button-actions-using-selenium-webdriver-3f96e11c0dc0?source=rss-2f05392fa468------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f96e11c0dc0</guid>
            <category><![CDATA[testng]]></category>
            <category><![CDATA[webdriver]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[button]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Diyana_Hewage]]></dc:creator>
            <pubDate>Tue, 01 Jul 2025 18:56:20 GMT</pubDate>
            <atom:updated>2025-07-01T18:56:20.158Z</atom:updated>
            <content:encoded><![CDATA[<p>This article will walk you through working with a <strong>Button </strong>, using a simple example built with Selenium WebDriver and TestNG.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*4cpOcu-tikTfP9eLKVHl2Q.png" /></figure><p><strong>What is Button?</strong></p><p>A <strong>button</strong> is a common web element used to perform actions such as submitting , navigating , triggering , and more.</p><p>In this quick guide, you’ll learn how to effectively interact with buttons and validate their behavior .</p><ol><li><strong><em>Click on the button and Confirm the title of the page</em></strong></li></ol><pre>WebElement loginButton=driver.findElement(By.xpath(&quot;//button[@type=&#39;submit&#39;]&quot;));<br>loginButton.click();<br><br>verify the title of the button using assertions<br><br>String expectedTitile=&quot;OrangeHRM&quot;;<br>String actualTitle= driver.getTitle();<br>Assert.assertEquals(actualTitle,expectedTitile,&quot;Title is not matching &quot;)</pre><p><strong><em>2.Find the position of the button</em></strong></p><pre>WebElement loginButton=driver.findElement(By.xpath(&quot;//button[@type=&#39;submit&#39;]&quot;));<br>Point xyPoint= loginButton.getLocation();<br>        int x=xyPoint.getX();<br>        int y=xyPoint.getY();<br> System.out.println(&quot;X point is &quot;+ x +&quot; &quot;+ &quot;Y point is&quot;+ y);</pre><p><strong><em>3.Find the color of the button</em></strong></p><pre>WebElement loginButton=driver.findElement(By.xpath(&quot;//button[@type=&#39;submit&#39;]&quot;));<br>        String colorofLoginButton= loginButton.getCssValue(&quot;background-color&quot;);<br>        System.out.println(&quot;Login button&#39;s color is &quot;+ colorofLoginButton);</pre><p><strong><em>4.Find the size of the button</em></strong></p><pre>WebElement loginButton=driver.findElement(By.xpath(&quot;//button[@type=&#39;submit&#39;]&quot;));<br>        int height=loginButton.getSize().getHeight();<br>        int width=loginButton.getSize().getWidth();<br>        System.out.println(&quot;Login Button&#39;s height is &quot;+ height );<br>        System.out.println(&quot;Login Button&#39;s width is &quot;+ width);<br></pre><p><strong><em>5.check that the button is Displayed</em></strong></p><pre>WebElement loginButton=driver.findElement(By.xpath(&quot;//button[@type=&#39;submit&#39;]&quot;));<br>loginButton.isDisplayed();</pre><p><strong><em>6.check that the button is Enabled</em></strong></p><pre>WebElement loginButton=driver.findElement(By.xpath(&quot;//button[@type=&#39;submit&#39;]&quot;));<br>loginButton.isEnabled();</pre><p>In this example, I’m using Selenium alongside TestNG</p><p>URL used : <a href="https://opensource-demo.orangehrmlive.com/web/index.php/auth/login">https://opensource-demo.orangehrmlive.com/web/index.php/auth/login</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SFJEJqJYXr-AwlFphkFNDg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zv04fLCXUQZxpUnQCb6wcQ.png" /></figure><p>Hope this helps you work effectively with <strong>Buttons</strong> in your automation journey.</p><p>I’ll be bringing another powerful guide to your testing toolkit soon. Until then, happy clicking and happy testing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f96e11c0dc0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git Smarter, Test Better: A Modern QA’s Guide to Git]]></title>
            <link>https://medium.com/@diy2hewage/git-smarter-test-better-a-modern-qas-guide-to-git-2ad5174bb5aa?source=rss-2f05392fa468------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ad5174bb5aa</guid>
            <dc:creator><![CDATA[Diyana_Hewage]]></dc:creator>
            <pubDate>Thu, 19 Jun 2025 16:17:50 GMT</pubDate>
            <atom:updated>2025-06-19T16:17:50.670Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*Xf1svfNarF_etJVa0hNMIQ.jpeg" /></figure><p>In the world of modern software development, collaboration, traceability, and efficiency are critical. This is where <strong>Git</strong> a powerful and widely-used <strong>version control system (VCS) </strong>comes into play. It’s a slightly longer read, but trust me ,it’s totally worth it</p><p>But before we dive into Git itself, let’s first understand what a Version Control System (VCS) is and why it’s essential.</p><p><strong>What is a Version Control System?</strong></p><p>A <strong>version control system (VCS)</strong> is a tool that helps track changes in source code over time. It allows teams to:</p><ul><li>Collaborate without conflict</li><li>Revert to previous code when needed</li><li>Track who made which changes and why</li><li>Experiment with new features without breaking the main codebase</li></ul><p>There are two main types of VCS:</p><ul><li><strong>Centralized VCS (CVCS)</strong></li></ul><p><strong>In Centralized Version Control all the versioned files are stored on a single central server such as </strong>Subversion (SVN) and CSV. In CVCS if the server goes down, no one can collaborate.</p><ul><li><strong>Distributed VCS (DVCS)</strong></li></ul><p>A <strong>Distributed VCS</strong> allows every user to have a full copy of the entire repository, including the complete history. Changes can be committed locally, and later synchronized with others. Git and Mercurial are popular DVCS tools.</p><p><strong>What is Git?</strong></p><p><strong>Git</strong> is an open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git allows multiple people to work on the same codebase simultaneously without interfering with each other’s work.</p><p>Unlike centralized systems, Git gives every user a local copy of the entire repository history, making operations like commits, branching, and merging lightning-fast.</p><p><strong>Why Use Git?</strong></p><p>Here’s why Git has become the industry standard:</p><ul><li><strong>Branching and Merging</strong>: You can create independent branches for features or bug fixes and merge them when ready.</li><li><strong>Collaboration</strong>: Multiple team members can work on the same project without overriding each other’s code.</li><li><strong>Traceability</strong>: Every change is logged with a message, author, and timestamp.</li><li><strong>Backup</strong>: Since each contributor has a full copy of the repo, there’s no single point of failure.</li><li><strong>Integration</strong>: Git integrates seamlessly with platforms like GitHub, GitLab, and Bitbucket.</li></ul><p><strong>Essential Git Commands for Beginners</strong><br>Here are the core Git actions you need to know to start working confidently with version control</p><p><strong>Configuring git for the first time</strong></p><pre>$git config --global user.name &quot;&lt;Enter user name &gt;&quot;<br>$git config --global user.email &quot;&lt;Enter email id &gt;&quot;<br></pre><p><strong>Initializing git</strong></p><pre>$git init</pre><p>git creates a hidden folder to keep track of changes.</p><p><strong>Adding files to git repo/Staging file</strong></p><p>Staged files are those that are ready to be committed to your repository. When you first add files to a new repository, they start as untracked. To make Git track them, you need to stage them, or add them to the staging environment first.</p><pre>$ git add &lt;File name with extention&gt;<br><br>stage all files in your directory;<br><br>$git add add .<br><br>or<br><br>$git add -A</pre><p><strong>Making a Commit</strong></p><p>Committing lets us track our progress and the changes we make as we work. Git treats each commit as a “save point” ,it is a snapshot of the project at a specific moment. If a bug occurs or we want to revert back to a previous state, we can return to that point. Whenever we commit, we should always include a message describing what we changed.</p><pre><br>$ git commit -m &quot;&lt;Enter the message &gt;&quot;</pre><p><strong>Status of the File</strong></p><pre>$ git status<br></pre><p><strong>Log of a File</strong></p><p>How many git commits we have done</p><pre>$ git log<br>$ git log --oneline</pre><p><strong>Git branching</strong></p><p>In Git, a branch is a separate or new version of the main repository. Branches let you work on different parts of a project without affecting the main branch. Once your work is finished, you can merge it back into the main project. You can also switch between branches and work on different tasks without interfering with each other.</p><p><strong>Create new git branch</strong></p><pre>$ git branch &lt;Branch name &gt;</pre><p><strong>Checking all the available branch</strong></p><pre>$ git branch</pre><p><strong>Switch to other branch</strong></p><pre>$ git checkout &lt;branch name &gt;<br></pre><p><strong>Create a new branch and switch to it</strong></p><pre>$ git checkout -b &lt;branch name &gt;</pre><p><strong>Delete a branch</strong></p><pre>$ git branch -d &lt;branch name &gt;</pre><p><strong>Merging two branches</strong></p><p>Before merge any branch with master branch , it’s preferred to change/switch to master branch</p><p><strong><em>Types of Merge</em></strong></p><ol><li><strong>Fast-forward merge</strong>: When the target branch is directly behind the source branch.</li><li><strong>Three-way merge</strong>: When branches diverged, Git creates a new commit to reconcile the changes. If the same lines of code were changed in both branches, Git will show <strong>conflict</strong></li></ol><pre>$ git merge &lt;branch name &gt;</pre><p><strong>Git reset</strong></p><p>It lets you <strong>undo changes</strong> by resetting your branch to a previous commit or state.</p><p>1. to remove changes from staging area</p><pre>$ git reset &lt;name of the file&gt;</pre><p>2. to undo commits at repo level</p><pre>$ git reset &lt;mode&gt; &lt;Commit&gt;</pre><p><strong>Mode</strong> in git reset determines whether changes are removed from the staging area and/or the working directory.</p><ul><li><strong>soft</strong> → Keeps everything (changes stay in staging area and working directory)</li><li><strong>mixed</strong> → Removes changes from staging area, but keeps them in working directory</li><li><strong>hard</strong> → Removes changes from both staging area and working directory</li></ul><p><strong>Git push</strong></p><p>Upload the changes into Github</p><pre>$ git push &lt;remote&gt; &lt;branch&gt;</pre><p><strong>Git pull</strong></p><p>Git pull is used to pull all changes from a remote repository into the branch we are working on</p><pre>$ git pull &lt;remote&gt; &lt;branch&gt;<br></pre><p><strong>Why Git is Important for Testers</strong></p><p>While <strong>Git</strong> is often associated with developers, <strong>testers</strong> also benefit greatly from version control:</p><p><strong>1. Collaboration with Developers</strong></p><p>Testers can clone the latest version of the code, write or update test scripts, and share them with the team — all within Git.</p><p><strong>2. Test Automation Scripts</strong></p><p>Automated test cases, frameworks, and data files should be versioned just like code. Git helps maintain a history of test suite changes and ensures compatibility with current builds.</p><p><strong>3. Bug Tracking and Reproduction</strong></p><p>By checking out specific versions or commits, testers can reproduce bugs on older builds without needing access to legacy environments.</p><p><strong>4. Documentation and Change Logs</strong></p><p>Testers can document findings, scenarios, and configurations directly in the repository for better visibility and traceability.</p><p><strong>5. Code Reviews and Pull Requests</strong></p><p>Testers involved in code reviews or script validation can use pull requests to ensure quality before changes go live.</p><p>Git is more than just a tool — it’s a fundamental part of modern software development and testing. Whether you’re writing code, automating test cases, or verifying bugs, understanding Git gives you the power to collaborate effectively, manage change, and maintain a high-quality codebase.</p><p>For testers aiming to stay relevant and efficient in agile or DevOps teams, learning Git isn’t optional — it’s essential.</p><p>See you soon with another helpful article! Until then, keep exploring and happy testing !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ad5174bb5aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Don’t Type It… Automate It! A Textbox Guide for Beginners]]></title>
            <link>https://medium.com/@diy2hewage/dont-type-it-automate-it-a-textbox-guide-for-beginners-b8c56b020461?source=rss-2f05392fa468------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8c56b020461</guid>
            <dc:creator><![CDATA[Diyana_Hewage]]></dc:creator>
            <pubDate>Thu, 19 Jun 2025 16:13:18 GMT</pubDate>
            <atom:updated>2025-06-19T16:13:18.215Z</atom:updated>
            <content:encoded><![CDATA[<p>This article will walk you through working with a <strong>Textbox</strong>, using a simple example built with Selenium WebDriver and TestNG.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*F3Tm97Am7hiVIIYVC2-D9A.png" /></figure><p><strong>what is textbox</strong></p><p>In simple terms, a <strong>Textbox is a GUI element</strong> , typically an <strong>input field</strong> where we can <strong>enter or retrieve text</strong>. It lets us <strong>fill in forms</strong>, <strong>search for content</strong>, or <strong>submit information</strong>.</p><ol><li>How to Find the Textbox</li></ol><p>To work with a Textbox, we first need to find it on the webpage.</p><pre>WebElement username= driver.findElement(By.xpath(&quot;//input[@name=&#39;username&#39;]&quot;));</pre><p>2.How to Send a Text</p><p>Once we have identified the Textbox, we can send text into it</p><pre>username.sendKeys(&quot;Admin&quot;);</pre><p>3.How to Retrieve Text from Textbox</p><pre>String value=username.getAttribute(&quot;value&quot;);<br>System.out.println(&quot;Value inside of the username TextBox&quot; + value);</pre><p>4.How to Clear Textbox and Enter a New Value</p><pre>username.clear();<br>username.sendKeys(&quot;admin&quot;);</pre><p>5.How to Check if Textbox is Enabled or Disabled</p><pre>   boolean enabled=username.isEnabled();<br>   System.out.println(&quot;Is username text box is disabled&quot;+enabled);</pre><p>In this example, I’m using Selenium alongside TestNG</p><p>URL used : <a href="https://opensource-demo.orangehrmlive.com/web/index.php/auth/login">https://opensource-demo.orangehrmlive.com/web/index.php/auth/login</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VCXBKRLho_MtocNkZJ4MbQ.png" /><figcaption>Before Method</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OBdbWMuwrKyI8I2XtTlFJw.png" /></figure><p>Hope this helps you work effectively with Textboxes,</p><p>I’ll be bringing another article to your automation toolkit soon. Until then, happy testing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8c56b020461" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplifying Test Automation with Page Object Model (POM) in Selenium]]></title>
            <link>https://medium.com/@diy2hewage/simplifying-test-automation-with-page-object-model-pom-in-selenium-73f2d2e4bcf0?source=rss-2f05392fa468------2</link>
            <guid isPermaLink="false">https://medium.com/p/73f2d2e4bcf0</guid>
            <dc:creator><![CDATA[Diyana_Hewage]]></dc:creator>
            <pubDate>Fri, 28 Mar 2025 17:59:42 GMT</pubDate>
            <atom:updated>2025-03-28T17:59:42.166Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*Rl4Pn6pixaM9U2HjoLgu0A.jpeg" /></figure><p>In this article, I’ll give you a quick overview of the Page Object Model (POM), its benefits, and how to implement it effectively in your tests.</p><p><strong><em>What is Page Object Model (POM)?</em></strong></p><p>The Page Object Model (POM) is a design pattern used in software testing to improve the organization and maintenance of test code. It separates the test code from the web page’s structure and functionality, making your test scripts easier to read, reuse, and maintain. POM works best for projects with complex and constantly changing user interfaces (UI).</p><p>In POM, each page of the web application is represented as a class in the code. The elements on the page are defined as locators, and the interactions with these elements are implemented as methods within the same class.</p><p><strong><em>Concepts of the Page Object Model (POM):</em></strong></p><ol><li><strong>Page Classes</strong>: Each page of the application is represented by a class. A page class contains the web elements and methods to interact with those elements on the page.</li><li><strong>Locators</strong>: These are used to identify the web elements on the page, such as buttons, text boxes, or links.</li><li><strong>Test Classes/Test Scripts</strong>: The test class contains the logic for your test cases. It uses the page object class to interact with the web elements. The test class calls methods from the page object to perform actions on the page and verify the results.</li></ol><p><strong><em>Advantages of the Page object model (POM):</em></strong></p><p>· <strong>Reusability</strong>: If the same functionality is used in multiple tests, you can reuse the page object methods instead of repeating code in each test case.</p><p>· <strong>Maintainability</strong>: If the UI changes (eg ; an element’s ID or class name changes), you only need to update the corresponding page object class rather than updating all test cases.</p><p>· <strong>Readability</strong>: It makes your test scripts easier to understand. The scripts become clearer and focus on what the test is doing, rather than how it interacts with the web page.</p><p><strong><em>Example of Implementing POM with Selenium, Java, and TestNG :</em></strong></p><p>Here’s a simple example of how to use the Page Object Model (POM) in Selenium with Java and TestNG.</p><p><strong><em>1.Create the page classes</em></strong></p><blockquote><strong>LoginPage</strong></blockquote><p>The <strong>LoginPage</strong> class represents the login page of the website. It contains methods and web elements related to the login page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*NyjhIB8A2m8e0_bKO__qww.png" /></figure><blockquote><strong>Dashboard class</strong></blockquote><p><strong>Dashboard</strong> class use to verify whether a user has successfully logged into a website. This class checks if the login was successful by looking for a specific element on the dashboard page after the login.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*i2Kug_hJp183vLEzl2H6Cg.png" /></figure><p><strong><em>2. Create the test script</em></strong></p><p>The test validates that the login was successful by checking if the user is redirected to the dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dRqSDiaLBSohM8t9gEMVKQ.png" /></figure><p>Hope you have got basic understanding on how Page Object Model (POM) is working. We will go ahead with next learnings.</p><p>Happy Testing 🙌</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73f2d2e4bcf0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kickstart Test Automation: Setup TestNG with Maven]]></title>
            <link>https://medium.com/@diy2hewage/kickstart-test-automation-setup-testng-with-maven-fc8bf2ca5a86?source=rss-2f05392fa468------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc8bf2ca5a86</guid>
            <dc:creator><![CDATA[Diyana_Hewage]]></dc:creator>
            <pubDate>Sun, 16 Feb 2025 09:37:28 GMT</pubDate>
            <atom:updated>2025-02-16T09:37:28.271Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*uR2VlXx736VJQFsr9NQwFw.png" /></figure><p>In this article, I’ll Walk you through creating a Maven project and adding TestNG dependencies. This beginner-friendly guide will help you get started step by step.</p><blockquote><strong><em>Create Maven Project</em></strong></blockquote><ol><li><strong><em>Create New Project</em></strong></li></ol><p>Open IntelliJ IDEA, then navigate to the File menu. From the dropdown, select New and choose Project to begin creating a new project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*TbTFG2s3QZliGwMzT5Imgw.png" /></figure><p><strong><em>2. Set Project Details</em></strong></p><p>Once you proceed, a window will appear where you can specify the project’s <strong>Name</strong> and <strong>Location</strong> according to your preferences. Additionally, select <strong>Maven</strong> as the build system and <strong>Java</strong> as the programming language.</p><p>Provide <strong>Group ID . Artifact ID</strong> will be automatically generated based on the project name, though you may also specify a custom <strong>Artifact ID</strong> if desired. Review your entries for accuracy, and proceed by clicking the <strong>Create</strong> button. These steps allow you to define the specific details for your Maven project</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x3FoFSq_sW5D4hqChTrCOw.png" /></figure><p>Upon completing the above steps, the project you created will be generated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*P_ckfudrYw3I7Hlsk4wB9g.png" /></figure><blockquote><strong><em>Add dependencies to pom.xml</em></strong></blockquote><p>Once the project is created, the next step is to add the necessary TestNG and Selenium dependencies to the pom.xml file.</p><ol><li>Open the pom.xml File</li><li>Add TestNG and Selenium Dependencies: Within the &lt;dependencies&gt; section of the pom.xml file, include the following dependencies:</li></ol><ul><li><strong>For TestNG</strong>, use the following link to retrieve the correct dependency details : <a href="https://mvnrepository.com/artifact/org.testng/testng">Maven Repository: org.testng » testng</a></li><li><strong>For Selenium</strong>, include the following dependency : <a href="https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java">Maven Repository: org.seleniumhq.selenium » selenium-java</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pZZ4Uv3P1O0bjtWQzq2VYg.png" /></figure><p>After adding these dependencies, ensure that the project is reloaded to download the required libraries</p><blockquote><strong><em>Create First Test Class</em></strong></blockquote><ol><li>Navigate to <strong>src/test/java</strong></li><li>Package : Right click on java folder <strong>New → Package</strong>.</li></ol><p>2. Test class: Right-click the on the new package <strong>New</strong> → <strong>Java Class</strong>.</p><p>3. Name the class (ex: FirstTest).</p><p>4. In the newly created class, write a simple test method using TestNG annotations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*3TZx4HXer3jaKaQfxaThPQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y4jf3JNMgL49HLdE7jybFA.png" /></figure><blockquote><strong><em>Run the TestNG Test</em></strong></blockquote><p>Execute the program</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Gr4PMJ-ZZbxAGUU2ZGqKQ.png" /></figure><p>Hope you have got basic understanding on how to create maven project and add TestNG dependencies. We will go ahead with next learnings.</p><p>Happy Testing 🙌</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc8bf2ca5a86" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Selenium Locators]]></title>
            <link>https://medium.com/@diy2hewage/selenium-locators-d81bb2397bc7?source=rss-2f05392fa468------2</link>
            <guid isPermaLink="false">https://medium.com/p/d81bb2397bc7</guid>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[selenium-locators]]></category>
            <category><![CDATA[selenium]]></category>
            <dc:creator><![CDATA[Diyana_Hewage]]></dc:creator>
            <pubDate>Mon, 04 Nov 2024 10:11:43 GMT</pubDate>
            <atom:updated>2024-11-04T10:11:43.519Z</atom:updated>
            <content:encoded><![CDATA[<p>Selenium is an open-source web-based automation tool. In Selenium, locators are used to identify and interact with elements on a web page. Here are some commonly used locators in Selenium.</p><figure><img alt="Commonly used Selenium Locators" src="https://cdn-images-1.medium.com/max/778/1*3cVJEEAfMXAvBEkka8uI9Q.png" /></figure><p><strong><em>Locate by ID</em></strong></p><p>Find elements by ID attribute. most common way of locating element since ID is unique for each element.</p><p>ex: By.id(“user-name”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g6vWbZBLer2UMxKdPWcOQw.png" /></figure><p><strong><em>Locate by Name</em></strong></p><p>locate elements by name attribute , it is similar as locate elements by id attribute, can have multiple elements with the same name.</p><p>ex : By.name(“user-name”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SRJ1xfBIY5FG_Q2S-ClkHQ.png" /></figure><p><strong><em>locate by class name</em></strong></p><p>can find elements based on the class name .</p><p>ex : By.className(“input_error form_input”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AlYDbQ2aulSQ-t4DkTNdBg.png" /></figure><p><strong><em>locate by Tag</em></strong></p><p>Used to find elements by their HTML tag.</p><p>ex : By.tagName(“a”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F8EpXkQAOSkvscZ3FeWRng.png" /></figure><p><strong><em>locate by Css</em></strong></p><p>Most HTML pages are styled using cascading style sheet classes, also known as CSS. It also helps to find the elements on the webpage uniquely. This is very powerful and flexible. CSS sector is comparatively faster and unidirectional.</p><p>ex : By.cssSelector(“input[name= ‘login-button’]”);</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AIM0jlYtAvMXRGDl8F8lfA.png" /></figure><p><strong><em>locate by Xpath</em></strong></p><p>Matches the Xpath expression to the search value and locate the element based on that. Xpath provide bidirectional flow, which means traversal can be both way.</p><p><strong><em>Absolute Xpath</em></strong> : start from the root of the HTML or XML document , starts with single slash /</p><p><strong><em>Relative Xpath</em></strong> : can start anywhere in the DOM tree, starts with double slash //</p><p>ex : By.xpath(“//input[@id= ‘login-button’]”);</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a_UbdcEm5nCGpydiA35NWg.png" /></figure><p><strong><em>locate by Link</em></strong></p><p>Visible text whose anchor elements are to be found is match with search value. If there are two links that have the very same link text, this method will only access the first one.</p><p>ex : By.linkText(“Forgot Your Password?”);</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uQJuZe_cGYKbOXzlfI8PAg.png" /></figure><p><strong><em>locate by Partial Link Text</em></strong></p><p>Here also match the visible text with search value and find the anchor value. If there is partial link text that has multiple matches, only the first match will be accessed.</p><p>ex : By.partialLinkText();</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d81bb2397bc7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>