<?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 Tarun Babbar on Medium]]></title>
        <description><![CDATA[Stories by Tarun Babbar on Medium]]></description>
        <link>https://medium.com/@TarunBabbar?source=rss-c744dcd61332------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ahzKDmIKvUUNEg78w2bGeA@2x.jpeg</url>
            <title>Stories by Tarun Babbar on Medium</title>
            <link>https://medium.com/@TarunBabbar?source=rss-c744dcd61332------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 02:00:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@TarunBabbar/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[Selenium C# — Which selector to choose, why is my automation started failing suddenly?]]></title>
            <link>https://medium.com/@TarunBabbar/selenium-c-which-selector-to-choose-why-is-my-automation-started-failing-suddenly-41eab50fcd33?source=rss-c744dcd61332------2</link>
            <guid isPermaLink="false">https://medium.com/p/41eab50fcd33</guid>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[selenium-webdriver]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[jquery-ui]]></category>
            <dc:creator><![CDATA[Tarun Babbar]]></dc:creator>
            <pubDate>Thu, 08 Mar 2018 16:09:11 GMT</pubDate>
            <atom:updated>2018-03-08T16:09:58.645Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey Guys — In this article I would like to highlight few important areas which normally gets ignored while writing our test cases. It is important in the initial phase to ask yourself and team few questions which will help you have a more accurate framework, which is likely to change in later phases. There are multiple ways which are provided by Selenium Web Driver through which you can search a web element viz. Id, ClassName, XPath, CSScripting, LinkText, PartialLinkText, Name, TagName, etc. When we go to fetch the web-element we should know answers to below questions.</p><ol><li>Does web-application supports multiple languages? — If answer is yes, then avoid searching element using LinkText or Partial Link text, as these are likely to change with languages.</li><li>Does automation needs to run on multiple browsers? — Majority of web applications require running automation across Chrome, IE, FF, Opera, etc. If your answer to this question is yes, then make sure you are element property which you have written works across browsers. In my experience, I’ve always faced issues running automation using Selenium on IE browser, it is HIGHLY RECOMMENDED to use CSSScripting which is more fast and consistent across multiple browsers. I have seen few cases where there’s exact match for Id or ClassName, but converting them to CSSScripting gives you more flexibility.</li><li>Does your application contains JQuery, JavaScript, Angular JS components? If answer is yes, then you need create separate methods to handle loading of such components instead of using hard-coded times [Thread.Sleep(500)]. Use below code to handle such scenarios:</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/36f9949ff149a6177eed256b72615297/href">https://medium.com/media/36f9949ff149a6177eed256b72615297/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/64ea87367024e855c5e825cbf3c243d5/href">https://medium.com/media/64ea87367024e855c5e825cbf3c243d5/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/019b3a5e876cf0928370cc5fa3dc74d7/href">https://medium.com/media/019b3a5e876cf0928370cc5fa3dc74d7/href</a></iframe><p>4. Do you see sometimes element is not clickable? — Its important that your automation is consistent. Your test cases should pass, if they are intended to pass and fail if expected conditions don’t match. But if your automation started failing and you observe inconsistency in your test automation, then its time to look back your code and identify code bottlenecks. I’ve often seen issues where page is still loading and your code wants to click and element, which fails, because it is either hidden, not visible or not yet ready to be clicked. To fix these issues, you should write a code to wait until your element is ready to be clicked. Below piece of code, will wait till element is enabled and ready to be clicked.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/23fe10ea6b673e793f8128bad6aa61ca/href">https://medium.com/media/23fe10ea6b673e793f8128bad6aa61ca/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/831053a6bf49efbd62381909e89151b1/href">https://medium.com/media/831053a6bf49efbd62381909e89151b1/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41eab50fcd33" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Selenium Web Driver C#: DrawHighlight DOM Element]]></title>
            <link>https://medium.com/@TarunBabbar/selenium-web-driver-drawhighlight-dom-element-4da25954818f?source=rss-c744dcd61332------2</link>
            <guid isPermaLink="false">https://medium.com/p/4da25954818f</guid>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[visual-studio]]></category>
            <category><![CDATA[selenium-test-automation]]></category>
            <category><![CDATA[selenium-webdriver]]></category>
            <dc:creator><![CDATA[Tarun Babbar]]></dc:creator>
            <pubDate>Sat, 27 May 2017 15:32:10 GMT</pubDate>
            <atom:updated>2017-05-30T17:50:37.794Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey Guys,<br>I believe you have basic knowledge on Selenium Web Driver, if not, please do visit my other <a href="https://medium.com/@TarunBabbar">stories</a>. Its easy to identify a web element from Dev toolbar, but when it comes to fetch the element from web driver, sometimes we feel we have fetched the correct element, but when try to perform operations like Click or SendKeys, web driver throws exception. There are couple of possible things due to which you might get web driver exception:<br>1. You have fetched the element but the element is hidden or a wrong element. An example would be you clicked an element and page is loading certain contents whose element you are trying to fetch.<br>2. You have fetched the correct element but page is not yet ready to perform the operations.</p><p>The basic solution for both the above possibilities is to Wait till the element is visible. You can use either of Explicit or Implicit wait till the element gets visible.<br>You can use Microsoft.VisualStudio.TestTools.UITesting.Playback.Wait(int waitTimeInMilliseconds) or you can use WebDriverWait(webDriver, new TimeSpan(0, 0, 30)).</p><p>Even after performing wait operation, there is possibility that you still see the exception. To make sure you are fetching correct DOM element, you can use below code to highlight the UI control while doing debugging:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f8bfb1154d133db4620d3ffab2f9fa2/href">https://medium.com/media/0f8bfb1154d133db4620d3ffab2f9fa2/href</a></iframe><p>You now need to call this DrawHighligh method in your test class to highlight the element you want to retrieve. Below is the piece of code along with snapshot of it will looks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OOLRnlgQ4HUhsTVXr9EVBg.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/328122ccf5ca3f845ddee690dab942d2/href">https://medium.com/media/328122ccf5ca3f845ddee690dab942d2/href</a></iframe><p>Hope this would help you too in debugging. <br>For more details, I have placed the source code at <a href="https://github.com/TarunBabbar/SeleniumTestAutomationUsingWebDriver">github</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4da25954818f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Selenium C# — Identify DOM Element]]></title>
            <link>https://medium.com/@TarunBabbar/selenium-c-identify-dom-element-fffbe4be441d?source=rss-c744dcd61332------2</link>
            <guid isPermaLink="false">https://medium.com/p/fffbe4be441d</guid>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Tarun Babbar]]></dc:creator>
            <pubDate>Fri, 26 May 2017 13:57:06 GMT</pubDate>
            <atom:updated>2017-05-29T13:06:00.215Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey Guys,<br>Before I go in deep to tell you various techniques to identify DOM elements on a web page, I recommend you to please visit <a href="https://medium.com/@IamTarunBabbar/test-automation-using-c-selenium-web-driver-c195c3d4c273">this</a> link to set up initial Visual Studio test automation solution. <a href="https://medium.com/@IamTarunBabbar/selenium-web-driver-ui-automation-on-multiple-browsers-d8fdc1529c78">This </a>link will give you idea on how to execute tests across browsers.</p><p>OK, so now you have your initial test automation set up done, lets move ahead and see various ways through which you can identify DOM elements from a web application.</p><p><strong>Modes Available:</strong></p><p>Selenium web driver has exposed several methods which will help you identify you DOM element. Remember, how we identified google search textbox and button in <a href="https://medium.com/@IamTarunBabbar/test-automation-using-c-selenium-web-driver-c195c3d4c273">this</a>?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d281e44b48a8594f4f3e6fb5a6dfd28f/href">https://medium.com/media/d281e44b48a8594f4f3e6fb5a6dfd28f/href</a></iframe><p>I simply created an instance of InternetExplorer webDriver and called FindElement method. Inside FindElement method, selenium has provided you several ways to search your DOM element. Below are the important which is mostly used:</p><ol><li>By.ClassName</li><li>By.CssSelector</li><li>By.Id</li><li>By.LinkText</li><li>By.Name</li><li>By.PartialLinkText</li><li>By.TagName</li><li>By.XPath</li></ol><p>You can find single element or multiple elements using the above search.<br>You can use the below code if single element matches the search criteria.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/30701674796280b252ffd44d4ea0fe95/href">https://medium.com/media/30701674796280b252ffd44d4ea0fe95/href</a></iframe><p>In case, you are searching for multiple elements for a search criteria, example google search resulting in pagination at the bottom of the page as below (<em>Google search resulting in pagination</em>), then you search all these links as shown in <em>Searching multiple elements on google search results with TagName</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5F6vEU8Mpcn5N9Tiz-qeeg.png" /><figcaption>Google search resulting in pagination</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7efe1729976fe2aa79b0c331f24691f5/href">https://medium.com/media/7efe1729976fe2aa79b0c331f24691f5/href</a></iframe><p>Please do look into the source code placed at <a href="https://github.com/TarunBabbar/SeleniumTestAutomationUsingWebDriver">github</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fffbe4be441d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Selenium C# WebDriver.FindElement (By.XPath contains <<value>>)]]></title>
            <link>https://medium.com/@TarunBabbar/selenium-c-identify-dom-element-a9b32e74afc6?source=rss-c744dcd61332------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9b32e74afc6</guid>
            <category><![CDATA[web-applications]]></category>
            <category><![CDATA[selenium-webdriver]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[visual-studio]]></category>
            <dc:creator><![CDATA[Tarun Babbar]]></dc:creator>
            <pubDate>Fri, 26 May 2017 05:48:19 GMT</pubDate>
            <atom:updated>2017-05-30T17:52:08.906Z</atom:updated>
            <content:encoded><![CDATA[<p>Please go to <a href="https://medium.com/@TarunBabbar/selenium-c-identify-dom-element-fffbe4be441d">this </a>first story where I explained on various modes to search DOM elements on the web page.</p><p>I hope you know how to identify a DOM from the browser. Below is one of the snapshot for identifying the element. Here, I am identifying Medium logo on <a href="https://medium.com./">https://medium.com.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Tz8r0wrw53iQWNyButKTNQ.png" /></figure><p>If you closely look, class name is “siteNav-logo”. Below is the snapshot of the code which you would write to identify this element on the web page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*vxOlWlt1bor7lgJHQbCm5Q.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ffb6042124a106511eaa27653acb1dc5/href">https://medium.com/media/ffb6042124a106511eaa27653acb1dc5/href</a></iframe><p>See, how simple it is!!</p><p>Let’s move further and look into the complexity where its difficult to identify element using classname.</p><p>Consider the scenario where you want to write a story on <a href="https://medium.com./">https://medium.com.</a> In order to do so, you need to launch the browser, hit the medium site and then get the DOM element in browser. Below is how to get the same from Chrome browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*oZvEjFBdzya_dQ3FLGvQjA.png" /></figure><p>OK, so you now know the class name as “ button button — chromeless u-baseColor — buttonNormal is-inSiteNavBar u-sm-hide u-marginRight15 u-lineHeight30 u-height32 is-touched”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*mXvfKqUpC7wgsRNI48MYaA.png" /></figure><p>Let’s try with C# code to identify this DOM element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9h_1Y0W5QGSe8N6f-w24WA.png" /></figure><h3>It didn’t worked ?!</h3><p>Curious? Yes you are !! Let’s look closely into the exception that you got. It says : <strong><em>invalid selector: Compound class names not permitted</em></strong></p><p>So what does this mean? Am I not able to search element with class names having space? Well, actually you can!! See the below code. You can search element with xpath containing class name with spaces. We will be talking about xpath in next chapters, so let’s currently focus on element search with class name. See the below code, it actually worked !!</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*KbSAflO48b6ISfBL2fBcMA.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/196749918f9ad67ff11daa91301adc85/href">https://medium.com/media/196749918f9ad67ff11daa91301adc85/href</a></iframe><p>If you look closely into the changes I made, I used class name as <strong><em>is-inSiteNavBar u-sm-hide</em></strong> which is subpart of the entire class name and since it has one space in the class name, so I used <strong>finding element with xpath which contains subpart of the class name. <br></strong>How simple was that !!</p><p>Please do look at source code placed at <a href="https://github.com/TarunBabbar/SeleniumTestAutomationUsingWebDriver">github </a>for more details. <br>Hope you liked it!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9b32e74afc6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Selenium Web Driver C # : UI Automation on Multiple Browsers]]></title>
            <link>https://medium.com/@TarunBabbar/selenium-web-driver-ui-automation-on-multiple-browsers-d8fdc1529c78?source=rss-c744dcd61332------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8fdc1529c78</guid>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[visual-studio]]></category>
            <category><![CDATA[cross-browser-testing]]></category>
            <category><![CDATA[selenium-webdriver]]></category>
            <category><![CDATA[test-automation]]></category>
            <dc:creator><![CDATA[Tarun Babbar]]></dc:creator>
            <pubDate>Wed, 24 May 2017 08:00:25 GMT</pubDate>
            <atom:updated>2017-05-30T17:49:24.367Z</atom:updated>
            <content:encoded><![CDATA[<p>I hope you have gone through my first story on Selenium Driver published <a href="https://medium.com/@IamTarunBabbar/test-automation-using-c-selenium-web-driver-c195c3d4c273">here,</a> where I talked about how to create your first ui automation test case using selenium driver and C#. Here, I am going little further to talk about how to do testing across multiple browsers. If you haven’t yet visited, please do visit <a href="https://medium.com/@IamTarunBabbar/test-automation-using-c-selenium-web-driver-c195c3d4c273">this</a> link to get initial idea on Selenium Web Driver.</p><p>An application is always opened on different browsers — Chrome, IE, Firefox, Safari, etc. Selenium web driver is supported for all these browsers. To verify behavior across browsers, Selenium has provided an easy mechanism to instantiate any of Chrome/FF/IE browsers. You can use the below piece of code which would help you achieve the same. Comparing with code I shown in my previous article, here I created a separate class named WebDriver, where I am initializing instance for webdriver, as per the instance required.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a1230baa60cf51068fd0a5df53451489/href">https://medium.com/media/a1230baa60cf51068fd0a5df53451489/href</a></iframe><p>I have an enum where I am storing all the browser types as below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a42d9c7a7cd9024bb8e2a4f08bc7767a/href">https://medium.com/media/a42d9c7a7cd9024bb8e2a4f08bc7767a/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b004083555aaf73362ea7205bad6de99/href">https://medium.com/media/b004083555aaf73362ea7205bad6de99/href</a></iframe><p>So easy with Selenium driver !!<br>For more information, please look at the source code placed at <a href="https://github.com/TarunBabbar/SeleniumTestAutomationUsingWebDriver">github</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8fdc1529c78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Selenium Web Driver C# — Test Automation SetUp]]></title>
            <link>https://medium.com/@TarunBabbar/test-automation-using-c-selenium-web-driver-c195c3d4c273?source=rss-c744dcd61332------2</link>
            <guid isPermaLink="false">https://medium.com/p/c195c3d4c273</guid>
            <category><![CDATA[selenium-webdriver]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[setup]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[visual-studio]]></category>
            <dc:creator><![CDATA[Tarun Babbar]]></dc:creator>
            <pubDate>Tue, 23 May 2017 10:52:51 GMT</pubDate>
            <atom:updated>2017-05-30T17:53:38.515Z</atom:updated>
            <content:encoded><![CDATA[<p>There are multiple technologies available to develop web applications, like, php, java, ASP.Net, Angular JS, MVC, React. There are numerous tools available to do UI automation testing like QTP, Soap UI, etc. Here I am going to talk about Selenium Web Driver with C# which will ease your UI automation in any of the above languages.</p><p>To start with web application automation using Selenium Web Driver, you need to perform below steps:</p><p>Create a New Test Automation Project in Visual Studio and add Selenium nugget packages. Below are some screenshots:</p><ol><li>Create a new test project:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*re8ZyKWVJ5LBUSsYCwntpQ.png" /></figure><p>2. Add nuget package : Right click on solution and click manage Nuget packages</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*1UAK_ucAjEjT1fFKHM0cjA.png" /></figure><p>3. Browse for Selenium nugets and install to the solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fyTZIbipzt5ua3syf7ZUoQ.png" /></figure><p>4. Verify nuget packages are installed and you can see the same in References section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XQcucZwtQtqZchcCSpIkjQ.png" /></figure><p>5. If you go to location — MyFirstSeleniumWebApplication\packages, you will see all the packages installed there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*3PHFDya1RYqYD7Is3KHNCg.png" /></figure><p>You are not ready to write your first ever UI Automation test case in C#. Lets take a scenario to do UI automation for google search. It will follow the below steps:</p><p>a. Navigate to Google URL.</p><p>b. Identity Google Search text box and provide some inputs.</p><p>c. Click on Search button.</p><p>Below piece of code help you achieve this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*vaSSZ5drl1WVliFX7X3X4g.png" /><figcaption>Code to launch IE and do google search using Selenium Web Driver.</figcaption></figure><p>See how easy it is !! Please have a look at the entire source code at my <a href="https://github.com/TarunBabbar/SeleniumTestAutomationUsingWebDriver">github</a> link.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c195c3d4c273" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>