<?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 Neha Vaidya on Medium]]></title>
        <description><![CDATA[Stories by Neha Vaidya on Medium]]></description>
        <link>https://medium.com/@neha.vaidya?source=rss-dd4f4acd2a2b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*m4g354EW2Wf6Yk7W.jpg</url>
            <title>Stories by Neha Vaidya on Medium</title>
            <link>https://medium.com/@neha.vaidya?source=rss-dd4f4acd2a2b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 21:31:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@neha.vaidya/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[Cucumber Selenium Tutorial — Know How to Perform Website Testing]]></title>
            <link>https://medium.com/edureka/cucumber-selenium-tutorial-aefec05f4733?source=rss-dd4f4acd2a2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/aefec05f4733</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[cucumber]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[cucumber-selenium]]></category>
            <dc:creator><![CDATA[Neha Vaidya]]></dc:creator>
            <pubDate>Mon, 20 May 2019 11:20:28 GMT</pubDate>
            <atom:updated>2019-06-05T12:03:36.507Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cucumber Selenium Tutorial — Know How to Perform Website Testing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*xQpFSPH8yOmuO3tKz1JCsg.png" /></figure><p>No doubt that Selenium is one of the fantastic tools in the field of Automation Testing, but it might seem a little hard for a non-technical person to understand its working due to the complexity of the code. To ease this task, Cucumber comes into the play, which makes the complex code simple and easy to understand. But, how exactly it does that? I will be telling you all about it through this article.</p><p>Below are the topics in this article:</p><ul><li>Introduction to Cucumber</li></ul><p>1. Why Cucumber?</p><p>2. Behavior Driven Development</p><ul><li>Introduction to Selenium</li><li>Why use Cucumber with Selenium?</li><li>Steps to create Cucumber application</li></ul><h3>Introduction to Cucumber</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iNyZy6KQpqGu7xDtVJ8fWA.png" /></figure><p>Cucumber is a testing approach/tool that supports <strong><em>Behavior Driven Development (BDD).</em></strong> It provides a way to write tests that anybody can understand, regardless of their extent of technical knowledge.</p><p>It explains the behavior of the application in a simple English text using <strong><em>Gherkin</em></strong> language. I hope that you got a glimpse about what is Cucumber. Now, let’s move further and understand some of the facts that depict the need for Cucumber in a testing framework.</p><h3>Why Cucumber?</h3><p>Well, Cucumber is one of the most popular tools because of the reasons listed below:</p><ol><li>Cucumber is <strong>open source</strong> and hence, its free to use.</li><li>On using Cucumber, you can write your <strong>test scripts</strong> in multiple languages such as Java, Ruby, .NET, Python, etc.</li><li>It also integrates with Selenium, Ruby on Rails, Watir and other <strong>web-based testing</strong> tools.</li><li>Cucumber is one of the most widely used <strong>BDD</strong> tools.</li></ol><p>These are some of the unique features that make Cucumber helpful for testing a website. Now that you know what is Cucumber and why do you need it, let’s understand one of the unique features of Cucumber that makes it easy for a non-techie to understand the test cases.</p><h3>Behavior Driven Development(BDD)</h3><p>In very simple terms, BDD or <em>Behavior-Driven Development</em> is a technique where your specifications or test cases are written in plain English like sentences. With this approach, the non-technical team members find it easy to understand the flow and collaborate more in the process of software development.</p><p>Let’s understand this with the help of a simple example. Consider a scenario where you want to test the Twitter website. One of the test scenarios is to verify the login credentials. With BDD, you can write this test scenario in this format:</p><pre>Feature: Test Twitter smoke scenario<br> <br>Scenario: Test login with valid credentials<br>Given Open the firefox and start application<br>When I enter valid username and valid password<br>Then user should be able to login successfully</pre><p>In the above example, I have just written a few statements in simple English for defining the scenarios. I will be providing more insights into this scenario and its implementation in the later part of this article. For now , let’s move further in Cucumber Selenium Tutorial article and learn the fundamentals of Selenium.</p><h3><strong>Introduction to Selenium</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*5f8WSYpLJ5JQfF6GjigyCQ.png" /></figure><p>Selenium is the preferred tool when it comes to automating the tests which are carried out on web browsers. It is useful only for testing of web applications. Any desktop (software) application or mobile application cannot be tested using Selenium. It is very helpful in writing functional test cases. It also provides reliable performance with ‘ <strong>n’ </strong>number of test cases and it is obviously the best suitable automation tool for web applications.</p><p>Now that you know what is Selenium, let’s move further in this article and understand why use Cucumber with Selenium?</p><h3>Why use Cucumber with Selenium?</h3><p>Many organizations use Selenium for <a href="https://www.edureka.co/blog/regression-testing?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=cucumber-selenium-tutorial">functional and regression testing. </a>Selenium and Cucumber are a great combination when it comes to web application automation, as Cucumber allows you to write your tests quickly in English-like language and Selenium allows you to run on various combinations of browsers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oj3A8yFsxnw035DeU_JTxg.png" /></figure><p>When using Selenium with Cucumber for test automation, tests are written in feature files that can be understood by various stakeholders in an agile environment such as Business Analysts. Cucumber also comes with its ability to support multiple scripts and programming languages and JUnit is used to execute these scripts and generate the output.</p><p>Having understood this, let’s now see the various steps to create Cucumber application and run the test cases.</p><h3>Steps to create Cucumber Application</h3><p>The various steps involved in creating a Cucumber application are as follows:</p><ol><li>Download the Jar files of Cucumber and Selenium and configure the build path.</li><li>Add Cucumber Plugin from Eclipse Marketplace.</li><li>Create a feature file and add scenarios.</li><li>Implement the steps for the scenarios.</li><li>Write the runner class and execute the code.</li></ol><p>Now, let’s understand each of these steps in detail.</p><p><strong>Step1: Download Cucumber and Selenium Jar files</strong></p><p><em>Cucumber</em> doesn’t actually interact with the browser and <em>performs</em> actions on the website under test. Interacting with the website <em>is</em> the action that <em>is</em> performed by Selenium WebDriver. Due to this reason, <em>you will need</em> to download <em>Cucumber</em> as well as Selenium Webdriver <em>jar files</em>. Below is the list of jar files for Cucumber.</p><ul><li>Cucumber-core</li><li>Cucumber-html</li><li>cobertura code coverage</li><li>Cucumber-java</li><li>Cucumber-junit</li><li>Cucumber-jvm-deps</li><li>Cucumber-reporting</li><li>Hamcrest-core</li><li>Gherkin</li><li>Junit</li></ul><p>Once you download these jar files from <a href="https://mvnrepository.com/">Maven Repository</a>, you can configure the build path of your project and add all the <em>.jar</em> files and libraries as shown in the below snapshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*4kX25Dmq8tBE-fP52i1Kdg.png" /></figure><p><strong>Step 2: The next step is to install Cucumber on your Eclipse. For that, you need to go to <em>Help -&gt; Eclipse Marketplace -&gt; Search Cucumber</em> and install <em>Cucumber and Naturals</em> on your eclipse. Below snapshot depicts the same.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*19i2bTDg6Y10o2zKbvoqog.png" /></figure><p><strong>Step 3: Once you configure Cucumber, the next step is to create a feature file. First, you have to create a new source folder and then add a feature file as shown below.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*g_EZqJRPQe21eOthE8eawQ.png" /></figure><p>Next, you need to specify the name of the feature file as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*Ojr9RQuemM3o2yntNfKkbQ.png" /></figure><p>Once you create the feature file, you can write the scenarios as shown in the below code.</p><h3>Test Scenario I:</h3><pre>Feature: Reset functionality on login page of Application<br> <br>Scenario: Verification of Reset button<br>Given Open the Firefox and launch the application<br>When Enter the Username and Password<br>Then Reset the credential</pre><p><strong>Step 4: After that, you need to implement the scenarios with the help of step definitions. In the below code, I have implemented the methods for the scenario that I have written in the feature file.</strong></p><pre>package stepDefinitions;<br> <br>import cucumber.api.java.en.Given;<br>import cucumber.api.java.en.Then;<br>import cucumber.api.java.en.When;<br> <br>public class Steps {<br><a href="http://twitter.com/Given">@Given</a>(&quot;^Open the Firefox and launch the application$&quot;)<br>public void open_the_Firefox_and_launch_the_application() throws Throwable<br>{<br>System.out.println(&quot;This Step open the Firefox and launch the application.&quot;);<br>}<br> <br><a href="http://twitter.com/When">@When</a>(&quot;^Enter the Username and Password$&quot;)<br>public void enter_the_Username_and_Password() throws Throwable<br>{<br>System.out.println(&quot;This step enter the Username and Password on the login page.&quot;);<br>}<br> <br><a href="http://twitter.com/Then">@Then</a>(&quot;^Reset the credential$&quot;)<br>public void Reset_the_credential() throws Throwable<br>{<br>System.out.println(&quot;This step click on the Reset button.&quot;);<br>}<br>}</pre><p><strong>Step 5: Now, the last step is to create the ‘ <em>runner class’</em> and execute the program. Basically, your project structure should look like as depicted in the below snapshot.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/229/1*enOjnA6GFGk9BFWzc9hl2A.png" /></figure><p>In the above snapshot, ‘ <em>Runner.java’</em> is an executable file. Let’s now code this file and understand how it works.</p><pre>package Runner;<br>import org.junit.runner.RunWith; <br>import cucumber.api.CucumberOptions; <br>import cucumber.api.junit.Cucumber;<br> <br><a href="http://twitter.com/RunWith">@RunWith</a>(Cucumber.class) <br><a href="http://twitter.com/CucumberOptions">@CucumberOptions</a>(features=&quot;features&quot;,glue={&quot;stepD&quot;}) <br>public class Runner <br>{<br>}</pre><p>In the above code, I have ‘@CucumberOptions’ and specify the package name of both feature file and Runner file. So that it will implement the methods and run the code. When you run the program, it will display the methods from the step definition. Your <strong>output</strong> should look like as shown below:</p><pre>This Step open the Firefox and launch the application.<br>This step enter the Username and Password on the login page.<br>This step click on the Reset button.<br> <br>1 Scenarios (32m1 passed)<br>3 Steps (32m3 passed)<br>0m0.185s</pre><p>So, this is how you need to write all the files and execute the program.</p><h3>Test Scenario II:</h3><p>Now, let’s understand one more scenario wherein I have integrated Selenium with Cucumber. Consider a scenario where you want to test the Twitter website. One of the test scenarios will verify the login credentials. With BDD, you can write this test scenario in this format:</p><pre>Feature: Test Twitter smoke scenario<br> <br>Scenario: Test login with valid credentials<br>Given Open the firefox and start application<br>When I enter valid username and valid password<br>Then user should be able to login successfully</pre><p>Next, let’s write the Step definition class to implement all the scenarios.</p><pre>package stepD;<br>import java.util.concurrent.TimeUnit;<br>import org.openqa.selenium.By;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.firefox.FirefoxDriver;<br>import cucumber.api.java.en.Given;<br>import cucumber.api.java.en.Then;<br>import cucumber.api.java.en.When;<br> <br>public class SmokeTest {<br>WebDriver driver;<br><a href="http://twitter.com/Given">@Given</a>(&quot;^Open the firefox and start application$&quot;)<br>public void open_the_firefox_and_start_application() throws Throwable {<br>System.setProperty(&quot;webdriver.gecko.driver&quot;, &quot;C:geckodriver-v0.23.0-win64geckodriver.exe&quot;);<br>driver = new FirefoxDriver();<br>driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);<br>driver.get(&quot;<a href="https://twitter.com/login">https://twitter.com/login</a>&quot;);<br>}<br> <br><a href="http://twitter.com/When">@When</a>(&quot;^I enter valid username and valid password$&quot;)<br>public void I_enter_valid_username_and_valid_password() throws Throwable {<br>driver.findElement(By.xpath(&quot;//input[<a href="http://twitter.com/placeholder">@placeholder</a>=&#39;Phone, email or username&#39;]&quot;)).sendKeys(&quot;your_username&quot;);<br>driver.findElement(By.xpath(&quot;//div[<a href="http://twitter.com/class">@class</a>=&#39;clearfix field&#39;]//input[<a href="http://twitter.com/placeholder">@placeholder</a>=&#39;Password&#39;]&quot;)).sendKeys(&quot;your_password&quot;);<br>}<br><a href="http://twitter.com/Then">@Then</a>(&quot;^user should be able to login successfully$&quot;)<br>public void user_should_be_able_to_login_successfully() throws Throwable {<br>driver.findElement(By.xpath(&quot;//button[<a href="http://twitter.com/class">@class</a>=&#39;submit EdgeButton EdgeButton--primary EdgeButtom--medium&#39;]&quot;)).click();<br>}<br>}</pre><p>In the above program, I have used GeckoDriver to launch firefox browser and using driver.get() it will navigate through the Twitter log in page. Further, it will locate the username and password text box using XPath locator and enter the valid credentials. Finally, it will log in successfully and run the test cases. You have to execute the runner as a JUnit test to know whether the tests are passed or failed.</p><p>Below snapshot shows the output of the program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9rJPxjnkBYLo4R_Y8rM9EA.png" /></figure><p>This is how you need to write all the files and execute the program. So, that was all about Cucumber Selenium Tutorial. I hope you understood the concepts and helped in adding value to your knowledge. If you wish to check out more articles on the market’s most trending technologies like Artificial Intelligence, DevOps, Ethical Hacking, then you can refer to<a href="https://www.edureka.co/blog/?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=cucumber-selenium-tutorial"> Edureka’s official site.</a></p><p>Do look out for other articles in this series which will explain the various other aspects of Selenium.</p><blockquote>1. <a href="https://medium.com/edureka/selenium-tutorial-77879a1d9af1">Selenium Tutorial</a></blockquote><blockquote>2. <a href="https://medium.com/edureka/selenium-webdriver-tutorial-e3e6219f21ad">Selenium WebDriver: TestNG For Test Case Management &amp; Report Generation</a></blockquote><blockquote>3. <a href="https://medium.com/edureka/selenium-framework-data-keyword-hybrid-frameworks-ea8d4f4ce99f">Building A Data Driven, Keyword Driven &amp; Hybrid Selenium Framework</a></blockquote><blockquote>4.<a href="https://medium.com/edureka/locators-in-selenium-f6e6b282aed8"> Locators in Selenium</a></blockquote><blockquote>5. <a href="https://medium.com/edureka/xpath-in-selenium-cd659373e01a">XPath Tutorial</a></blockquote><blockquote>6. <a href="https://medium.com/edureka/waits-in-selenium-5b57b56f5e5a">Waits in Selenium</a></blockquote><blockquote>7. <a href="https://medium.com/edureka/selenium-grid-tutorial-ef342799c484">Setting up a Selenium Grid for distributed Selenium testing</a></blockquote><blockquote>8. <a href="https://medium.com/edureka/selenium-using-python-edc22a44f819">Selenium Using Python</a></blockquote><blockquote>9. <a href="https://medium.com/edureka/cross-browser-testing-9299b04ce277">Cross Browser Testing Using LambdaTest</a></blockquote><blockquote>10. <a href="https://medium.com/edureka/cross-browser-testing-using-selenium-90b1911c6d60">Cross Browser Testing Using Selenium</a></blockquote><blockquote>11. <a href="https://medium.com/edureka/handle-multiple-windows-in-selenium-727ba5f8f6a7">Handle Multiple Windows in Selenium</a></blockquote><blockquote>12. <a href="https://medium.com/edureka/page-object-model-in-selenium-bc4d7c8c4203">Page Object Model In Selenium</a></blockquote><blockquote>13. <a href="https://medium.com/edureka/selenium-projects-b2df15d35fe2">Selenium Projects</a></blockquote><blockquote>14. <a href="https://medium.com/edureka/qtp-vs-selenium-338f3d3bbfa7">QTP vs Selenium</a></blockquote><blockquote>15. <a href="https://medium.com/edureka/selenium-vs-rpa-84159dbcd0f2">Selenium vs RPA</a></blockquote><blockquote>16. <a href="https://medium.com/edureka/selenium-webdriver-architecture-565e2db26dd5">Selenium WebDriver Architecture</a></blockquote><blockquote>17. <a href="https://medium.com/edureka/exceptions-in-selenium-369c38155e7d">Handling Exceptions In Selenium</a></blockquote><p><em>Originally published at </em><a href="https://www.edureka.co/blog/cucumber-selenium-tutorial/"><em>https://www.edureka.co</em></a><em> on May 20, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aefec05f4733" width="1" height="1" alt=""><hr><p><a href="https://medium.com/edureka/cucumber-selenium-tutorial-aefec05f4733">Cucumber Selenium Tutorial — Know How to Perform Website Testing</a> was originally published in <a href="https://medium.com/edureka">Edureka</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Comprehensive Guide To Selenium WebDriver Architecture]]></title>
            <link>https://medium.com/edureka/selenium-webdriver-architecture-565e2db26dd5?source=rss-dd4f4acd2a2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/565e2db26dd5</guid>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[selenium-test-automation]]></category>
            <category><![CDATA[selenium-architecture]]></category>
            <category><![CDATA[selenium-webdriver]]></category>
            <category><![CDATA[selenium-ide]]></category>
            <dc:creator><![CDATA[Neha Vaidya]]></dc:creator>
            <pubDate>Wed, 08 May 2019 13:36:34 GMT</pubDate>
            <atom:updated>2019-06-05T11:58:53.427Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*vAYybkRwXxiAdm69bjGqnQ.png" /><figcaption>Selenium Architecture — Edureka</figcaption></figure><p>Testing the system against all odds is a challenging task and you need a tool which can help you in this process. One such predominantly used tool by Automation Testers is Selenium. If you are a beginner and wish to know how Selenium functions internally, then you have landed at the perfect place. In this article, I will give you brief insights about Selenium WebDriver Architecture.</p><p>Below are the topics covered in this article:</p><ul><li>What is Selenium?</li><li>Selenium Suite of Tools</li><li>Selenium WebDriver Architecture</li><li>Demo</li></ul><h3>What is Selenium?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*iDjTEOFxWh9F-hK1cbKm7w.png" /></figure><p>Selenium is an open source portable framework used to automate testing of web applications. It is highly flexible when it comes to testing functional and regression test cases. Selenium test scripts can be written in different programming languages like Java, Python, C# and many more. These test scripts can run across various browsers like Chrome, Safari, Firefox, Opera and also provides support across various platforms like Windows, Mac OS, Linux, Solaris. Selenium also supports cross browsing where the test cases run across various platforms simultaneously. It also helps in creating robust, browser-based regression automation suites and perform tests.</p><p>I hope you understood the fundamentals of Selenium. Now let’s move further and understand various tools that are available in the Selenium Suite.</p><h3>Selenium Suite of Tools</h3><p>Selenium is mainly comprised of a suite of tools, which include:</p><ul><li>Selenium IDE</li><li>Selenium RC</li><li>Selenium WebDriver</li><li>Selenium Grid</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*SoFP1mlfwAITgI4_KHMMiQ.png" /></figure><p>Let’s understand the functionalities of each of these tools in more detail.</p><h4>Selenium IDE</h4><p>IDE (Integrated Development Environment) is a Firefox plugin. It is one of the simplest frameworks in the Selenium Suite. It allows us to record and playback the scripts. If you wish to create scripts using <a href="https://www.edureka.co/blog/selenium-ide?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=selenium-webdriver-architecture">Selenium IDE</a>, you need to use Selenium RC or Selenium WebDriver to write more advanced and robust test cases.</p><p>Next, let’s see what is Selenium RC.</p><h4>Selenium RC</h4><p>Selenium RC, also known as Selenium 1, was the main Selenium project for a long time before the WebDriver merge brought up Selenium 2. It mainly relies on JavaScript for automation. It supports Ruby, PHP, Python, Perl and C#, Java, Javascript. It supports almost every browser out there.</p><blockquote><strong><em>Note:</em></strong><em> Selenium RC is officially deprecated.</em></blockquote><h4>Selenium WebDriver</h4><p>Selenium WebDriver is a browser automation framework that accepts commands and sends them to a browser. It is implemented through a browser-specific driver. It directly communicates with the browser and controls it. Selenium WebDriver supports various programming languages like — Java, C#, PHP, Perl, and JavaScript</p><p>Selenium WebDriver supports the following:</p><ol><li><strong><em>Operation System Support</em></strong> — Windows, Mac OS, Linux, Solaris</li><li><strong><em>Browser Support</em></strong> — Mozilla Firefox, Internet Explorer, Google Chrome 12.0.712.0 and above, Safari, Opera 11.5 and above, Android, iOS, HtmlUnit 2.9 and above.</li></ol><h4>Selenium Grid</h4><p>Selenium Grid is a tool which is used together with Selenium RC. It is used to run tests on different machines against different browsers in parallel. Which implies — running multiple tests at the same time against different machines running different browsers and operating systems.</p><p>So this was all about the Selenium Suite of Tools. Let’s dive deeper into this article and learn the functionalities and various components of Selenium WebDriver Architecture.</p><h3>Selenium WebDriver Architecture</h3><p>In order to understand Selenium WebDriver Architecture, we should first know what is a WebDriver API. Selenium Webdriver API helps in communication between languages and browsers. Each and every browser has different logic of performing actions on the browser. Below image depicts various components of Selenium WebDriver Architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xOM0krbXCLVwq8itGkZcvA.png" /></figure><p>It comprises four main components which are:</p><ol><li>Selenium Client Library</li><li>JSON WIRE PROTOCOL Over HTTP Client</li><li>Browser Drivers</li><li>Browsers</li></ol><p>Let’s understand each of these components in depth.</p><h4><strong>1. Selenium Client Libraries/Language Bindings</strong></h4><p>Selenium supports multiple libraries such as Java, Ruby, Python, etc. Selenium Developers have developed language bindings to allow Selenium to support multiple languages. If you wish to know more about libraries, kindly refer to the <a href="http://www.seleniumhq.org/download/#client-drivers">official site for Selenium libraries</a>.</p><h4><strong>2. JSON WIRE PROTOCOL Over HTTP Client</strong></h4><p>JSON stands for JavaScript Object Notation. It is used to transfer data between a server and a client on the web. JSON Wire Protocol is a REST API that transfers the information between HTTP server. Each BrowserDriver (such as FirefoxDriver, ChromeDriver, etc.) has its own HTTP server.</p><h4><strong>3. Browser Drivers</strong></h4><p>Each browser contains a separate browser driver. Browser drivers communicate with the respective browser without revealing the internal logic of the browser’s functionality. When a browser driver has received any command then that command will be executed on the respective browser and the response will go back in the form of an HTTP response.</p><h4><strong>4. Browsers</strong></h4><p>Selenium supports multiple browsers such as Firefox, Chrome, IE, Safari, etc.</p><p>Now let’s move further and know how exactly Selenium functions internally with the help of the below example.</p><h3>Demo</h3><p>In real time, you write a code in your UI (say Eclipse IDE) using any one of the supported Selenium client libraries (say Java).</p><pre>WebDriver driver = new FirefoxDriver(); driver.get(&quot;https://www.edureka.co&quot;);</pre><p>Once you are ready with your script, you will click on Run to execute the program. Based on the above statements, the Firefox browser will be launched and it will navigate to <a href="https://www.edureka.co/">Edureka website.</a></p><p>Once you click on ‘Run’, every statement in your script will be converted as a URL, with the help of JSON Wire Protocol over HTTP. The URL’s will be passed to the Browser Drivers. (In the above code, I have used FirefoxDriver). Here, in this case, the client library (Java) will convert the statements of the script into JSON format and further communicate with the FirefoxDriver.</p><p>Every Browser Driver uses an HTTP server to receive HTTP requests. Once the URL reaches the Browser Driver, then it will pass that request to the real browser over HTTP. Once done, the commands in your Selenium script will be executed on the browser. In the case of Chrome browser, you can write your Selenium script as shown below:</p><pre>WebDriver driver = new ChromeDriver(); driver.get(&quot;https://www.edureka.co&quot;);</pre><p>If the request is <em>POST</em> request, then there will be an action on the browser. If the request is a <em>GET</em>request then the corresponding response will be generated at the browser end. It will be then sent over HTTP to the browser driver and the Browser Driver over JSON Wire Protocol and sends it to the UI (Eclipse IDE).</p><p>So, that was all about Selenium WebDriver Architecture. I hope you understood the concepts and it added value to your knowledge.</p><p>If you wish to check out more articles on the market’s most trending technologies like Artificial Intelligence, DevOps, Ethical Hacking, then you can refer to <a href="https://www.edureka.co/blog/?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=selenium-webdriver-architecture">Edureka’s official site.</a></p><p>Do look out for other articles in this series which will explain the various other aspects of Selenium.</p><blockquote>1. <a href="https://medium.com/edureka/selenium-tutorial-77879a1d9af1">Selenium Tutorial</a></blockquote><blockquote>2. <a href="https://medium.com/edureka/selenium-webdriver-tutorial-e3e6219f21ad">Selenium WebDriver: TestNG For Test Case Management &amp; Report Generation</a></blockquote><blockquote>3. <a href="https://medium.com/edureka/selenium-framework-data-keyword-hybrid-frameworks-ea8d4f4ce99f">Building A Data Driven, Keyword Driven &amp; Hybrid Selenium Framework</a></blockquote><blockquote>4.<a href="https://medium.com/edureka/locators-in-selenium-f6e6b282aed8"> Locators in Selenium</a></blockquote><blockquote>5. <a href="https://medium.com/edureka/xpath-in-selenium-cd659373e01a">XPath Tutorial</a></blockquote><blockquote>6. <a href="https://medium.com/edureka/waits-in-selenium-5b57b56f5e5a">Waits in Selenium</a></blockquote><blockquote>7. <a href="https://medium.com/edureka/selenium-grid-tutorial-ef342799c484">Setting up a Selenium Grid for distributed Selenium testing</a></blockquote><blockquote>8. <a href="https://medium.com/edureka/selenium-using-python-edc22a44f819">Selenium Using Python</a></blockquote><blockquote>9. <a href="https://medium.com/edureka/cross-browser-testing-9299b04ce277">Cross Browser Testing Using LambdaTest</a></blockquote><blockquote>10. <a href="https://medium.com/edureka/cross-browser-testing-using-selenium-90b1911c6d60">Cross Browser Testing Using Selenium</a></blockquote><blockquote>11. <a href="https://medium.com/edureka/handle-multiple-windows-in-selenium-727ba5f8f6a7">Handle Multiple Windows in Selenium</a></blockquote><blockquote>12. <a href="https://medium.com/edureka/page-object-model-in-selenium-bc4d7c8c4203">Page Object Model In Selenium</a></blockquote><blockquote>13. <a href="https://medium.com/edureka/selenium-projects-b2df15d35fe2">Selenium Projects</a></blockquote><blockquote>14. <a href="https://medium.com/edureka/qtp-vs-selenium-338f3d3bbfa7">QTP vs Selenium</a></blockquote><blockquote>15. <a href="https://medium.com/edureka/selenium-vs-rpa-84159dbcd0f2">Selenium vs RPA</a></blockquote><blockquote>16. <a href="https://medium.com/edureka/exceptions-in-selenium-369c38155e7d">Handling Exceptions In Selenium</a></blockquote><blockquote>17. <a href="https://medium.com/edureka/cucumber-selenium-tutorial-aefec05f4733">Perform Website Testing Using Cucumber &amp; Selenium</a></blockquote><p><em>Originally published at </em><a href="https://www.edureka.co/blog/selenium-webdriver-architecture/"><em>https://www.edureka.co</em></a><em> on May 8, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=565e2db26dd5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/edureka/selenium-webdriver-architecture-565e2db26dd5">A Comprehensive Guide To Selenium WebDriver Architecture</a> was originally published in <a href="https://medium.com/edureka">Edureka</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Know How to Perform Cross Browser Testing Using Selenium]]></title>
            <link>https://medium.com/edureka/cross-browser-testing-using-selenium-90b1911c6d60?source=rss-dd4f4acd2a2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/90b1911c6d60</guid>
            <category><![CDATA[cross-browser-testing]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[selenium-web-driver]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Neha Vaidya]]></dc:creator>
            <pubDate>Tue, 30 Apr 2019 10:40:12 GMT</pubDate>
            <atom:updated>2019-06-05T11:46:23.930Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*VD__S-U_NOtAwdrsuWJdsg.jpeg" /><figcaption>Cross Browser Testing using Selenium — Edureka</figcaption></figure><p>With the increasing demand for automation testing, Selenium is one such tool which perfectly fits for Cross Browser Testing of a website. It is very necessary to check the compatibility and performance of the websites on different browsers and operating systems. So, this article on Cross Browser testing using Selenium will help you understand these concepts in depth.</p><p>Below are the topics covered in this article:</p><ul><li>What is Cross Browser Testing?</li><li>Why do you need Cross Browser testing?</li><li>How to perform Cross Browser testing?</li><li>Demo using Selenium</li></ul><h3>What is Cross Browser Testing?</h3><p>Cross-browser testing is nothing but testing the application in multiple browsers like IE, Chrome, Firefox so that we can test our application effectively. Cross-browser compatibility is the ability of a website or web application to function across different browsers and operating systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*W4XqPl4sL2ncbnAF0_pKrA.jpeg" /></figure><p><strong>For Example</strong> — Say you have 20 test cases to execute manually. You can complete this task in a day or two. But, if the same test cases have to be executed in five browsers, then probably you will take a week to complete it. However, if you automate these 20 test cases and run them, then it will not take more than an hour or two depending on the test case complexity. So that’s where cross-browser testing comes into the picture.</p><p>Now, let’s move further and see why do you need Cross Browser Testing in Selenium.</p><h3><strong>Why do you need Cross Browser Testing?</strong></h3><p>Every website is comprised of three major technologies i.e. HTML5, CSS3, and JavaScript. However, there are n number of technologies in the backend like Python, Ruby, etc can be used. But, in the front end and in the rendering, only these three technologies are used.</p><p>Also, each browser uses a completely different rendering engine to compute these three technologies. For example, Chrome uses Blink, Firefox uses Gecko and IE uses edge HTML and Chakra, because of which the same website would be rendered completely differently by all these different browsers. And that’s exactly why you need cross-browser testing. That means the website should work perfectly fine, in all the different browser versions and in different operating systems. So to ensure that it works fine, cross-browser testing is required.</p><p>Along with that, I have listed a few reasons that depict the need for Cross Browser Testing.</p><ul><li>Browser compatibility with different OS.</li><li>Image orientation.</li><li>Each browser has a different orientation of Javascript which can cause issue sometimes.</li><li>Font size mismatch or not rendered properly.</li><li>Compatibility with the new web framework.</li></ul><p>Now let’s move further and understand how to perform Cross Browser Testing.</p><h3>How to Perform Cross Browser Testing?</h3><p>Cross-browser testing is basically running the same set of test cases multiple times on different browsers. This type of repeated task is best suited for automation. Thus, it’s more cost and time effective to perform this testing by using tools. Now let’s see how it is performed using selenium web driver.</p><p><strong>Step1</strong>: If we are using Selenium WebDriver, we can automate test cases using Internet Explorer, FireFox, Chrome, Safari browsers.</p><p><strong>Step 2:</strong> To execute test cases with different browsers in the same machine at the same time we can integrate the <a href="https://www.edureka.co/blog/selenium-webdriver-tutorial?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=cross-browser-testing-using-selenium">TestNG framework with Selenium WebDriver.</a></p><p><strong>Step3:</strong> Finally, you can write the test cases and execute the code.</p><p>Now, let’s see how to perform cross-browser testing of Edureka website on three different browsers</p><h3>Demo using Selenium WebDriver</h3><pre>package co.edureka.pages;<br> <br>import java.util.concurrent.TimeUnit;<br>import org.openqa.selenium.By;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.WebElement;<br>import org.openqa.selenium.chrome.ChromeDriver;<br>import org.openqa.selenium.edge.EdgeDriver;<br>import org.openqa.selenium.firefox.FirefoxDriver;<br>import org.testng.annotations.BeforeTest;<br>import org.testng.annotations.Parameters;<br>import org.testng.annotations.Test;<br> <br>public class CrossBrowserScript {<br> <br>WebDriver driver;<br> <br>/**<br>* This function will execute before each Test tag in testng.xml<br>* <a href="http://twitter.com/param">@param</a> browser<br>* <a href="http://twitter.com/throws">@throws</a> Exception<br>*/<br><a href="http://twitter.com/BeforeTest">@BeforeTest</a><br><a href="http://twitter.com/Parameters">@Parameters</a>(&quot;browser&quot;)<br>public void setup(String browser) throws Exception{<br>//Check if parameter passed from TestNG is &#39;firefox&#39;<br>if(browser.equalsIgnoreCase(&quot;firefox&quot;)){<br>//create firefox instance<br>System.setProperty(&quot;webdriver.gecko.driver&quot;, &quot;C:\\geckodriver-v0.23.0-win64\\geckodriver.exe&quot;);<br>driver = new FirefoxDriver();<br>}<br> <br>//Check if parameter passed as &#39;chrome&#39;<br>else if(browser.equalsIgnoreCase(&quot;chrome&quot;)){<br>//set path to chromedriver.exe<br>System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;C:\\Selenium-java-edureka\\New folder\\chromedriver.exe&quot;);<br>driver = new ChromeDriver();<br> <br>}<br>else if(browser.equalsIgnoreCase(&quot;Edge&quot;)){<br>//set path to Edge.exe<br>System.setProperty(&quot;webdriver.edge.driver&quot;,&quot;C:\\Selenium-java-edureka\\MicrosoftWebDriver.exe&quot;);;span style=&quot;font-family: verdana, geneva, sans-serif; font-size: 14px;&quot;&amp;amp;gt;//create Edge instance&amp;amp;lt;/span&amp;amp;gt;<br>driver = new EdgeDriver();<br>}<br>else{<br>//If no browser passed throw exception<br>throw new Exception(&quot;Browser is not correct&quot;);<br>}<br>driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);<br>}<br> <br><a href="http://twitter.com/Test">@Test</a><br>public void testParameterWithXML() throws InterruptedException{<br>driver.get(&quot;<a href="https://www.edureka.co/">https://www.edureka.co/</a>&quot;);<br>WebElement Login = driver.findElement(By.linkText(&quot;Log In&quot;));<br>//Hit login button<br>Login.click();<br>Thread.sleep(4000);<br>WebElement userName = driver.findElement(By.id(&quot;si_popup_email&quot;));<br>//Fill user name<br>userName.sendKeys(&quot;your email id&quot;);<br>Thread.sleep(4000);<br>//Find password&#39;WebElement password = driver.findElement(By.id(&quot;si_popup_passwd&quot;));<br>//Fill password<br>password.sendKeys(&quot;your password&quot;);<br>Thread.sleep(6000);<br> <br>WebElement Next = driver.findElement(By.xpath(&quot;//button[<a href="http://twitter.com/class">@class</a>=&#39;clik_btn_log btn-block&#39;]&quot;));<br>//Hit search button<br>Next.click();<br>Thread.sleep(4000);<br>WebElement search = driver.findElement(By.cssSelector(&quot;#search-inp&quot;));<br>//Fill search box<br>search.sendKeys(&quot;Selenium&quot;);<br>Thread.sleep(4000);<br>//Hit search button<br> <br>WebElement searchbtn = driver.findElement(By.xpath(&quot;//span[<a href="http://twitter.com/class">@class</a>=&#39;typeahead__button&#39;]&quot;));<br>searchbtn.click();<br>}<br>}</pre><p>In the above code, I am performing actions on <a href="https://www.edureka.co/">Edureka</a> website like logging in to the website and searching for Selenium course. but, I want to check the cross-browser compatibility on three different browsers i.e Google Chrome, Mozilla Firefox, and Microsoft Edge. That’s why I have set the system properties of all the 3 browsers in my code. After that using locators I am performing actions on the website. So this is all about my class file. Now in order to execute the program, you need a TestNG XML file which contains the dependencies of the above class file. Below code depicts the TestNG file.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE suite SYSTEM &quot;<a href="http://testng.org/testng-1.0.dtd">http://testng.org/testng-1.0.dtd</a>&quot;&gt;<br>&lt;suite name=&quot;TestSuite&quot; thread-count=&quot;2&quot; parallel=&quot;tests&quot; &gt;<br>&lt;test name=&quot;ChromeTest&quot;&gt;<br>&lt;parameter name=&quot;browser&quot; value=&quot;Chrome&quot;/&gt;<br>&lt;classes&gt;<br>&lt;class name=&quot;co.edureka.pages.CrossBrowserScript&quot;&gt;<br>&lt;/class&gt;<br>&lt;/classes&gt;<br>&lt;/test&gt;<br>&lt;test name=&quot;FirefoxTest&quot;&gt;<br>&lt;parameter name=&quot;browser&quot; value=&quot;Firefox&quot; /&gt;<br>&lt;classes&gt;<br>&lt;class name=&quot;co.edureka.pages.CrossBrowserScript&quot;&gt;<br>&lt;/class&gt;<br>&lt;/classes&gt;<br>&lt;/test&gt;<br>&lt;test name=&quot;EdgeTest&quot;&gt;<br>&lt;parameter name=&quot;browser&quot; value=&quot;Edge&quot; /&gt;<br>&lt;classes&gt;<br>&lt;class name=&quot;co.edureka.pages.CrossBrowserScript&quot;&gt;<br>&lt;/class&gt;<br>&lt;/classes&gt;<br>&lt;/test&gt;<br>&lt;/suite&gt;</pre><p>In the above XML file, I am specifying different classes for the drives so that it will help us in instantiating the browsers to execute the test cases on the website. That’s how it works.</p><p>With this, we come to an end of this article on Cross Browser Testing using Selenium Webdriver. I hope you understood the concepts and it added value to your knowledge.</p><p>If you wish to check out more articles on the market’s most trending technologies like Artificial Intelligence, DevOps, Ethical Hacking, then you can refer to <a href="https://www.edureka.co/blog/?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=cross-browser-testing-using-selenium">Edureka’s official site.</a></p><p>Do look out for other articles in this series which will explain the various other aspects of Selenium.</p><blockquote>1. <a href="https://medium.com/edureka/selenium-tutorial-77879a1d9af1">Selenium Tutorial</a></blockquote><blockquote>2. <a href="https://medium.com/edureka/selenium-webdriver-tutorial-e3e6219f21ad">Selenium WebDriver: TestNG For Test Case Management &amp; Report Generation</a></blockquote><blockquote>3. <a href="https://medium.com/edureka/selenium-framework-data-keyword-hybrid-frameworks-ea8d4f4ce99f">Building A Data Driven, Keyword Driven &amp; Hybrid Selenium Framework</a></blockquote><blockquote>4.<a href="https://medium.com/edureka/locators-in-selenium-f6e6b282aed8"> Locators in Selenium</a></blockquote><blockquote>5. <a href="https://medium.com/edureka/xpath-in-selenium-cd659373e01a">XPath Tutorial</a></blockquote><blockquote>6. <a href="https://medium.com/edureka/waits-in-selenium-5b57b56f5e5a">Waits in Selenium</a></blockquote><blockquote>7. <a href="https://medium.com/edureka/selenium-grid-tutorial-ef342799c484">Setting up a Selenium Grid for distributed Selenium testing</a></blockquote><blockquote>8. <a href="https://medium.com/edureka/selenium-using-python-edc22a44f819">Selenium Using Python</a></blockquote><blockquote>9.<em> </em><a href="https://medium.com/edureka/cross-browser-testing-9299b04ce277">Cross Browser Testing Using LambdaTest</a></blockquote><blockquote>10. <a href="https://medium.com/edureka/handle-multiple-windows-in-selenium-727ba5f8f6a7">Handle Multiple Windows in Selenium</a></blockquote><blockquote>11. <a href="https://medium.com/edureka/page-object-model-in-selenium-bc4d7c8c4203">Page Object Model In Selenium</a></blockquote><blockquote>12. <a href="https://medium.com/edureka/selenium-projects-b2df15d35fe2">Selenium Projects</a></blockquote><blockquote>13. <a href="https://medium.com/edureka/qtp-vs-selenium-338f3d3bbfa7">QTP vs Selenium</a></blockquote><blockquote>14. <a href="https://medium.com/edureka/selenium-vs-rpa-84159dbcd0f2">Selenium vs RPA</a></blockquote><blockquote>15. <a href="https://medium.com/edureka/selenium-webdriver-architecture-565e2db26dd5">Selenium WebDriver Architecture</a></blockquote><blockquote>16. <a href="https://medium.com/edureka/exceptions-in-selenium-369c38155e7d">Handling Exceptions In Selenium</a></blockquote><blockquote>17. <a href="https://medium.com/edureka/cucumber-selenium-tutorial-aefec05f4733">Perform Website Testing Using Cucumber &amp; Selenium</a></blockquote><p><em>Originally published at </em><a href="https://www.edureka.co/blog/cross-browser-testing-using-selenium/"><em>https://www.edureka.co</em></a><em> on April 30, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90b1911c6d60" width="1" height="1" alt=""><hr><p><a href="https://medium.com/edureka/cross-browser-testing-using-selenium-90b1911c6d60">Know How to Perform Cross Browser Testing Using Selenium</a> was originally published in <a href="https://medium.com/edureka">Edureka</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Know How To Handle Exceptions In Selenium]]></title>
            <link>https://medium.com/edureka/exceptions-in-selenium-369c38155e7d?source=rss-dd4f4acd2a2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/369c38155e7d</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[selenium-webdriver]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[exceptions-in-selenium]]></category>
            <dc:creator><![CDATA[Neha Vaidya]]></dc:creator>
            <pubDate>Thu, 25 Apr 2019 05:37:49 GMT</pubDate>
            <atom:updated>2019-06-05T12:02:18.297Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*G_CHGW4qrUGtL2pFy7Natw.png" /><figcaption>Exceptions In Selenium — Edureka</figcaption></figure><p>With the world evolving towards software development, testing plays a vital role in making the process defect free. <em>Automation testing using Selenium</em> is one such tool that helps in finding bugs and resolve them. Exceptions in Selenium is an important concept which helps us in handling errors and avoid software failures. Through this article on Exceptions in Selenium, I will give you a complete insight into the fundamentals and various methods of handling exceptions.</p><p>In this article, I will be covering the following topics.</p><ul><li>Introduction to Exception Handling</li><li>Checked vs Unchecked Exception</li><li>Basic Example of Exception</li><li>Types of Exceptions</li><li>Methods of Handling Exceptions</li></ul><h3>Introduction to Exceptions</h3><p>An exception is an event or a problem that arises during the execution of a program. When an exception occurs, the normal flow of program halts and an exception object is created. The program then tries to find someone that can handle the raised exception. The exception object contains a lot of debugging information, such as method hierarchy, the line number where the exception occurred, the type of exception, etc.</p><p>When you start working with<a href="https://www.edureka.co/blog/selenium-webdriver-tutorial?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=exceptions-in-selenium"> Selenium webdriver</a>, you will come across different exceptions based on the code you write. The same code some times work properly and sometimes it simply doesn’t. Whenever you develop any script, you try to give the best quality code that works fine. But Unfortunately, sometimes exceptions come as side effects to the scripts that we develop and tends to fail. That’s why handling an exception is very important.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*gKpUFm1Px4J-wc4heY5jOg.png" /></figure><p>Exception Handling mechanism follows a flow which is depicted in the above figure. But if an exception is not handled, it may lead to a system failure. That is why handling an exception is very important. Now let’s move further and understand what are the various categories of exceptions.</p><h3>Checked vs Unchecked Exception</h3><p>Basically, there are 2 types of exceptions in Selenium and they are as follows:</p><ul><li>Checked Exception</li><li>Unchecked Exception</li></ul><p>Let’s understand these two exceptions in depth.</p><ul><li><strong>Checked Exception</strong><br>It is an exception that occurs at compile time, also called compile time exceptions. If some code within a method throws a checked exception, then the method must either handle the exception or it must specify the exception using <em>throws </em>keyword.</li><li><strong>Unchecked Exception</strong><br>It is an exception that occurs at the time of execution and is called <em>Runtime Exceptions.</em> In C++, all exceptions are unchecked, but in Java, exceptions can be either checked or unchecked. So, it is not forced by the compiler to either handle or specify the exception. It is up to the programmers to specify or catch the exceptions.</li></ul><h4>Basic Example of Exception</h4><pre>class Exception{<br>public static void main(String args[]){<br>try{<br>//code that may raise an exception&lt;/span&gt;<br>}<br>catch(Exception e){<br>// rest of the program<br>}<br>}<br>}</pre><p>Above code represent an exception wherein inside try block we are going to write a code that may raise an exception and then, that exception will be handled in the catch block. Having understood this, let’s move further and see different types of exceptions that cause disruption to the normal flow of execution of the program.</p><h3>Types of Exceptions</h3><h4><strong>WebDriverException</strong></h4><p>WebDriver Exception comes when we try to perform any action on the non-existing driver.</p><pre>WebDriver driver = new InternetExplorerDriver();<br>driver.get(&quot;<a href="http://google.com/">http://google.com</a>&quot;);<br>driver.close();<br>driver.quit();</pre><h4><strong>NoAlertPresentException</strong></h4><p>When we try to perform an action i.e., either accept() or dismiss() which is not required at a required place; gives us this exception.</p><pre>try{<br>driver.switchTo().alert().accept();<br>}<br>catch (NoAlertPresentException E){<br>E.printStackTrace();<br>}</pre><h4><strong>NoSuchWindowException</strong></h4><p>When we try to switch to a window which is not present gives us this exception:</p><pre>WebDriver driver = new InternetExplorerDriver();<br>driver.get(&quot;<a href="http://google.com/">http://google.com</a>&quot;);<br>driver.switchTo().window(&quot;Yup_Fail&quot;);<br>driver.close();</pre><p>In the above snippet, line 3 throws us an exception, as we are trying to switch to a window that is not present.</p><h4><strong>NoSuchFrameException</strong></h4><p>Similar to Window exception, Frame exception mainly comes during switching between the frames.</p><pre>WebDriver driver = new InternetExplorerDriver();<br>driver.get(&quot;<a href="http://google.com/">http://google.com</a>&quot;);<br>driver.switchTo().frame(&quot;F_fail&quot;);<br>driver.close();</pre><p>In the above snippet, line 3 throws us an exception, as we are trying to switch to a frame that is not present.</p><h4><strong>NoSuchElementException</strong></h4><p>This exception is thrown when we WebDriver doesn’t find the web-element in the DOM.</p><pre>WebDriver driver = new InternetExplorerDriver();<br>driver.get(&quot;<a href="http://google.com/">http://google.com</a>&quot;);<br>driver.findElement(By.name(&quot;fake&quot;)).click();</pre><p>Now see move ahead in this exceptions in <a href="https://www.edureka.co/blog/10-reasons-to-learn-selenium?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=exceptions-in-selenium">Selenium</a> article and see various methods used to handle Exceptions.</p><h3>Methods of Handling Exceptions</h3><ol><li><strong>Try:</strong> try block is used to enclose the code that might throw an exception.</li><li><strong>Catch:</strong> catch block is used to handle the Exception. It must be used after the try block only</li><li><strong>Finally:</strong> finally block is a block that is used <em>to execute important code</em> such as closing connection, stream etc. It is always executed whether an exception is handled or not.</li><li><strong>Throw:</strong> throw” keyword is used to throw an exception.</li><li><strong>Throws:</strong> The “throws” keyword is used to declare exceptions. It doesn’t throw an exception. It specifies that there may occur an exception in the method. It is always used with method signature.</li></ol><p>Let’s see a small example to understand how a thrown exception can be handled using exception methods. Let’s have a look at the code.</p><pre>package Edureka;<br>import java.util.concurrent.TimeUnit;<br>import java.util.concurrent.TimeoutException;<br>import org.openqa.selenium.By;<br>import org.openqa.selenium.NoAlertPresentException;<br>import org.openqa.selenium.NoSuchElementException;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.chrome.ChromeDriver;<br>import org.openqa.selenium.firefox.FirefoxDriver;<br>import org.openqa.selenium.support.ui.ExpectedConditions;<br>import org.openqa.selenium.support.ui.Wait;<br>import org.openqa.selenium.support.ui.WebDriverWait;<br>public class Exceptionhandling {<br>public static void main(String[] args) throws InterruptedException, TimeoutException{<br>System.setProperty(&quot;webdriver.firefox.driver&quot;, &quot;C:\\Selenium-java-edureka\\chromedriver_win32\\chromedriver.exe&quot;);<br>WebDriver driver = new FirefoxDriver();<br>WebDriverWait wait = new WebDriverWait(driver, 10);<br>driver.get(&quot;<a href="https://www.google.com/">https://www.google.com</a>&quot;);<br>try{<br>driver.findElement(By.xpath(&quot;//*[<a href="http://twitter.com/id">@id</a>=&#39;register&#39;]&quot;)).click();<br>}catch (Exception e) {<br>System.out.println(&quot;Register element is not found.&quot;);<br>throw(e);<br>}<br>System.out.println(&quot;Hello&quot;);<br>}<br>}</pre><p>Let’s understand the functionalities of each method in depth.</p><h4>Try Method</h4><p>In the above code, I have used a try block to enter the statement that throws the exception. Here, this statement driver.findElement(By.xpath(“//*[@id=’register’]”)).click(); throws exception because in the Google Search page Selenium cannot locate the particular element. So, once the exception is thrown, the normal execution of the program will be interrupted. Now, let’s see how it is handled in the catch block.</p><h4>Catch Method</h4><p>The task here is to handle this exception and continue the execution of the program. For that, I have written a catch block which will handle the thrown exception. It should always be written after the try block. So when you execute the program, it will print the rest of the statements.</p><h4>Throw Method</h4><p>As you all know<em> throw</em> is a keyword which is used to pass an exception. But, the interesting thing is that irrespective of the fact that catch block has handled the exception or not,will still raise an exception. This results in disrupting the normal flow of execution of the program. In the above code, after the catch block has handled the exception, I have written a statement to throw an exception.</p><h4>Throws Method</h4><p>Throws declaration is used to declare an exception. For example, It can declare Interrupted exception, timeout exception, etc. This is how various methods can be used to handle the raised exception in the program.</p><p>With this, we come to an end of this article on Exceptions in Selenium. I hope you understood the concepts and helped in adding value to your knowledge.</p><p>If you wish to check out more articles on the market’s most trending technologies like Artificial Intelligence, DevOps, Ethical Hacking, then you can refer to<a href="https://www.edureka.co/blog/?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=exceptions-in-selenium"> Edureka’s official site.</a></p><p>Do look out for other articles in this series which will explain the various other aspects of Selenium.</p><blockquote>1. <a href="https://medium.com/edureka/selenium-tutorial-77879a1d9af1">Selenium Tutorial</a></blockquote><blockquote>2. <a href="https://medium.com/edureka/selenium-webdriver-tutorial-e3e6219f21ad">Selenium WebDriver: TestNG For Test Case Management &amp; Report Generation</a></blockquote><blockquote>3. <a href="https://medium.com/edureka/selenium-framework-data-keyword-hybrid-frameworks-ea8d4f4ce99f">Building A Data Driven, Keyword Driven &amp; Hybrid Selenium Framework</a></blockquote><blockquote>4.<a href="https://medium.com/edureka/locators-in-selenium-f6e6b282aed8"> Locators in Selenium</a></blockquote><blockquote>5. <a href="https://medium.com/edureka/xpath-in-selenium-cd659373e01a">XPath Tutorial</a></blockquote><blockquote>6. <a href="https://medium.com/edureka/waits-in-selenium-5b57b56f5e5a">Waits in Selenium</a></blockquote><blockquote>7. <a href="https://medium.com/edureka/selenium-grid-tutorial-ef342799c484">Setting up a Selenium Grid for distributed Selenium testing</a></blockquote><blockquote>8. <a href="https://medium.com/edureka/selenium-using-python-edc22a44f819">Selenium Using Python</a></blockquote><blockquote>9. <a href="https://medium.com/edureka/cross-browser-testing-9299b04ce277">Cross Browser Testing Using LambdaTest</a></blockquote><blockquote>10. <a href="https://medium.com/edureka/cross-browser-testing-using-selenium-90b1911c6d60">Cross Browser Testing Using Selenium</a></blockquote><blockquote>11. <a href="https://medium.com/edureka/handle-multiple-windows-in-selenium-727ba5f8f6a7">Handle Multiple Windows in Selenium</a></blockquote><blockquote>12. <a href="https://medium.com/edureka/page-object-model-in-selenium-bc4d7c8c4203">Page Object Model In Selenium</a></blockquote><blockquote>13. <a href="https://medium.com/edureka/selenium-projects-b2df15d35fe2">Selenium Projects</a></blockquote><blockquote>14. <a href="https://medium.com/edureka/qtp-vs-selenium-338f3d3bbfa7">QTP vs Selenium</a></blockquote><blockquote>15. <a href="https://medium.com/edureka/selenium-vs-rpa-84159dbcd0f2">Selenium vs RPA</a></blockquote><blockquote>16. <a href="https://medium.com/edureka/selenium-webdriver-architecture-565e2db26dd5">Selenium WebDriver Architecture</a></blockquote><blockquote>17. <a href="https://medium.com/edureka/cucumber-selenium-tutorial-aefec05f4733">Perform Website Testing Using Cucumber &amp; Selenium</a></blockquote><p><em>Originally published at </em><a href="https://www.edureka.co/blog/exceptions-in-selenium/"><em>https://www.edureka.co</em></a><em> on April 25, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=369c38155e7d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/edureka/exceptions-in-selenium-369c38155e7d">Know How To Handle Exceptions In Selenium</a> was originally published in <a href="https://medium.com/edureka">Edureka</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Comprehensive Guide To Page Object Model In Selenium With Page Factory]]></title>
            <link>https://medium.com/edureka/page-object-model-in-selenium-bc4d7c8c4203?source=rss-dd4f4acd2a2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc4d7c8c4203</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[page-object-model]]></category>
            <category><![CDATA[selenium-webdriver]]></category>
            <category><![CDATA[selenium]]></category>
            <dc:creator><![CDATA[Neha Vaidya]]></dc:creator>
            <pubDate>Thu, 18 Apr 2019 08:02:32 GMT</pubDate>
            <atom:updated>2019-06-05T11:43:40.284Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*_vgOXTmXtuZqQH5mu00Vtw.jpeg" /><figcaption>Page Object Model in Selenium — Edureka</figcaption></figure><p>Maintaining 1000 lines of code in a single class file is a cumbersome task and also it increases its complexity. In order to maintain the project structure and efficient performance of the selenium scripts, it is necessary to use different pages for different tasks. To ease the access of distributing the code into different modules, the Page object model comes to the rescue. In this article on Page Object Model in<a href="https://www.edureka.co/blog/selenium-tutorial?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=page-object-model-in-selenium"> Selenium</a>, you will be learning some of the core concepts of Page object Model and Page factory with the help of an example.</p><p>Below are the topics covered in this article:</p><ul><li>What is the Page Object Model?</li><li>Why Page Object Model?</li><li>Advantages of the Page Object Model</li><li>What is Page Factory?</li><li>Creating a Page Object Model with Page Factory in Selenium WebDriver</li></ul><h3>What is the Page Object Model?</h3><p>Page Object Model is a design pattern in test automation to create an<strong> Object Repository</strong> for web UI elements. Every web page in the application should have a corresponding page class. This Page class will find the WebElements and also may contain page methods which perform operations on those WebElements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*lLo2eCFDe40nprqIq4_EHA.png" /></figure><p>The tests then use the methods of this page object class whenever they need to interact with the UI of that page. The benefit here is that, if the page UI changes, then the tests need not to be changed, only the code within the page object needs to be changed. After that, all the changes that support new UI are located in one place. That’s why locators and test scripts are stored separately.</p><p>Now let’s see why do you need the Page Object Model.</p><h3>Why Page Object Model?</h3><p>The below-mentioned steps depict the need of Page Object Model in Selenium.</p><ol><li><strong>Duplication of Code: </strong>Increasing<strong> </strong>automation test coverage results in un-maintainable project structure if locators are not managed properly. This usually happens because of duplication of code or mainly due to duplicated usage of locators.</li><li><strong>Less Time Consumption:</strong> The chief problem with script maintenance is that, if ten different scripts are using the same page element, with any change in that element, you need to change all ten scripts. This is time-consuming and error-prone. One of the best approaches to script maintenance is to create a separate class file which would find web elements, fill them or verify them.</li><li><strong>Code Maintenance:</strong> In the future, if there is a change in the web element, you need to make the change in just one class file and not 10 different scripts. That is achieved with POM and it makes code reusable, readable and maintainable. <em>For Example,</em> In the home page of the web application, I have a menu bar which leads to different modules with different features. While performing automation testing, many test cases would be clicking through these menu buttons to execute specific tests.</li><li><strong>Reformation of Automation Test Scripts: </strong>Now assume that the User Interface is revamped and all the menu buttons are relocated to a different position in the home page. So, this will result in automation tests to fail. Automated test cases will fail as scripts will not be able to find particular element-locators to perform an action. Now, QA Engineer needs to walk through the whole code to update locators where necessary. Reforming the element-locators in the duplicated code will consume a lot of time to only adjust locators, while this time can be consumed to increase test coverage. Here, you can save this time by using the <strong>Page Object Model</strong> in our test automation framework.</li></ol><p>I hope you understood why do you need a page object model. Now, let’s move further and see some of the advantages of the Page Object Model in Selenium.</p><h3><strong>Advantages of the Page Object Model:</strong></h3><ol><li>According to the <strong>Page Object Model</strong>, you should keep the tests and element locators separately. This will keep the code clean and easy to understand and maintain.</li><li>The Page Object approach makes automation framework in a testing programmer friendly, more durable and comprehensive.</li><li>Another important advantage is our <strong><em>Page Object Repository is Independent of Automation Tests</em></strong>. If you keep a separate repository for page objects, it helps us to use this repository for different purposes with different frameworks like you will be able to integrate this repository with other tools like <strong>JUnit</strong>/<strong>NUnit</strong>/<strong>PhpUnit </strong>as well as with <a href="https://www.edureka.co/blog/selenium-webdriver-tutorial?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=page-object-model-in-selenium"><strong>TestNG</strong></a>/<strong>Cucumber</strong>/etc.</li><li>Test cases become short and optimized as you will be able to reuse page object methods in the <strong>POM</strong></li><li><strong>POM </strong>is best applicable for the applications which contain multiple pages. Each of which has fields which can be uniquely referenced with respect to the page.</li></ol><p>So these are a few of the advantages that make POM as unique and easy to work with for automation testers. Now, let’s dive further and understand what is Page Factory.</p><h3>What is Page Factory?</h3><p>Page Factory is an inbuilt Page Object Model concept for Selenium WebDriver but it is very optimized. Here, you follow the concept of separation of Page Object Repository and Test Methods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*_KXgIFEslShPvHyk-O_CFQ.png" /></figure><p>Additionally, with the help of the PageFactory class, I will use annotations <strong>@FindBy</strong> to find WebElement.</p><p>I hope you understood what is Page Factory. Now let’s dive deeper into this article and understand the working of the Page Object Model with the help of the below example.</p><h3>Creating a Page Object Model with Page Factory in Selenium WebDriver</h3><p><strong>Scenario:</strong> Here, you need to enter the valid credentials in the ‘ <em>Facebook Login’</em> Page in order to redirect to the ‘ <em>Facebook Home</em> ‘ Page and then log out from the account.</p><p>Follow the below steps to implement the Page Object Model Design Pattern.</p><p><strong>Step 1:</strong> Create <em>TestBase</em> class. Here I have created an object of WebDriver, maximize browser, implementing waits, launching URL and etc.</p><p>In the below example program, I have taken the Chrome browser and set the System Property to launch the Chrome browser.</p><pre>package edureka.tests;<br>import java.io.IOException;<br>import java.util.concurrent.TimeUnit;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.chrome.ChromeDriver;<br>import org.testng.annotations.AfterSuite;<br>import org.testng.annotations.BeforeSuite;<br>public class TestBase {<br>public static WebDriver driver = null;<br><a href="http://twitter.com/BeforeSuite">@BeforeSuite</a><br>public void initialize() throws IOException{<br>System.setProperty(&quot;webdriver.chrome.driver&quot;, System.getProperty(&quot;user.dir&quot;)+&quot;\\src\\test\\java\\drivers\\chromedriver.exe&quot;);<br>driver = new ChromeDriver();<br>//To maximize browser<br>driver.manage().window().maximize();<br>//Implicit wait<br>driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);<br>//To open facebook<br>driver.get(&quot;<a href="https://www.facebook.com/">https://www.facebook.com</a>&quot;);<br>}<br><a href="http://twitter.com/AfterSuite">@AfterSuite</a><br>//Test cleanup<br>public void TeardownTest()<br>{<br>TestBase.driver.quit();<br>}<br>}</pre><p><strong>Step 2: </strong>Creating classes for each page (Eg., <em>Facebook Login</em> Page, <em>Facebook Inbox</em> Page) to hold <a href="https://www.edureka.co/blog/locators-in-selenium?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=page-object-model-in-selenium">element locators</a> and their methods. Usually, you can create page objects for all available pages in the AUT. For each page,you have to create a separate class with a constructor. Identify all the locators and keep them in one class. It allows us to reuse the locators in multiple methods and also helps us in easy maintenance, if there is any change in the UI, you can simply change on one Page.</p><p>Here, I have created java files ( <em>FacebookLoginPage.java</em> and <em>FacebookInboxPage.java</em>) for the corresponding pages ( <em>Facebook Login</em> Page, and <em>Facebook Inbox</em> Page) to hold element locators and their methods.</p><p><strong><em>Java file for Facebook Login Page</em></strong></p><pre>package edureka.pages;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.WebElement;<br>import org.openqa.selenium.support.FindBy;<br>import org.openqa.selenium.support.How;<br> <br>public class FbHomePage {<br>WebDriver driver;<br>public FbHomePage(WebDriver driver){<br>this.driver=driver;<br>}<br>//Using FindBy for locating elements<br><a href="http://twitter.com/FindBy">@FindBy</a>(how=How.XPATH, using=&quot;//div&quot;) WebElement profileDropdown;<br><a href="http://twitter.com/FindBy">@FindBy</a>(how=How.XPATH, using=&quot;//text()[.=&#39;Log Out&#39;]/ancestor::span[1]&quot;) WebElement logoutLink;<br>// Defining all the user actions (Methods) that can be performed in the Facebook home page<br>// This method to click on Profile Dropdown<br>public void clickOnProfileDropdown(){<br>profileDropdown.click();<br>}<br>// This method to click on Logout link<br>public void clickOnLogoutLink(){<br>logoutLink.click();<br>}<br>}</pre><p><strong><em>Java file for Facebook Inbox</em> <em>Page</em></strong></p><pre>package edureka.pages;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.WebElement;<br>import org.openqa.selenium.support.FindBy;<br>import org.openqa.selenium.support.How;<br>public class FbLoginPage {<br>WebDriver driver;<br>public FbLoginPage(WebDriver driver){<br>this.driver=driver;<br>}<br>//Using FindBy for locating elements<br><a href="http://twitter.com/FindBy">@FindBy</a>(how=How.XPATH, using=&quot;//input[<a href="http://twitter.com/type">@type</a>=&#39;email&#39;][<a href="http://twitter.com/name">@name</a>=&#39;email&#39;]&quot;) WebElement emailTextBox;<br><a href="http://twitter.com/FindBy">@FindBy</a>(how=How.XPATH, using=&quot;//input[<a href="http://twitter.com/type">@type</a>=&#39;password&#39;][<a href="http://twitter.com/name">@name</a>=&#39;pass&#39;]&quot;) WebElement passwordTextBox;<br><a href="http://twitter.com/FindBy">@FindBy</a>(how=How.XPATH, using=&quot;//input[<a href="http://twitter.com/type">@type</a>=&#39;submit&#39;][<a href="http://twitter.com/id">@id</a>=&#39;u_0_5&#39;]&quot;) WebElement signinButton;<br>// Defining all the user actions (Methods) that can be performed in the Facebook home page&lt;/span&gt;<br> <br>// This method is to set Email in the email text box<br>public void setEmail(String strEmail){<br>emailTextBox.sendKeys(strEmail);<br>}<br>// This method is to set Password in the password text box<br>public void setPassword(String strPassword){<br>passwordTextBox.sendKeys(strPassword);<br> <br>// This method is to click on Login Button<br>public void clickOnLoginButton(){<br>signinButton.click();<br>}<br>}</pre><p><strong>Step 3:</strong> Here, you need to create a Test (Eg., <em>FBLoginTest</em>) based on the above pages. As per my test scenario which was mentioned above, test scripts run as follows.</p><ol><li>Launch browser and open facebook.com</li><li>Enter user credentials and do sign-in</li><li>Verify the logged in user name and do logout</li></ol><pre>package edureka.tests;<br>import org.openqa.selenium.support.PageFactory;<br>import org.testng.annotations.Test;<br>import pages.FbHomePage;<br>import pages.FbLoginPage;<br>public class FbLoginTest extends TestBase{<br><a href="http://twitter.com/Test">@Test</a><br>public void init() throws Exception{<br>//driver.get(&quot;<a href="https://www.facebook.com/">https://www.facebook.com</a>&quot;);<br>FbLoginPage loginpage = PageFactory.initElements(driver, FbLoginPage.class);<br>loginpage.setEmail(&quot;your-username&quot;);<br>loginpage.setPassword(&quot;your-password&quot;);<br>loginpage.clickOnLoginButton();<br>FbHomePage homepage = PageFactory.initElements(driver, FbHomePage.class);<br>homepage.clickOnProfileDropdown();<br>homepage.verifyLoggedInUserNameText();<br>homepage.clickOnLogoutLink();<br>}<br>}</pre><p>Finally, you need to create the testng.xml file and link to the above-created test case class files.</p><p><strong>Step 4: </strong>Creating a testng.xml file</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE suite SYSTEM &quot;<a href="http://testng.org/testng-1.0.dtd">http://testng.org/testng-1.0.dtd</a>&quot;&gt;<br>&lt;suite name=&quot;Everjobs Suite&quot;&gt;<br>&lt;test name=&quot;Page Object Model Project&quot;&gt;<br>&lt;classes&gt;<br>&lt;class name=&quot;edureka.tests.TestBase&quot; /&gt;<br>&lt;class name=&quot;edureka.tests.FbLoginTest&quot; /&gt;<br>&lt;/classes&gt;<br>&lt;/test&gt;<br>&lt;/suite&gt; &lt;!-- Suite --&gt;</pre><p>On executing this testnG.xml file on the test suite, it will redirect to facebook.com webpage and enter all the credentials. It will then verify the username and then log out of the account. This is how the Page Object Model can be implemented with Page Factory.</p><p>With this, we come to an end of this article on Page Object Model in Selenium. I hope you understood the concepts and it added value to your knowledge.</p><p>If you wish to check out more articles on the market’s most trending technologies like Artificial Intelligence, DevOps, Ethical Hacking, then you can refer to<a href="https://www.edureka.co/blog?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=page-object-model-in-selenium"> Edureka’s official site.</a></p><p>Do look out for other articles in this series which will explain the various other aspects of Selenium.</p><blockquote>1. <a href="https://medium.com/edureka/selenium-tutorial-77879a1d9af1">Selenium Tutorial</a></blockquote><blockquote>2. <a href="https://medium.com/edureka/selenium-webdriver-tutorial-e3e6219f21ad">Selenium WebDriver: TestNG For Test Case Management &amp; Report Generation</a></blockquote><blockquote>3. <a href="https://medium.com/edureka/selenium-framework-data-keyword-hybrid-frameworks-ea8d4f4ce99f">Building A Data Driven, Keyword Driven &amp; Hybrid Selenium Framework</a></blockquote><blockquote>4.<a href="https://medium.com/edureka/locators-in-selenium-f6e6b282aed8"> Locators in Selenium</a></blockquote><blockquote>5. <a href="https://medium.com/edureka/xpath-in-selenium-cd659373e01a">XPath Tutorial</a></blockquote><blockquote>6. <a href="https://medium.com/edureka/waits-in-selenium-5b57b56f5e5a">Waits in Selenium</a></blockquote><blockquote>7. <a href="https://medium.com/edureka/selenium-grid-tutorial-ef342799c484">Setting up a Selenium Grid for distributed Selenium testing</a></blockquote><blockquote>8. <a href="https://medium.com/edureka/selenium-using-python-edc22a44f819">Selenium Using Python</a></blockquote><blockquote>9. <a href="https://medium.com/edureka/cross-browser-testing-9299b04ce277">Cross Browser Testing Using LambdaTest</a></blockquote><blockquote>10. <a href="https://medium.com/edureka/cross-browser-testing-using-selenium-90b1911c6d60">Cross Browser Testing Using Selenium</a></blockquote><blockquote>11. <a href="https://medium.com/edureka/handle-multiple-windows-in-selenium-727ba5f8f6a7">Handle Multiple Windows in Selenium</a></blockquote><blockquote>12. <a href="https://medium.com/edureka/selenium-projects-b2df15d35fe2">Selenium Projects</a></blockquote><blockquote>13. <a href="https://medium.com/edureka/qtp-vs-selenium-338f3d3bbfa7">QTP vs Selenium</a></blockquote><blockquote>14. <a href="https://medium.com/edureka/selenium-vs-rpa-84159dbcd0f2">Selenium vs RPA</a></blockquote><blockquote>15. <a href="https://medium.com/edureka/selenium-webdriver-architecture-565e2db26dd5">Selenium WebDriver Architecture</a></blockquote><blockquote>16. <a href="https://medium.com/edureka/exceptions-in-selenium-369c38155e7d">Handling Exceptions In Selenium</a></blockquote><blockquote>17. <a href="https://medium.com/edureka/cucumber-selenium-tutorial-aefec05f4733">Perform Website Testing Using Cucumber &amp; Selenium</a></blockquote><p><em>Originally published at </em><a href="https://www.edureka.co/blog/page-object-model-in-selenium/"><em>https://www.edureka.co</em></a><em> on April 18, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc4d7c8c4203" width="1" height="1" alt=""><hr><p><a href="https://medium.com/edureka/page-object-model-in-selenium-bc4d7c8c4203">A Comprehensive Guide To Page Object Model In Selenium With Page Factory</a> was originally published in <a href="https://medium.com/edureka">Edureka</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Handle Multiple Windows in Selenium WebDriver?]]></title>
            <link>https://medium.com/edureka/handle-multiple-windows-in-selenium-727ba5f8f6a7?source=rss-dd4f4acd2a2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/727ba5f8f6a7</guid>
            <category><![CDATA[selenium-webdriver]]></category>
            <category><![CDATA[selenium-testing]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[automation-testing]]></category>
            <dc:creator><![CDATA[Neha Vaidya]]></dc:creator>
            <pubDate>Tue, 16 Apr 2019 04:18:15 GMT</pubDate>
            <atom:updated>2019-06-05T11:38:56.928Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Handle Multiple Windows in Selenium?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*aXa7Xz4ZP1xvVX3s-6Mynw.jpeg" /><figcaption>Handling Multiple Windows in Selenium — Edureka</figcaption></figure><p>In this rapidly developing world of technology, one must always find ways to keep up with the time. As the world is evolving towards software development, testing plays a vital role in making the process defect free. <a href="https://www.edureka.co/blog/what-is-selenium?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=handle-multiple-windows-in-selenium">Selenium</a> is one such tool that helps in finding bugs and resolving them. This article on How to handle multiple windows in Selenium gives you an idea about how you can handle multiple windows while testing an application.</p><p>So, we’ll first begin by taking a look at the topics that we’ll be covering in this article:</p><ul><li>What is Selenium Webdriver?</li><li>How to run a test case in Selenium?</li></ul><ol><li>Pre-requisites</li></ol><ul><li>How to handle multiple windows?</li></ul><ol><li>Syntax</li></ol><ul><li>Demo</li></ul><p>So, before we get to know more about handling multiple windows in Selenium simultaneously, we’ll see what Selenium Webdriver is and learn how it functions.</p><h3>What is Selenium Webdriver?</h3><p>I bet most of the software testers out there must have worked with this amazing tool which makes their lives easier, and for those who don’t know what is Selenium, I’ll help you take your first baby steps in exploring this tool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*YaNXYO-ShWtG26jm9yhR6A.png" /></figure><p><strong><em>Selenium</em> </strong>is an automation tool whose sole purpose is to test web applications developed by any organization. Now, what’s so fascinating about this tool which makes it popular?</p><ul><li>Selenium is an open source portable framework which helps in automating the testing of web applications.</li><li>Test scripts in Selenium can be written in any programming language of your choice like Java, Python, C# and many more.</li><li>Selenium has its own set of commands called Selenese, which holds the series of commands.</li><li>It can run across various web browsers like Chrome, Safari, Firefox, IE and many more.</li><li>Selenium Webdriver<strong><em> </em></strong>interacts directly with the browser rather than interacting with the server.</li><li>It is fast and efficient.</li><li>Selenium is highly flexible when it comes to <em>functional testing</em> and regression testing.</li><li>Another interesting factor, Selenium makes use of <em>element locators</em><strong><em> </em></strong>which help in finding the element on a web page. They are: class, name, XPath, ID, LinkText, DOM, Partial LinkText and <em>CSS Selectors</em>.</li><li>It also uses plugins like Maven, JUnit to test the applications more fast and effectively.</li></ul><p>Now let’s see how we can test an application using Selenium.</p><h3>How to Run a Test Case in Selenium?</h3><p>To test any application in Selenium, we follow certain procedures which eventually helps in performing the desired tasks.</p><p>The basic pre-requisites to run a test-case are:</p><h4>Pre-requisites to Run Selenium Test-Case</h4><ul><li>The first thing we require is to choose the right programming language to write the test scripts. As Java is one of the most simple and easy to understand language, we are going to add the JRE libraries to the project.</li><li>We require an IDE where we can run the test scripts. There is NetBeans, Eclipse and many other IDEs but we prefer working on Eclipse IDE because it is highly effective while executing the Java projects.</li><li>Some Selenium plugins like the Selenium standalone server, Selenium jar files, and Selenium IDE.</li><li>Browser drivers for different browsers like Chrome, IE, Firefox, etc.</li></ul><p>So, in order to test an application, we need to know the basics of the programming language, which is Java in our case. So first,</p><ul><li>Initialize the web driver and create an object of the same.</li><li>Instantiate the browser driver to the new ChromeDriver (in this case, we are working on ChromeDriver, you can choose Firefox or IE) and specify the path in which the ChromeDriver exists followed by the extension of an executable file.</li><li>Get the URL of the particular web page which you want to test</li><li>Find the element using one of the element locators in Selenium</li></ul><p>So, once we know how to run a test case in Selenium, we’ll try altering the process by working across multiple windows simultaneously. To do that we’ll see a few functions which help us doing it.</p><h3>How to Handle Multiple Windows?</h3><p>Now, what is a window handle function? How to handle multiple windows in Selenium while testing an application? Well, this will answer all your questions.</p><h4>What is a window handle?</h4><p><em>A window handle is a unique identifier that holds the address of all the windows</em>. This is basically a pointer to a window, which returns the string value. This window handle function helps in getting the handles of all the windows. It is guaranteed that each browser will have a unique window handle.</p><p><strong><em>Syntax</em></strong></p><ul><li>get.windowhandle(): helps in getting the window handle of the current window</li><li>get.windowhandles(): helps in getting the handles of all the windows opened</li><li>set: helps to set the window handles which is in the form of a string. set&lt;string&gt; set= driver.get.windowhandles()</li><li>switch to: helps in switching between the windows</li><li>action: helps to perform certain actions on the windows.</li></ul><p>These are a few new functions we’ll be seeing in this demo. Apart from these, the rest of the functions help in automating the process.</p><h3>Demo</h3><p>In this demo section, we’ll automate a few websites and check how to handle multiple windows.</p><p>We’ll automate pages such as,</p><ul><li>ToolsQA website for testing the window handle function</li><li>We’ll also automate our official website edureka.co and perform some actions</li><li>Naukri.com which is one of the most popular online job portals</li></ul><p>Now, we’ll first start by testing the webpage ToolsQA</p><ul><li>We will first specify the browser driver on which we are going to work and specify the path in which it is located using this command: System.setProperty(“webdriver.chrome.driver”, “D:\\\\chromedriver.exe”);</li><li>Instantiate the web driver to the new chrome driver.</li><li>Get the URL of the web page that we want to test.</li><li>Inspect the element and find it on the webpage using the element locators, in this case, it is the ID.</li><li>After this, we need to open multiple child windows. So, I’m going to do this using the for loop.</li></ul><pre>package selenium;<br> <br>import org.openqa.selenium.By;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.WebElement;<br>import org.openqa.selenium.chrome.ChromeDriver;<br> <br>public class demo1 {<br>public static void main(String[] args) throws InterruptedException<br>{<br>System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;D:\\\\chromedriver.exe&quot;);<br>WebDriver driver = new ChromeDriver();<br>driver.get(&quot;<a href="http://toolsqa.com/automation-practice-switch-windows/">http://toolsqa.com/automation-practice-switch-windows/</a>&quot;);<br>WebElement clickElement = driver.findElement(By.id(&quot;button1&quot;));<br> <br>for(int i = 0; i &lt; 3; i++)<br>{<br>clickElement.click();<br>Thread.sleep(3000);<br>}<br> <br>}<br>}</pre><p>Next step, we’ll add on a few more commands and notice the change in the execution.</p><ul><li>This is almost similar to the first project except that we need to print the window handle of the parent and the child windows.</li><li>Get the handle of the parent window using the command: String parentWindowHandle = driver.getWindowHandle();</li><li>Print the window handle of the parent window.</li><li>Find the element on the web page using an ID which is an element locator.</li><li>Open multiple child windows.</li><li>Iterate through child windows.</li><li>Pause the execution for a few seconds using the sleep command Thread.sleep(3000) where the time is specified in nanoseconds.</li><li>Get the handles of all the windows that are currently open using the command: Set&lt;String&gt; allWindowHandles = driver.getWindowHandles(); which returns the set of handles.</li><li>Print the handles of all the windows.</li></ul><pre>package selenium;<br> <br>import java.util.Set;<br> <br>import org.openqa.selenium.By;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.WebElement;<br>import org.openqa.selenium.chrome.ChromeDriver;<br> <br>public class demo2 {<br>public static void main(String[] args) throws InterruptedException<br>{<br> <br>System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;D:\\\\chromedriver.exe&quot;);<br>WebDriver driver = new ChromeDriver();<br>driver.get(&quot;<a href="http://toolsqa.com/automation-practice-switch-windows/">http://toolsqa.com/automation-practice-switch-windows/</a>&quot;);<br>String parentWindowHandle = driver.getWindowHandle();<br>System.out.println(&quot;Parent window&#39;s handle -&gt; &quot; + parentWindowHandle);<br>WebElement clickElement = driver.findElement(By.id(&quot;button1&quot;));<br> <br>for(int i = 0; i &lt; 3; i++)<br>{<br>clickElement.click();<br>Thread.sleep(3000);<br>}<br> <br>Set&lt;String&gt; allWindowHandles = driver.getWindowHandles();<br> <br>for(String handle : allWindowHandles)<br>{<br>System.out.println(&quot;Window handle - &gt; &quot; + handle);<br>}<br> <br>}<br> <br>}</pre><p>Now, we’ll customize the web page by adding a few more commands to the above program.</p><ul><li>In this program, we’ll test the same web page ToolsQA and pass another URL to the parent window.</li><li>Instantiate the browser driver to the new Chromedriver.</li><li>Get the window handle of the parent window and print it.</li><li>Find the element on the page using an ID which is an element locator.</li><li>Use for loop to iterate the number of child windows being created.</li><li>Get the handles of all the windows opened.</li><li>Print the window handle of the first window.</li><li>Use the <em>SwitchTo</em> command to switch to the desired window and also pass the URL of the web page “google.com” to the current window.</li></ul><pre>package selenium;<br> <br>import java.util.Set;<br> <br>import org.openqa.selenium.By;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.WebElement;<br>import org.openqa.selenium.chrome.ChromeDriver;<br> <br>public class demo4 {<br> <br>public static void main(String[] args) throws InterruptedException<br>{<br>System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;D:\\\\chromedriver.exe&quot;);<br>WebDriver driver = new ChromeDriver();<br>driver.get(&quot;<a href="http://toolsqa.com/automation-practice-switch-windows/">http://toolsqa.com/automation-practice-switch-windows/</a>&quot;);<br>String parentWindowHandle = driver.getWindowHandle();<br>System.out.println(&quot;Parent window&#39;s handle -&gt; &quot; + parentWindowHandle);<br>WebElement clickElement = driver.findElement(By.id(&quot;button1&quot;));<br> <br>for(int i = 0; i &lt; 3; i++)<br>{<br>clickElement.click();<br>Thread.sleep(3000);<br>}<br> <br>Set&lt;String&gt; allWindowHandles = driver.getWindowHandles();<br> <br>for(String handle : allWindowHandles)<br>{<br>System.out.println(&quot;Switching to window - &gt; &quot; + handle);<br>System.out.println(&quot;Navigating to google.com&quot;);<br>driver.switchTo().window(handle); //Switch to the desired window first and then execute commands using driver<br>driver.get(&quot;<a href="http://google.com/">http://google.com</a>&quot;);<br>}<br> <br>}<br>}</pre><p>After this, we’ll see how we can alter the child window without a change in the parent window.</p><ul><li>The process is almost similar to the previous program but just that after passing the URL, google.com, we will be switching to the parent window and close it.</li><li>After this, we will define the window handle of the last window and switch to this window and pass the URL of the ToolsQA page. So that this URL opens only in the last window and the other two child windows will still be showing google.com page.</li></ul><pre>package selenium;<br> <br>import java.util.Set;<br>import org.openqa.selenium.By;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.WebElement;<br>import org.openqa.selenium.chrome.ChromeDriver;<br> <br>public class demo5 {<br>public static void main(String[] args) throws InterruptedException<br>{<br> <br>System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;D:\\\\chromedriver.exe&quot;);<br>WebDriver driver = new ChromeDriver();<br>driver.get(&quot;<a href="http://toolsqa.com/automation-practice-switch-windows/">http://toolsqa.com/automation-practice-switch-windows/</a>&quot;);<br>String parentWindowHandle = driver.getWindowHandle();<br>System.out.println(&quot;Parent window&#39;s handle -&gt; &quot; + parentWindowHandle);<br>WebElement clickElement = driver.findElement(By.id(&quot;button1&quot;));<br> <br>for(int i = 0; i &lt; 3; i++)<br>{<br>clickElement.click();<br>Thread.sleep(3000);<br>}<br> <br>Set&lt;String&gt; allWindowHandles = driver.getWindowHandles();<br>String lastWindowHandle = &quot;&quot;;<br>for(String handle : allWindowHandles)<br>{<br>System.out.println(&quot;Switching to window - &gt; &quot; + handle);<br>System.out.println(&quot;Navigating to google.com&quot;);<br>driver.switchTo().window(handle); //Switch to the desired window first and then execute commands using driver<br>driver.get(&quot;<a href="http://google.com/">http://google.com</a>&quot;);<br>lastWindowHandle = handle;<br>}<br> <br>//Switch to the parent window<br>driver.switchTo().window(parentWindowHandle);<br>//close the parent window<br>driver.close();<br>//at this point there is no focused window, we have to explicitly switch back to some window.<br>driver.switchTo().window(lastWindowHandle);<br>driver.get(&quot;<a href="http://toolsqa.com/">http://toolsqa.com</a>&quot;);<br>}<br>}</pre><p>Now, we’ll test one of the top job portals Naukri.com</p><ul><li>Set the system property to Chromedriver and specify its path</li><li>Instantiate the webdriver to the new chromedriver</li><li>Get the URL of the web page and maximize the page</li><li>Get the window handle of the parent window</li><li>Get the window handles of all the windows</li><li>Next, we have declared an object of type iterator to use it for switching to the child window and perform actions on it</li><li>We check if the main window is equal to the child window or not, if(!mainweb.equals(child)). If the main window is not equal to the child window, condition holds and we switch to the next child window.</li></ul><pre>package selenium;<br>import org.testng.annotations.Test;<br>import java.util.Iterator;<br>import java.util.Set;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.chrome.ChromeDriver;<br>public class MultipleWindowsClass{<br><a href="http://twitter.com/Test">@Test</a><br>public void testMultipleWindows() throws InterruptedException{<br>System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;D:\\\\chromedriver.exe&quot;);<br>// To open browser<br>WebDriver driver = new ChromeDriver();<br>// To maximize browser<br>driver.manage().window().maximize();<br>// To open Naukri website with multiple windows<br>driver.get(&quot;<a href="http://www.naukri.com/">http://www.naukri.com/</a>&quot;);<br>// It will return the parent window name as a String<br>String mainWindow=driver.getWindowHandle();<br>// It returns no. of windows opened by WebDriver and will return Set of Strings<br>Set&lt;String&gt; set =driver.getWindowHandles();<br>// Using Iterator to iterate with in windows<br>Iterator&lt;String&gt; itr= set.iterator();<br>while(itr.hasNext()){<br>String childWindow=itr.next();<br>// Compare whether the main windows is not equal to child window. If not equal, we will close.<br>if(!mainWindow.equals(childWindow)){<br>driver.switchTo().window(childWindow);<br>System.out.println(driver.switchTo().window(childWindow).getTitle());<br>driver.close();<br>}<br>}<br>// This is to switch to the main window<br>driver.switchTo().window(mainWindow);<br>}<br>}</pre><p>Next, we’ll perform some actions on our official website edureka.co</p><ul><li>We’ll initialize the webdriver to the new chromedriver.</li><li>Get the URL of the webpage.</li><li>We’ll use the <strong>JavaScriptExecutor</strong>, it is an interface which provides a mechanism to execute Javascript through the Selenium WebDriver.</li><li>Get the window handle of the parent window.</li><li>Find the element using XPath, which is an element locator and send keys to a particular location on the web page.</li><li>Scroll down through the page using the javascriptexecutor command: js.executeScript(“window.scrollBy(X-axis, Y-axis)”);</li><li>Get the handles of all the windows and print it.</li><li>Next, we have declared an object of type iterator to use it for switching to the child window and perform actions on it.</li><li>We check for this condition if(!mainweb.equals(child)), if this condition holds, we switch to the child window and also print the title of it.</li></ul><pre>package selenium;<br> <br>import java.util.Iterator;<br>import java.util.Set;<br> <br>import org.openqa.selenium.By;<br>import org.openqa.selenium.JavascriptExecutor;<br>import org.openqa.selenium.Keys;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.chrome.ChromeDriver;<br> <br>public class demo3 {<br> <br>public static void main(String[] args) throws InterruptedException<br>{<br>System.setProperty(&quot;webdriver.chrome.driver&quot;,&quot;S:\\\\\\\\chromedriver.exe&quot;);<br>WebDriver driver = new ChromeDriver();<br>JavascriptExecutor js = (JavascriptExecutor) driver;<br>driver.get(&quot;<a href="https://www.edureka.co/community">https://www.edureka.co/community</a>&quot;);<br>String mainweb = driver.getWindowHandle();<br>driver.findElement(By.xpath(&quot;//a[<a href="http://twitter.com/class">@class</a>=&#39;qa-logo-link edureka&#39;]&quot;)).sendKeys(Keys.SHIFT,Keys.ENTER);<br>Thread.sleep(100);<br>js.executeScript(&quot;window.scrollBy(0,400)&quot;);<br>Set &lt;String&gt; set = driver.getWindowHandles();<br>System.out.println(set);<br>Iterator &lt;String&gt; itr = set.iterator();<br>while(itr.hasNext())<br>{<br>js.executeScript(&quot;window.scrollBy(0,400)&quot;);<br>String child = itr.next();<br>if(!mainweb.equals(child))<br>{<br>driver.switchTo().window(child);<br>System.out.println(driver.switchTo().window(child).getTitle());<br>// driver.close();<br>}<br>}<br>driver.switchTo().window(mainweb);<br> <br>}<br> <br>}</pre><p>Next, we’ll automate the same webpage by customizing it.</p><ul><li>The process is almost similar to the previous one but in this, we print the title of the current page.</li><li>Use the javascriptexecutor to scroll down through a page.</li><li>Find the element using the element locator XPath and send keys( which is of the form string) to that particular element location.</li><li>Declare the web element <em>Link </em>to click on a particular link on the page and in this case, we want the link to open in a new window.</li><li>Pause the execution for a few seconds after this.</li><li>Get the window handles of all the windows and print them in a sequence.</li><li>Switch to the parent window and check if the title matches. If it does, scroll down the page using the javascriptexecutor. Find another element on the web page using the element locator and specify the position of the new window.</li><li>Switch back to the parent window and scroll down through the page.</li></ul><pre>package selenium; <br>import java.util.Set; <br>import org.openqa.selenium.By;<br>import org.openqa.selenium.JavascriptExecutor; <br>import org.openqa.selenium.Keys; <br>import org.openqa.selenium.Point; <br>import org.openqa.selenium.WebDriver; <br>import org.openqa.selenium.WebElement; <br>import org.openqa.selenium.chrome.ChromeDriver; <br>import org.openqa.selenium.interactions.Actions; <br>//import org.openqa.selenium.support.ui.Select; <br>public class selenium { public static void main(String[] args) throws Exception <br>{ <br>System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;D:\\\\chromedriver.exe&quot;); <br>WebDriver driver = new ChromeDriver(); <br>driver.get(&quot;<a href="https://www.edureka.co/">https://www.edureka.co/</a>&quot;); <br>String title = driver.getTitle(); System.out.println(title); <br>//driver.get(&quot;<a href="http://www.google.co/">http://www.google.co</a>&quot;); <br>JavascriptExecutor js = (JavascriptExecutor) driver; <br>driver.findElement(By.cssSelector(&quot;#search-inp&quot;)).sendKeys(&quot;Selenium Certification Course&quot;); <br>js.executeScript(&quot;window.scrollBy(0,40)&quot;); <br>driver.findElement(By.xpath(&quot;//span[<a href="http://twitter.com/class">@class</a>=&#39;typeahead__button&#39;]&quot;)).click(); <br>WebElement link = driver.findElement(By.xpath(&quot;//li[<a href="http://twitter.com/class">@class</a>=&#39;ga-allcourses&#39;]//a[<a href="http://twitter.com/class">@class</a>=&#39;giTrackElementHeader&#39;][contains(text(),&#39;Courses&#39;)]&quot;)); <br>Actions newwin = new Actions(driver); <br>newwin.keyDown(Keys.SHIFT).click(link).keyUp(Keys.SHIFT).build().perform(); <br>//Thread.sleep(2000); <br>//js.executeScript(&quot;window.scrollBy(0,400)&quot;); <br>Thread.sleep(3000); <br>Set&lt;String&gt; windows = driver.getWindowHandles(); <br>System.out.println(windows); <br>System.out.println(&quot;a1&quot;); <br>for (String window : windows) <br>{ <br>driver.switchTo().window(window); <br>if (driver.getTitle().contains(&quot;Best Training &amp; Certification Courses for Professionals | Edureka&quot;)) <br>{ <br>System.out.println(&quot;a2&quot;); <br>js.executeScript(&quot;window.scrollBy(0,1000)&quot;); <br>System.out.println(&quot;b1&quot;); <br>driver.findElement(By.xpath(&quot;//*[<a href="http://twitter.com/id">@id</a>=\&quot;allc_catlist\&quot;]/li[3]/a&quot;)).click(); <br>driver.manage().window().setPosition(new Point(-2000, 0)); <br>} <br>} <br>Thread.sleep(3000); <br>Set&lt;String&gt; windows1 = driver.getWindowHandles(); <br>System.out.println(windows1); <br>System.out.println(&quot;a3&quot;); <br>for (String window : windows1) <br>{ <br>driver.switchTo().window(window); <br>System.out.println(&quot;a4&quot;); <br>js.executeScript(&quot;window.scrollBy(0,400)&quot;); <br>} <br>} <br>}</pre><p>Now let’s check the output of the last program.</p><p>First, we’ll initialize the browser and get the URL of the web page we want to test and find the search box element on the page and send keys to the search box and click the search icon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sdJ0QXYc0qwo3hzNmim3SQ.png" /></figure><p>After this, we will open the course link in the new window using the action command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JIYyR7-w9FNYI5uqv5LYPg.png" /></figure><p>Once we do this, we’ll scroll down through the child window using the javascriptexecutor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AAo6ipJd4X3O-Vv0MKDQBQ.png" /></figure><p>And after this, print the title of the first window and also the window handles of the two windows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*gJ0YxtL_FCPwPmwgqz370w.png" /></figure><p>If you wish to check out more articles on the market’s most trending technologies like Artificial Intelligence, DevOps, Ethical Hacking, then you can refer to <a href="https://www.edureka.co/blog/?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=handle-multiple-windows-in-selenium">Edureka’s official site.</a></p><p>Do look out for other articles in this series which will explain the various other aspects of Selenium.</p><blockquote>1. <a href="https://medium.com/edureka/selenium-tutorial-77879a1d9af1">Selenium Tutorial</a></blockquote><blockquote>2. <a href="https://medium.com/edureka/selenium-webdriver-tutorial-e3e6219f21ad">Selenium WebDriver: TestNG For Test Case Management &amp; Report Generation</a></blockquote><blockquote>3. <a href="https://medium.com/edureka/selenium-framework-data-keyword-hybrid-frameworks-ea8d4f4ce99f">Building A Data Driven, Keyword Driven &amp; Hybrid Selenium Framework</a></blockquote><blockquote>4.<a href="https://medium.com/edureka/locators-in-selenium-f6e6b282aed8"> Locators in Selenium</a></blockquote><blockquote>5. <a href="https://medium.com/edureka/xpath-in-selenium-cd659373e01a">XPath Tutorial</a></blockquote><blockquote>6. <a href="https://medium.com/edureka/waits-in-selenium-5b57b56f5e5a">Waits in Selenium</a></blockquote><blockquote>7. <a href="https://medium.com/edureka/selenium-grid-tutorial-ef342799c484">Setting up a Selenium Grid for distributed Selenium testing</a></blockquote><blockquote>8. <a href="https://medium.com/edureka/selenium-using-python-edc22a44f819">Selenium Using Python</a></blockquote><blockquote>9. <a href="https://medium.com/edureka/cross-browser-testing-9299b04ce277">Cross Browser Testing Using LambdaTest</a></blockquote><blockquote>10. <a href="https://medium.com/edureka/cross-browser-testing-using-selenium-90b1911c6d60">Cross Browser Testing Using Selenium</a></blockquote><blockquote>11. <a href="https://medium.com/edureka/page-object-model-in-selenium-bc4d7c8c4203">Page Object Model In Selenium</a></blockquote><blockquote>12. <a href="https://medium.com/edureka/selenium-projects-b2df15d35fe2">Selenium Projects</a></blockquote><blockquote>13. <a href="https://medium.com/edureka/qtp-vs-selenium-338f3d3bbfa7">QTP vs Selenium</a></blockquote><blockquote>14. <a href="https://medium.com/edureka/selenium-vs-rpa-84159dbcd0f2">Selenium vs RPA</a></blockquote><blockquote>15. <a href="https://medium.com/edureka/selenium-webdriver-architecture-565e2db26dd5">Selenium WebDriver Architecture</a></blockquote><blockquote>16. <a href="https://medium.com/edureka/exceptions-in-selenium-369c38155e7d">Handling Exceptions In Selenium</a></blockquote><blockquote>17. <a href="https://medium.com/edureka/cucumber-selenium-tutorial-aefec05f4733">Perform Website Testing Using Cucumber &amp; Selenium</a></blockquote><p><em>Originally published at </em><a href="https://www.edureka.co/blog/handle-multiple-windows-in-selenium/"><em>https://www.edureka.co</em></a><em> on April 16, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=727ba5f8f6a7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/edureka/handle-multiple-windows-in-selenium-727ba5f8f6a7">How to Handle Multiple Windows in Selenium WebDriver?</a> was originally published in <a href="https://medium.com/edureka">Edureka</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top Selenium Projects That You Should Practice]]></title>
            <link>https://medium.com/edureka/selenium-projects-b2df15d35fe2?source=rss-dd4f4acd2a2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2df15d35fe2</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[selenium-projects]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[automation-testing-tool]]></category>
            <dc:creator><![CDATA[Neha Vaidya]]></dc:creator>
            <pubDate>Fri, 12 Apr 2019 12:31:56 GMT</pubDate>
            <atom:updated>2019-06-05T11:34:00.791Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*wtSR4xKEaET8BoZVDQoRpw.jpeg" /><figcaption>Selenium Projects —Edureka</figcaption></figure><p>In the previous articles on Selenium, we have covered the fundamentals of testing like <a href="https://medium.com/edureka/locators-in-selenium-f6e6b282aed8">Locators,</a> <a href="https://medium.com/edureka/waits-in-selenium-5b57b56f5e5a">Waits,</a> <a href="https://medium.com/edureka/selenium-grid-tutorial-ef342799c484">Selenium Grid</a>, <a href="https://medium.com/edureka/selenium-webdriver-tutorial-e3e6219f21ad">TestNG</a> etc. In this ‘Selenium Projects’ article, I will be demonstrating as to how you can implement the above concepts and get a tight grip over them. This, in course, will help you to test your skills for project analysis, development and handling skills on the whole.</p><p>Below are the topics that I will be discussing in this article:</p><ul><li>Introduction to Selenium</li><li>Selenium Projects</li></ul><ol><li>Automating Edureka Website</li></ol><p>2. Flight Booking Application</p><ul><li>Selenium Case studies</li></ul><ol><li>Enterprise Management System</li><li>Automation framework for Physical fitness data</li></ol><h3>Introduction to Selenium</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*5f8WSYpLJ5JQfF6GjigyCQ.png" /></figure><p>Selenium is the preferred tool when it comes to automating the tests which are carried out on web browsers. With Selenium, only testing of web applications is possible. Any desktop (software) application or mobile application cannot be tested using Selenium. It is very helpful to write functional test cases. It also provides reliable performance with n number of test cases and it is obviously the best suitable automation tool for web applications.</p><p>Now let’s dive into this article and look at the interesting projects that help you in understanding more about Selenium.</p><h3>Selenium Projects</h3><p>The only way with which you can enhance your knowledge on <a href="https://www.edureka.co/blog/what-is-selenium/?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=selenium-projects">Selenium</a> is by working on some real-life projects. In this article, I will be discussing two important projects and a few case studies as well.</p><p>Let’s begin with our first project.</p><h3>Automating Edureka Website</h3><p><strong><em>Problem Statement 1:</em></strong> Consider a candidate who has registered for edureka portal wants to update all the personal details and career interests available in the portal. Now the task is to write a Selenium script to do the same and also explore the edureka portal.</p><p><em>Steps:</em></p><ol><li>Login to the <a href="https://www.edureka.co/">Edureka</a></li><li>Navigate to ‘My Profile’</li><li>Update professional and personal details</li><li>Explore the blogs and navigate to the Main page</li><li>Logout of the portal</li></ol><p><strong>NOTE:</strong> Make sure that you are logged out of Edureka’s website while performing this practical.</p><p><strong>Solution</strong></p><p>Let’s now have a look at the code to understand this better.</p><pre>package edureka;<br>import java.util.concurrent.TimeUnit;<br>import org.junit.AfterClass;<br>import org.openqa.selenium.By;<br>import org.openqa.selenium.Keys;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.chrome.ChromeDriver;<br>import org.openqa.selenium.interactions.Actions;<br>import org.openqa.selenium.support.ui.ExpectedConditions;<br>import org.openqa.selenium.support.ui.Select;<br>import org.openqa.selenium.support.ui.WebDriverWait;<br>import org.testng.annotations.AfterTest;<br>import org.testng.annotations.Test;<br>public class HandlingAllControls {<br>static WebDriver driver;<br><a href="http://twitter.com/Test">@Test</a>( priority = 0)<br>public void EdurekaProfile() throws InterruptedException{<br>System.setProperty(&quot;webdriver.chrome.driver&quot;,&quot;C:\\Selenium-java-edureka\\chromedriver_win32\\chromedriver.exe&quot;);<br>driver = new ChromeDriver();<br>//Put a Implicit wait, this means that any search for elements on the page could take the time the implicit wait is set for before throwing exception<br>driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);<br>//Launch the Edureka Website<br>driver.get(&quot;<a href="https://www.edureka.co/">https://www.edureka.co/</a>&quot;);<br>try {<br>Thread.sleep(1000);<br>} catch (InterruptedException e) {<br>e.printStackTrace();<br>}<br>driver.findElement(By.linkText(&quot;Log In&quot;)).click();<br>try {<br>Thread.sleep(1000);<br>} catch (InterruptedException e) {<br>e.printStackTrace();<br>}<br>Actions actions = new Actions(driver);<br>actions.moveToElement(driver.findElement(By.id(&quot;si_popup_email&quot;)));<br>Thread.sleep(2000);<br>actions.click();<br>actions.sendKeys(&quot;<a href="/service/mailto:TestingEdureka@gmail.com">TestingEdureka@gmail.com</a>&quot;);<br>Thread.sleep(2000);<br>actions.build().perform();<br>actions.moveToElement(driver.findElement(By.id(&quot;si_popup_passwd&quot;)));<br>Thread.sleep(2000);<br>actions.click();<br>actions.sendKeys(&quot;12345678&quot;);<br>Thread.sleep(2000);<br>actions.build().perform();<br>actions.moveToElement(driver.findElement(By.xpath(&quot;//button[<a href="http://twitter.com/class">@class</a>=&#39;clik_btn_log btn-block&#39;]&quot;)));<br>Thread.sleep(2000);<br>actions.click();<br>actions.build().perform();<br>driver.findElement(By.xpath(&quot;//a[<a href="http://twitter.com/class">@class</a>=&#39;dropdown-toggle trackButton&#39;]//img[<a href="http://twitter.com/class">@class</a>=&#39;img30&#39;]&quot;)).click();<br>Thread.sleep(2000);<br>driver.findElement(By.xpath(&quot;//ul[<a href="http://twitter.com/class">@class</a>=&#39;dropdown-menu user-menu profile-xs hidden-sm hidden-xs&#39;]//a[<a href="http://twitter.com/class">@class</a>=&#39;giTrackElementHeader&#39;][contains(text(),&#39;My Profile&#39;)]&quot;)).click();<br>Thread.sleep(2000);<br>WebDriverWait waitElement = new WebDriverWait(driver,20);<br>waitElement.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(&quot;//li[<a href="http://twitter.com/class">@class</a>=&#39;active&#39;]//a[<a href="http://twitter.com/data">@data</a>-toggle=&#39;tab&#39;][contains(text(),&#39;My Profile&#39;)]&quot;)));<br>driver.findElement(By.xpath(&quot;//li[<a href="http://twitter.com/class">@class</a>=&#39;active&#39;]//a[<a href="http://twitter.com/data">@data</a>-toggle=&#39;tab&#39;][contains(text(),&#39;My Profile&#39;)]&quot;)).click();<br>String Pagetitle = driver.getTitle();<br>driver.findElement(By.xpath(&quot;//div[<a href="http://twitter.com/class">@class</a>=&#39;personal-details&#39;]//i[<a href="http://twitter.com/class">@class</a>=&#39;icon-pr-edit&#39;]&quot;)).click();<br>Thread.sleep(2000);<br>driver.findElement(By.xpath(&quot;//input[<a href="http://twitter.com/placeholder">@placeholder</a>=&#39;Name&#39;]&quot;)).sendKeys(&quot;Edureka&quot;);<br>Thread.sleep(2000);<br>System.out.println(&quot;b&quot;);driver.navigate().to(&quot;<a href="https://learning.edureka.co/my-profile">https://learning.edureka.co/my-profile</a>&quot;);<br>Thread.sleep(2000);<br>System.out.println(&quot;a&quot;);<br>System.out.println(&quot;abc&quot;);<br>driver.navigate().to(&quot;<a href="https://learning.edureka.co/onboarding/careerinterests">https://learning.edureka.co/onboarding/careerinterests</a>&quot;);<br>Thread.sleep(3000);<br>Select dropdownCurrentJob = new Select(driver.findElement(By.xpath(&quot;//select[<a href="http://twitter.com/name">@name</a>=&#39;interestedJob&#39;]&quot;)));<br>Thread.sleep(2000);<br>dropdownCurrentJob.selectByVisibleText(&quot;Software Testing&quot;);<br>Thread.sleep(2000);<br>Select dropdownEmployementType = new Select(driver.findElement(By.xpath(&quot;//select[<a href="http://twitter.com/name">@name</a>=&#39;elementType&#39;]&quot;)));<br>Thread.sleep(2000);dropdownEmployementType.selectByVisibleText(&quot;Both&quot;);<br>Select dropdownCTC = new Select(driver.findElement(By.xpath(&quot;//select[<a href="http://twitter.com/name">@name</a>=&#39;lastDrawnSalary&#39;]&quot;)));<br>Thread.sleep(2000);<br>dropdownCTC.selectByVisibleText(&quot;Not applicable&quot;);<br>driver.findElement(By.xpath(&quot;//label[contains(text(),&#39;Yes&#39;)]&quot;)).click();<br>Thread.sleep(2000);<br>driver.findElement(By.name(&quot;preferredCity&quot;)).sendKeys(&quot;Mumbai&quot;);<br>Thread.sleep(2000);<br>driver.findElement(By.xpath(&quot;//button[<a href="http://twitter.com/type">@type</a>=&#39;submit&#39;]&quot;)).click();<br>Thread.sleep(2000);<br>driver.navigate().to(&quot;<a href="https://learning.edureka.co/">https://learning.edureka.co/</a>&quot;);<br>Thread.sleep(2000);<br>driver.findElement(By.xpath(&quot;//span[<a href="http://twitter.com/class">@class</a>=&#39;user_name&#39;]&quot;)).click();<br>Thread.sleep(2000);<br>driver.findElement(By.xpath(&quot;//a[contains(text(),&#39;Log Out&#39;)]&quot;)).click();<br>Thread.sleep(2000);<br>System.out.println(&quot;a&quot;);<br>try {Thread.sleep(2000);<br>} catch (InterruptedException e) {<br>e.printStackTrace();<br>}<br>}<br>}</pre><p>So, when you execute the above program, the Chrome driver will launch Google Chrome, navigate to <a href="https://www.edureka.co/">edureka.co website</a> and enter the login username and password. After that, it will navigate through my profile and update the personal and professional details and then log out of the account. So everything will be automated with the help of Selenium.</p><p>Now let’s understand the next project.</p><h3>Automating Flight Booking Application</h3><p><strong><em>Problem Statement 2:</em></strong> Let’s consider this particular project where we will try automating the process of booking a flight. Let’s take a look at how it’s done using Selenium.</p><p>Let’s divide the process into the various steps to understand the working of a project in a better way.</p><p><em>Steps:</em></p><ol><li>We’ll start with initializing the browser driver and then log in to the web page</li><li>Find the flight according to the user requirements</li><li>Select a flight and book it</li><li>Capture a screenshot of the confirmation page</li></ol><p>Now let’s have a look at the steps involved in the creation of this project.</p><p><strong>Solution</strong></p><p><strong>Step 1: Create a Java Project</strong></p><p>Go to File-&gt; Go to New-&gt; Others -&gt; Maven Project to create a new Java project. Below figure depicts the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*DSHlXr4KQPfRK2-RsMXOpg.png" /></figure><p><strong>Step 2: Add the dependencies to pom.xml file</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*Jhcq6BRFirrqExAAve6h8A.png" /></figure><p><strong>Step 3: Create the packages</strong></p><p>Create the packages under the src/main/java folder and the src/test/java folder and start writing the piece of code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*15I52_20B6T0C2v-m1YbKw.png" /></figure><p><strong>Step 4: Write the code to run the test cases</strong></p><p>If you wish to know the detailed solution and the complete project, you can check out this article on <a href="https://www.edureka.co/blog/create-selenium-maven-project?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=selenium-projects">Selenium Maven Project with Eclipse.</a></p><p>So this was all about Automating a Flight Booking application. Now let’s delve further into this article and know few important real-time case studies of Selenium.</p><h3>Selenium Case Studies</h3><h4>Case Study 1: Enterprise Management System</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HL0zh6JJDBhLLnWt-ug5eA.jpeg" /></figure><p><strong>Client</strong>: Information Technology Service Provider</p><p><strong>Industry</strong>: IT</p><p><strong>Technologies: </strong>Selenium 3.1, Eclipse, <a href="https://www.edureka.co/blog/java-tutorial?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=selenium-projects">Java</a>, Ant</p><p><strong>Solution Provider</strong>: Mindfire Solutions</p><p><strong><em>Situation</em></strong></p><p>The <em>Enterprise Management System</em> was a complex application with many modules. Various modules of the application were used by the client and its customer organizations for corporate communication, project management, customer and sales channel management, human resource management, accounting, knowledge &amp; learning management, internal social networking, etc.</p><p><strong><em>Challenges</em></strong></p><p>There were a large number of test cases to check the functionality and workflow of the application. It was becoming increasingly difficult and costly for the client to go through manual testing for any change in the application. So there was a need for automating the testing effort which needed to be very effective and efficient.</p><p><strong><em>Solution</em></strong></p><p><strong>Step 1:</strong> After a thorough analysis of the application and various automation tools, Selenium seemed like the best tool for functional and regression testing and it very well suited for the client’s needs.</p><p><strong>Step 2:</strong> Next the solution provider went through the application, understood its functionality and work‐flow, and prepared the automation plan.</p><p><strong>Step 3:</strong> After that, they designed a high-level hybrid framework which made the scripts very easy to run even for non-technical users. Also, developed sufficient sets of scripts to be simply run whenever there was a change in the application.</p><p><strong>Step 4:</strong> This not only saved money but the automation scripts took lesser time to run and also generated eminently readable and understandable HTML reports simultaneously.</p><p><strong>Step 5:</strong> These HTML reports display information such as pass/fail result, script execution time, screen‐shots, etc., for each of the test cases and test steps separately. These results can also be automatically emailed through the script to any number of persons as desired.</p><h4>Case Study 2: Automating Physical Fitness Data</h4><p>In this case study, our client provides training, nutrition, and physical therapy programs by a team of specialists. They utilize the software that integrates with workout machines to provide the user with recommended training exercises based on previous workouts, weekly workout challenges, and member goals.</p><p>The client is looking to implement a functional test automation framework for their application in order to perform regression testing as new builds are released.</p><p><strong><em>Challenges</em></strong></p><p>The functional test automation framework must support the Google Chrome web browser. They need the framework to be implemented in such a way that script maintenance should be kept at minimal.</p><p><strong><em>Strategy</em></strong></p><p>Basically, the solution provider of the framework made use of Selenium WebDriver to automate business transactions. RTTS(Solution Provider) took advantage of the page object design pattern to help minimize the maintenance required once an application undergoes UI changes.</p><p><strong><em>Solution</em></strong></p><p>The implemented automation framework is 100% open source and the components are as follows:</p><ul><li>Eclipse</li><li>Java</li><li>Selenium</li><li>JUnit</li><li>Apache Ant</li><li>Subversion</li></ul><p><strong>Step 1:</strong> As soon as the framework was in place, the page object design pattern was utilized to create classes for each page in the application. Page object classes provided an interface for the testers to interact with each page.</p><p><strong>Step 2:</strong> Test scripts were then created by calling methods from the page object classes that performed specific transactions, such as login as registered user, create a new user, create a workout, etc. All work was committed to a Subversion repository for version control.</p><p><strong>Step 3:</strong> As Selenium WebDriver lacks any built-in logging mechanism, a custom solution was used to record logs into an excel file using the open source Java API JExcel. Each command and verifications performed were logged. This actually provided a detailed view of where the test script had failed and the steps performed that caused the failure.</p><p><strong>Step 4:</strong> Once the framework was in place and several test scripts created, training was provided to the client’s employees on the usage of Selenium 2.</p><p><strong>Step 5:</strong> After training, the QA testers began creating test scripts for any issues that were encountered.</p><p><strong>Step 6:</strong> At the time of scripting, majorly the issues occurred due to heavy AJAX usage in the application. As AJAX would only update a section of the application instead of the entire page, the Selenium WebDriver test script was executing commands faster than AJAX was updating the UI. Selenium Waits ExpectedConditions class was used to wait for certain conditions to be met prior to executing the next Selenium WebDriver command, such as visibility.</p><p><strong>Step 7:</strong> Now, the report was generated after executing a test suite. To create the report, Apache Ant was used to execute the JUnit tests and generate a JUnit report. The report displayed metrics on the number of tests that failed and passed. Reports can also be drilled down to display additional information about each failure and what caused the failure to occur.</p><p><strong>Step 8:</strong> Finally, a local server was set up with virtual machines of different operating systems that supported different browser versions. Thus, the virtual machines will serve to provide an environment in which full regression testing will be performed using the Selenium Grid.</p><p><strong><em>Benefits</em></strong></p><p>By choosing an open source framework, there was no cost involved in obtaining the required components to set up the framework. Additional savings were also made by implementing the Selenium Grid. Initially, the client had opted to utilize a third party company to execute Selenium WebDriver test scripts. The cost of using the third party company came in at <strong>$149/month</strong> with limits on the number of tests that could be executed. With the Selenium Grid, the client is now able to run Selenium WebDriver test scripts without any limits or fees.</p><p>I hope you found these real-life case studies interesting. With this, we come to the end of our article on Selenium Projects. <em>I hope you guys enjoyed this article and added value to your knowledge.</em></p><p>If you wish to check out more articles on the market’s most trending technologies like Artificial Intelligence, DevOps, Ethical Hacking, then you can refer to <a href="https://www.edureka.co/blog/?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=selenium-projects">Edureka’s official site.</a></p><p>Do look out for other articles in this series which will explain the various other aspects of Selenium.</p><blockquote>1. <a href="https://medium.com/edureka/selenium-tutorial-77879a1d9af1">Selenium Tutorial</a></blockquote><blockquote>2. <a href="https://medium.com/edureka/selenium-webdriver-tutorial-e3e6219f21ad">Selenium WebDriver: TestNG For Test Case Management &amp; Report Generation</a></blockquote><blockquote>3. <a href="https://medium.com/edureka/selenium-framework-data-keyword-hybrid-frameworks-ea8d4f4ce99f">Building A Data Driven, Keyword Driven &amp; Hybrid Selenium Framework</a></blockquote><blockquote>4.<a href="https://medium.com/edureka/locators-in-selenium-f6e6b282aed8"> Locators in Selenium</a></blockquote><blockquote>5. <a href="https://medium.com/edureka/xpath-in-selenium-cd659373e01a">XPath Tutorial</a></blockquote><blockquote>6. <a href="https://medium.com/edureka/waits-in-selenium-5b57b56f5e5a">Waits in Selenium</a></blockquote><blockquote>7. <a href="https://medium.com/edureka/selenium-grid-tutorial-ef342799c484">Setting up a Selenium Grid for distributed Selenium testing</a></blockquote><blockquote>8. <a href="https://medium.com/edureka/selenium-using-python-edc22a44f819">Selenium Using Python</a></blockquote><blockquote>9. <a href="https://medium.com/edureka/cross-browser-testing-9299b04ce277">Cross Browser Testing Using LambdaTest</a></blockquote><blockquote>10. <a href="https://medium.com/edureka/cross-browser-testing-using-selenium-90b1911c6d60">Cross Browser Testing Using Selenium</a></blockquote><blockquote>11. <a href="https://medium.com/edureka/handle-multiple-windows-in-selenium-727ba5f8f6a7">Handle Multiple Windows in Selenium</a></blockquote><blockquote>12. <a href="https://medium.com/edureka/page-object-model-in-selenium-bc4d7c8c4203">Page Object Model In Selenium</a></blockquote><blockquote>13. <a href="https://medium.com/edureka/qtp-vs-selenium-338f3d3bbfa7">QTP vs Selenium</a></blockquote><blockquote>14. <a href="https://medium.com/edureka/selenium-vs-rpa-84159dbcd0f2">Selenium vs RPA</a></blockquote><blockquote>15. <a href="https://medium.com/edureka/selenium-webdriver-architecture-565e2db26dd5">Selenium WebDriver Architecture</a></blockquote><blockquote>16. <a href="https://medium.com/edureka/exceptions-in-selenium-369c38155e7d">Handling Exceptions In Selenium</a></blockquote><blockquote>17. <a href="https://medium.com/edureka/cucumber-selenium-tutorial-aefec05f4733">Perform Website Testing Using Cucumber &amp; Selenium</a></blockquote><p><em>Originally published at </em><a href="https://www.edureka.co/blog/selenium-projects/"><em>https://www.edureka.co</em></a><em> on April 12, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2df15d35fe2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/edureka/selenium-projects-b2df15d35fe2">Top Selenium Projects That You Should Practice</a> was originally published in <a href="https://medium.com/edureka">Edureka</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Know How To Perform Cross Browser Testing Using LambdaTest]]></title>
            <link>https://medium.com/edureka/cross-browser-testing-9299b04ce277?source=rss-dd4f4acd2a2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9299b04ce277</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[lambdatest]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[cross-browser-testing]]></category>
            <dc:creator><![CDATA[Neha Vaidya]]></dc:creator>
            <pubDate>Wed, 10 Apr 2019 12:39:42 GMT</pubDate>
            <atom:updated>2019-06-05T11:30:06.745Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*IyOyMA4IN0vxEPDIJgzaMQ.jpeg" /><figcaption>Cross Browser Testing using Lambda Test — Edureka</figcaption></figure><p>The world’s first browser was launched in the year 1990 and it has been 30 years since then. Even now, no two browser developers can agree on which technologies to support and which not. That’s why the behavior of the website differs from browser to browser. It is very necessary to check the compatibility and performance of the websites on different browsers and operating systems. So, this article on Cross Browser testing using Lambda test will help you understand these concepts in depth. With the increasing demand in the field of testing, <a href="https://www.edureka.co/blog/selenium-webdriver-tutorial?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=cross-browser-testing">automation testing using Selenium</a> tops the list of most sought-after skills.</p><p>Below are the topics covered in this article:</p><ul><li>What is Cross Browser Compatibility?</li><li>Why do you need Cross Browser testing?</li><li>How to perform Cross Browser testing?</li><li>Lambda Test Demo</li></ul><p>Cross-browser compatibility is the ability of a website or web application to function across different browsers and operating systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*zdATJco5cZuG9atiTu5JMg.png" /></figure><p>It implies, your web applications or website should work absolutely fine across chrome, Microsoft, firefox, safari and even across all the operating systems such as Windows, MAC, etc. But that’s not the case at times. And that’s where you need to understand the concept of Cross Browser testing. Having understood this, now let’s see why do you need Cross Browser testing.</p><h3>Why do you need Cross Browser Testing?</h3><p>A simple website is comprised of 3 major technologies i.e. HTML5, CSS3, and JavaScript. But there are other 100s of technologies that are there in the backend like, Python, Ruby, etc can be used. But overall in the front end and in the rendering, only these three technologies are used.</p><p>However, each browser uses a completely different rendering engine to compute these 3 technologies. For example, Chrome uses Blink, Firefox uses Gecko and IE uses edge HTML and Chakra, because of which the same website would be rendered completely differently by all these different browsers. And that’s exactly why you need cross-browser testing. That means the website should work perfectly fine, in all the different browser versions and in different operating systems. So to ensure that it works fine, cross-browser testing is required.</p><p>Now let’s move further and understand how to perform Cross Browser Testing?</p><h3>How to perform Cross Browser Testing?</h3><p>It is performed with live interactive testing on all browsers, browser versions and operating systems along with all major mobile devices. It is basically done in two ways:</p><ol><li>Manual Method</li><li>Automated Method</li></ol><h4>Manual Method</h4><p>In this case, a business identifies the browsers that the application must support. Testers then re-run the same test-cases using different browsers and observe the application’s behavior and report bugs if any. In this type of testing, it is not possible to cover many browsers and also, the application might not be tested on major browser versions. Also, performing cross-browser check manually is costly and time-consuming too.</p><h4>Automated Method</h4><p>Cross-browser testing is basically running the same set of test cases multiple times on different browsers. This type of repeated task is best suited for automation. Thus, it’s more cost and time effective to perform this testing by using tools. But again there is a challenge over here, i.e there are lots of browsers and mainly used ones are Chrome, Firefox, Safari, Edge, and IE. And again each browser has at least 10 versions like Chrome72, Chrome70, Chrome68 and so on. Similarly, there are four main Operating Systems with their own versions like Win98, XP, 2000, Win7, Win8, and Win10. In total, there are of more than 2000 browser environments available.</p><h3>LambdaTest Demo</h3><p>Basically, collecting a browser and browser environment is a great challenge faced by the testers because manually actions become a tedious task. In order to resolve the manual effort of gathering browser environments, Lambda test comes into the rescue. Lambda test collected all the browsers, browser versions OS versions and created machines out of them and collected all those machines under a cloud-based platform. Lambda testing is a cloud-based cross testing platform which is one of the amazing tools for cross-browser testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*iTYz69dFiv6jaNKDj3XD-w.png" /></figure><p>So, if you want to test a website or a web application on a specific configuration, that you have access to, lambda test gives you the solution. You just have to <a href="https://accounts.lambdatest.com/login"><em>Log In to Lambda Test</em></a> , enter the URL of the website that you wish to test and start off the session where you can test the website for browser compatibility issues.</p><p>Now, let’s have a look at the demo where you will understand how actually this lambda test works.</p><p>This is a basic lambda test platform to see how real-time testing looks. Real time testing is a feature that gives you live interactive testing of a website or a web app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*WGAj208dtRMwRPXW0_mahg.png" /></figure><p>Here, you can enter the URL of the website that you wish to test to. Next, you can choose the preferred browser, for example, Google Chrome, its version, operating system, and its resolution. After that, you can hit the start button. Once you hit the start button, it will start allocating the cloud machine and proceed with the next steps as shown in the below figure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*ggCXa0XaxvPiNSrxRBKrbw.png" /></figure><p>Once it completes setting up the browser, it will navigate through the respective URL that you have given in the specified browser version and the Operating System platform. In the above example, I have given URL of <a href="https://www.edureka.co/">Edureka</a> website so it will navigate to Edureka blog page. Here, you can exactly perform the same operations on the website as you do in real time. You can have a look at the below screenshot to check the output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*Bxz8dWcisBwTrQ3_uovt4Q.png" /></figure><p>Similarly, you can check the compatibility of the website in other browsers by doing cross-browser testing using Lambda Test. The below snapshot depicts <a href="https://www.edureka.co/blog">Edureka blog </a>page in Mozilla Firefox version 58 and Windows 7 OS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*NSQS7s2GPoNk3ABoboammw.png" /></figure><p>You can also check whether your website is working completely fine in Mobile operating systems as well. Let’s have a look at the snapshot captured in iPhone 4s. Even in iPhone 4s when I tested the website, it was working perfectly fine. It implies the website is compatible with all the different browser versions and operating systems as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/1*U9gin5paXkf0U5jEEBsniA.png" /></figure><p>Also, the same website i.e Edureka blog page works fine in Samsung Galaxy S9 plus. Below snapshot depicts the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*0MfW41KVTELoPUmnrenwnw.png" /></figure><p>This is how you can check the compatibility of the website on various OS and browsers with the help of lambda test application. Not just that, you can also carry out <em>screenshot test</em> wherein you can capture 25 screenshots simultaneously to check the performance of the website in different browsers. Below figure illustrates the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*lljoZ7rg7ZvSWHPeSXdPDw.png" /></figure><p>Here, you can click on various browser versions from different browsers and OS to check the response of the website in all these browsers. If you find any bug, you can mark it as a bug and log an issue. You can refer to the below snapshot to see the issue that is logged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*fzGqk6pq9t7hAzQtVtH-uQ.png" /></figure><p>So, this is how you can log an issue and track it in an issue tracker. I hope you understood how to do that. This brings us to the end of the article on Cross Browser Testing using Lambda Test.</p><p>If you wish to check out more articles on the market’s most trending technologies like Artificial Intelligence, DevOps, Ethical Hacking, then you can refer to <a href="https://www.edureka.co/blog/?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=cross-browser-testing">Edureka’s official site.</a></p><p>Do look out for other articles in this series which will explain the various other aspects of Selenium.</p><blockquote>1. <a href="https://medium.com/edureka/selenium-tutorial-77879a1d9af1">Selenium Tutorial</a></blockquote><blockquote>2. <a href="https://medium.com/edureka/selenium-webdriver-tutorial-e3e6219f21ad">Selenium WebDriver: TestNG For Test Case Management &amp; Report Generation</a></blockquote><blockquote>3. <a href="https://medium.com/edureka/selenium-framework-data-keyword-hybrid-frameworks-ea8d4f4ce99f">Building A Data Driven, Keyword Driven &amp; Hybrid Selenium Framework</a></blockquote><blockquote>4.<a href="https://medium.com/edureka/locators-in-selenium-f6e6b282aed8"> Locators in Selenium</a></blockquote><blockquote>5. <a href="https://medium.com/edureka/xpath-in-selenium-cd659373e01a">XPath Tutorial</a></blockquote><blockquote>6. <a href="https://medium.com/edureka/waits-in-selenium-5b57b56f5e5a">Waits in Selenium</a></blockquote><blockquote>7. <a href="https://medium.com/edureka/selenium-grid-tutorial-ef342799c484">Setting up a Selenium Grid for distributed Selenium testing</a></blockquote><blockquote>8. <a href="https://medium.com/edureka/selenium-using-python-edc22a44f819">Selenium Using Python</a></blockquote><blockquote>9. <a href="https://medium.com/edureka/cross-browser-testing-using-selenium-90b1911c6d60">Cross Browser Testing Using Selenium</a></blockquote><blockquote>10. <a href="https://medium.com/edureka/handle-multiple-windows-in-selenium-727ba5f8f6a7">Handle Multiple Windows in Selenium</a></blockquote><blockquote>11. <a href="https://medium.com/edureka/page-object-model-in-selenium-bc4d7c8c4203">Page Object Model In Selenium</a></blockquote><blockquote>12. <a href="https://medium.com/edureka/selenium-projects-b2df15d35fe2">Selenium Projects</a></blockquote><blockquote>13. <a href="https://medium.com/edureka/qtp-vs-selenium-338f3d3bbfa7">QTP vs Selenium</a></blockquote><blockquote>14. <a href="https://medium.com/edureka/selenium-vs-rpa-84159dbcd0f2">Selenium vs RPA</a></blockquote><blockquote>15. <a href="https://medium.com/edureka/selenium-webdriver-architecture-565e2db26dd5">Selenium WebDriver Architecture</a></blockquote><blockquote>16. <a href="https://medium.com/edureka/exceptions-in-selenium-369c38155e7d">Handling Exceptions In Selenium</a></blockquote><blockquote>17. <a href="https://medium.com/edureka/cucumber-selenium-tutorial-aefec05f4733">Perform Website Testing Using Cucumber &amp; Selenium</a></blockquote><p><em>Originally published at </em><a href="https://www.edureka.co/blog/cross-browser-testing/"><em>https://www.edureka.co</em></a><em> on April 10, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9299b04ce277" width="1" height="1" alt=""><hr><p><a href="https://medium.com/edureka/cross-browser-testing-9299b04ce277">Know How To Perform Cross Browser Testing Using LambdaTest</a> was originally published in <a href="https://medium.com/edureka">Edureka</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Locate Web Elements In Selenium Using Python?]]></title>
            <link>https://medium.com/edureka/selenium-using-python-edc22a44f819?source=rss-dd4f4acd2a2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/edc22a44f819</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[automation-testing-tool]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Neha Vaidya]]></dc:creator>
            <pubDate>Fri, 05 Apr 2019 15:39:04 GMT</pubDate>
            <atom:updated>2019-06-05T11:17:16.358Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*IPoL0D-oNCJ6CfoRdt0otg.jpeg" /><figcaption>Selenium using Python — Edureka</figcaption></figure><p>If you ask a lazy programmer which is his favorite programming language, there is a high probability that you will get “ <strong><em>Python</em></strong>” as an answer. Python is considered as one of the most popular and in-demand programming languages. As you all might be aware, Selenium is the perfect tool for Automation Testing of a web application. Hence, Python helps us to write the Selenium scripts in a much simpler way when compared to other programming languages. So I bring up this article on Selenium using Python in which I will be covering the below-mentioned topics:</p><ul><li>Introduction to Selenium</li><li>Introduction to Python</li><li>Selenium and Python Binding</li><li>Locating web elements using Python</li></ul><h3>Introduction to Selenium</h3><p><a href="https://www.edureka.co/blog/what-is-selenium?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=selenium-using-python">Selenium </a>is an open source tool which is used for automating the test cases carried out on web browsers or the web applications that are being tested using any web browser. Wait, before you get carried away, let me re-iterate that, only testing of web applications is possible with Selenium. We can neither test any desktop software application nor test any mobile application using Selenium. So it’s an open source tool which supports cross browsing and automates web applications!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*Vsu1RsPgL86LFbrOu7FL3Q.png" /></figure><p>Now moving ahead, let’s see <em>why do we need Selenium IDE for Automation Testing</em>?</p><p>As I have already mentioned — Selenium is open-source, and also there is no licensing cost involved, which is a major advantage over other testing tools. Other major reasons behind Selenium’s ever-growing popularity include their test cases, OS platform, and browser support.</p><p>These are some of the reason that keeps Selenium at the top when compared to other automation tools. Now let’s dive deeper into this article and understand what is Python?</p><h3>Introduction to Python</h3><p>Python is very simple and easy to learn. It is one of the most powerful languages and closely resembles the English language!</p><p>So, what contributes to its simplicity? Python is</p><ul><li>Free &amp; open source</li><li>High-level</li><li>Interpreted</li><li>Blessed with a large community</li></ul><p>Python also has many built-in testing frameworks that cover debugging &amp; fastest workflows. A lot of tools and modules are available to make things easier such as and <em>Splinter and Python also </em>support testing with cross-platform &amp; cross-browser with frameworks such as and Framework.</p><p>Having understood this, now let’s understand the binding between Selenium and Python.</p><h3>Selenium and Python Binding</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*CCVb6IQhA-bmQ3Nj5d74_Q.png" /></figure><p>The very first step is to write your functional tests using Selenium web driver, after that, you need to send a request to Selenium server and then test cases are executed on various browsers. It can be Google Chrome, Internet Explorer or Mozilla Firefox.</p><p>Now, in order to implement Python with Selenium, we first need to import Selenium web driver!</p><p>First, let me tell you what is Selenium web driver.</p><p>WebDriver in Selenium is a web-based <a href="https://www.edureka.co/blog/test-automation-frameworks?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=selenium-using-python">Automation Testing framework</a> which can test web pages initiated on various web browsers and various operating systems. In order to import and configure dependencies to add libraries and functionalities, you need to import Selenium WebDriver with the help of below commands.</p><pre>from selenium import webdriver <br>from selenium.webdriver.common.keys import keys <br>from selenium.import.*</pre><p>This is all about the binding between Python and Selenium. Now let’s move further and understand how to locate elements in Selenium using Python.</p><h3>Locating Web Elements using Python</h3><p>Python programming language offers various frameworks like Django, flask, etc. You can customize it with themes and plugins &amp; it also lets you enhance productivity while <strong>coding</strong> by providing some features like suggestions, Local VCS etc. You can write Selenium scripts in Python using any of the tools like Jupyter Notebook, Anaconda, and PyCharm.</p><p><strong><em>Now let’s see locators in Selenium?</em></strong></p><p>The locator is as an address that identifies a web element uniquely within the webpage. Locators are the HTML properties of a web element which tells Selenium about the element it needs to perform the action on. Selenium uses locators to interact with the web elements on the webpage.</p><p>Now, there is a diverse range of web elements like text box, id, radio button, etc and identifying these elements has always been a very tricky subject. Thus it requires an accurate and effective approach. Thereby, we can say that more effective the locator is, stabler will be the automation script. Every Selenium command requires locators to find web elements. Thus, to identify these web elements accurately and precisely, we have different types of locators, namely:</p><ul><li>ID</li><li>name</li><li>linkText</li><li>CSS selector</li><li>partiallinkText and</li><li>XPath</li></ul><p>Now let’s see a small example to understand the working of locators in Selenium using Python.</p><p>I will launch Google Chrome and navigate to <em>hotstar.com</em>. Here, I will try to locate the<em> search box</em> using <strong>ID Locator</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*mIFcNnwQaeZaJTYAbjGzSg.png" /></figure><p>On inspecting the above web element, you can see it has an input tag and attributes like class and id. Now, I will use the value of Id locator i.e.<strong> search-field</strong> to locate the search box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*6g3Pynma_d-_g0-tGLdirQ.png" /></figure><p>Let’s see how to automate the search box and send values to it using Id locator.</p><pre>from selenium import webdriver<br>driver = webdriver.Chrome(&quot;C:\\Users\\Neha_Vaidya\\eclipse-workspace\\Selenium\\chromedriver_win32\\chromedriver.exe&quot;)<br>driver.get(&quot;<a href="https://www.hotstar.com/">https://www.hotstar.com</a>&quot;)<br>driver.find_element_by_id(&quot;searchField&quot;).send_keys(&quot;Movies&quot;)</pre><p>When you run the above code, <strong><em>chrome driver</em></strong> will launch Google Chrome, redirect to Hotstar, enter the value as ‘Movies’ in the search box.</p><p>I hope this gives you a clear understanding of how Id locator in Selenium works. Now let’s move further and understand how to use name locator.</p><p>Now suppose if you wish to Google Search an element automatically, let’s see how to do that with the help of name locator. Initially, I will inspect Google Search box and retrieve the value of name attribute i.e. ‘q’. Next step is to send values to the search box. Once you send the values to search, it will give you an automated search of Selenium. You can have a look at the below code for the same in Python.</p><pre>from selenium import webdriver<br>driver = webdriver.Chrome(&quot;C:\\Users\\Neha_Vaidya\\eclipse-workspace\\Selenium\\chromedriver_win32\\chromedriver.exe&quot;) <br>driver.get(&quot;<a href="https://www.google.com/">https://www.google.com</a>&quot;)<br>driver.find_element_by_name(&quot;q&quot;).send_keys(&quot;Selenium&quot;)<br>driver.find_element_by_name(&quot;btnK&quot;).click()</pre><p>So, basically, this is how it works. Now let’s have a look at the generalized code for locating elements using XPath.</p><pre>from selenium import webdriver<br>driver = webdriver.Chrome(&quot;C:\\Users\\Neha_Vaidya\\eclipse-workspace\\Selenium\\chromedriver_win32\\chromedriver.exe&quot;)<br>driver.get(&quot;<a href="https://www.hotstar.com/">https://www.hotstar.com</a>&quot;)<br>driver.find_element_by_xpath(&quot;//div[<a href="http://twitter.com/class">@class</a>=&#39;signIn displayElement&#39;]&quot;).click()   # Click on login icon<br>driver.find_element_by_xpath(&quot;//input[<a href="http://twitter.com/name">@name</a>=&#39;email&#39;]&quot;).send_keys(&quot;<a href="/service/mailto:xyz@edureka.co">xyz@edureka.co</a>&quot;) # Entering email address<br>driver.find_element_by_name(&quot;password&quot;).send_keys(&quot;edureka123&quot;)    #Entering the given password<br>driver.find_element_by_xpath(&quot;//button[<a href="http://twitter.com/type">@type</a>=&#39;submit&#39;]&quot;).click()      #Clicking submit button to login</pre><p>The above code depicts the login for hotstar.com. First, using through hotstar.com. So every step of login procedure is carried out with the help of XPath locator. This is how it works. If you wish to learn XPath and its fundamentals in depth, you can read this article on XPath I will click on the login icon, then enter email address and password. After that again using XPath I will click on submit button to login XPath in Selenium.</p><p>With this, we come to an end of this article on Selenium using <a href="https://www.edureka.co/blog/10-reasons-why-you-should-learn-python?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=selenium-using-python">Python</a>. I hope it helped you and added value to your knowledge.</p><p>If you wish to check out more articles on the market’s most trending technologies like Artificial Intelligence, DevOps, Ethical Hacking, then you can refer to <a href="https://www.edureka.co/blog/?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=selenium-using-python">Edureka’s official site.</a></p><p>Do look out for other articles in this series which will explain the various other aspects of Selenium.</p><blockquote>1. <a href="https://medium.com/edureka/selenium-tutorial-77879a1d9af1">Selenium Tutorial</a></blockquote><blockquote>2. <a href="https://medium.com/edureka/selenium-webdriver-tutorial-e3e6219f21ad">Selenium WebDriver: TestNG For Test Case Management &amp; Report Generation</a></blockquote><blockquote>3. <a href="https://medium.com/edureka/selenium-framework-data-keyword-hybrid-frameworks-ea8d4f4ce99f">Building A Data Driven, Keyword Driven &amp; Hybrid Selenium Framework</a></blockquote><blockquote>4.<a href="https://medium.com/edureka/locators-in-selenium-f6e6b282aed8"> Locators in Selenium</a></blockquote><blockquote>5. <a href="https://medium.com/edureka/xpath-in-selenium-cd659373e01a">XPath Tutorial</a></blockquote><blockquote>6. <a href="https://medium.com/edureka/waits-in-selenium-5b57b56f5e5a">Waits in Selenium</a></blockquote><blockquote>7. <a href="https://medium.com/edureka/selenium-grid-tutorial-ef342799c484">Setting up a Selenium Grid for distributed Selenium testing</a></blockquote><blockquote>8. <a href="https://medium.com/edureka/cross-browser-testing-9299b04ce277">Cross Browser Testing Using LambdaTest</a></blockquote><blockquote>9. <a href="https://medium.com/edureka/cross-browser-testing-using-selenium-90b1911c6d60">Cross Browser Testing Using Selenium</a></blockquote><blockquote>10. <a href="https://medium.com/edureka/handle-multiple-windows-in-selenium-727ba5f8f6a7">Handle Multiple Windows in Selenium</a></blockquote><blockquote>11. <a href="https://medium.com/edureka/page-object-model-in-selenium-bc4d7c8c4203">Page Object Model In Selenium</a></blockquote><blockquote>12. <a href="https://medium.com/edureka/selenium-projects-b2df15d35fe2">Selenium Projects</a></blockquote><blockquote>13. <a href="https://medium.com/edureka/qtp-vs-selenium-338f3d3bbfa7">QTP vs Selenium</a></blockquote><blockquote>14. <a href="https://medium.com/edureka/selenium-vs-rpa-84159dbcd0f2">Selenium vs RPA</a></blockquote><blockquote>15. <a href="https://medium.com/edureka/selenium-webdriver-architecture-565e2db26dd5">Selenium WebDriver Architecture</a></blockquote><blockquote>16. <a href="https://medium.com/edureka/exceptions-in-selenium-369c38155e7d">Handling Exceptions In Selenium</a></blockquote><blockquote>17. <a href="https://medium.com/edureka/cucumber-selenium-tutorial-aefec05f4733">Perform Website Testing Using Cucumber &amp; Selenium</a></blockquote><p><em>Originally published at </em><a href="https://www.edureka.co/blog/selenium-using-python/"><em>https://www.edureka.co</em></a><em> on April 5, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=edc22a44f819" width="1" height="1" alt=""><hr><p><a href="https://medium.com/edureka/selenium-using-python-edc22a44f819">How To Locate Web Elements In Selenium Using Python?</a> was originally published in <a href="https://medium.com/edureka">Edureka</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[QTP vs Selenium — Battle Between The Automation Testing Giants]]></title>
            <link>https://medium.com/edureka/qtp-vs-selenium-338f3d3bbfa7?source=rss-dd4f4acd2a2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/338f3d3bbfa7</guid>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[automation-testing-tool]]></category>
            <category><![CDATA[qtp]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[software-testing-tools]]></category>
            <dc:creator><![CDATA[Neha Vaidya]]></dc:creator>
            <pubDate>Thu, 04 Apr 2019 14:38:35 GMT</pubDate>
            <atom:updated>2019-06-05T11:15:17.853Z</atom:updated>
            <content:encoded><![CDATA[<h3>QTP vs Selenium - Battle Between The Automation Testing Giants</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*66K5rKa5gnuhTkCphkA3Wg.jpeg" /><figcaption>Selenium vs QTP</figcaption></figure><p>Software Testing is one of the mainstreams in the recent past. Testing the system against all odds make the entire process easier. So, the market for software testing is mainly dominated by powerful and dynamic tools like Selenium, QTP and many more. So, in this QTP vs Selenium article, we’ll be discussing the major differences between the two automation testing tools.</p><p>But before we compare QTP and Selenium, let’s take a look at the topics we’ll be covering in this article</p><ul><li>What is QTP/UFT?</li><li>What is Selenium?</li><li>Advantages of these tools over each other</li><li>What are the differences between them?</li><li>Conclusion</li></ul><p>Before we see what is QTP, we’ll understand the history of QTP.</p><p>QTP is an acronym for Quick Test Professional which was originally developed by Mercury Interactive and was later acquired by HP (Hewlett Packard), and they called it UFT (Unified Functional Testing). This UFT was combined with the HP QTP and HP Service Test into a single software package which was apparently available till 2016 until the whole division was sold to Microfocus.</p><p>So, let’s first learn about QTP and understand its functionalities.</p><h3>What is QTP?</h3><p>QTP is an automation testing tool that helps testers to perform automated <a href="https://www.edureka.co/blog/what-is-functional-testing?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=qtp-vs-selenium">functional testing</a> seamlessly, without monitoring the system in intervals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/1*GbYHLXs-kG6etAUlC1j4YQ.png" /></figure><ul><li>QTP/UFT is basically designed to test various software applications and their environment.</li><li>It is licensed and the cost of this tool is very high.</li><li>QTP is used to test UI-based test-cases and can even automate non-UI test cases such as file operations, database testing and so on.</li><li>The user needs to have the knowledge of VBScript to run test cases.</li><li>This Scripting engine installation is not required explicitly as it is available as a part of the Windows OS.</li><li>QTP works only on the Windows platform and cannot work across other browsers like Chrome, Firefox and so on.</li><li>It also helps in providing quality assurance to the software under test.</li><li>It is easy to use because of its ease of navigation, result validation, and generation of reports.</li></ul><p>Now, let’s understand about Selenium.</p><h3>What is Selenium?</h3><p>Selenium is an automation tool used to test web applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*mg4Lq3JfeJw8fY5wKbH5NA.png" /></figure><ul><li>Selenium is an open source portable framework used to automate testing of web applications.</li><li>It is highly flexible when it comes to testing functional and regression test cases.</li><li>Test scripts in Selenium can be written in different programming languages like Java, Python, C# and many more.</li><li>These test scripts can run across various browsers like Chrome, Safari, Firefox, Opera and also provides support across various platforms like Windows, Mac OS, Linux, Solaris.</li><li>Selenium also supports cross browsing where the test cases run across various platforms simultaneously</li><li>Helps in creating robust, browser-based regression automation suites and perform tests.</li><li>Elements on a web page can be easily found using the <strong><em>element locators</em></strong> like name, <strong><em>XPath</em></strong>, class,<strong><em>CSS selector</em></strong> and so on.</li><li>Selenium can be integrated with tools such as TestNG &amp; JUnit for managing test cases and generating reports.</li><li>It can also be integrated with tools like Maven, <strong><em>Jenkins </em></strong>&amp; <strong><em>Docker</em></strong> to achieve Continuous Testing.</li></ul><h3>Advantages of these tools over each other</h3><p>We’ll first see the advantages of Selenium over QTP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*JRc1h8cfQk0n3dEHZsilmA.png" /></figure><ul><li>QTP is licensed and the license cost is way too high.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*ytnyxPdZoMiBaO32Of8OHg.png" /></figure><ul><li>It supports only VBScript programming language and the test scripts cannot be written in any other languages.</li><li>These test scripts run only on windows environment and do not provide support across all the browsers.</li><li>QTP does not support different IDEs. It works only on QTP developed IDE.</li><li>It allows only limited add-ons to the process.</li><li>It can also execute parallel testing like Selenium but only using Quality Centre, which is again a paid product by HP.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*njB9Nxc8VZO_r86m_RhM-w.png" /></figure><p>Now, let’s see what are the advantages of QTP over Selenium</p><ul><li>QTP can test web, mobile, and desktop applications.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*qe_eQAcaDQntKqLJdKPRyg.png" /></figure><ul><li>It has its own in-built object repository that helps in organizing the data in the application.</li><li>The rate of automation is fast compared to that of Selenium.</li><li>QTP can also handle controls within a browser like a favorite bar, address bar, back, and forward buttons, etc.</li><li>It also provides enterprise support if the user faces some issue.</li><li>Test reports are automatically generated.</li></ul><h3>What are the differences between QTP and Selenium?</h3><p>QTP and Selenium are the two predominantly used automation testing tools which are widely used by all software testers.</p><p>We’ll compare these tools based on certain parameters -</p><ul><li>License</li><li>Flexibility</li><li>Programming language</li><li>IDE basis</li><li>Repository</li><li>Environment</li></ul><p>We’ll first start comparing them based on their license.</p><p><strong>License: </strong>QTP is licensed and the cost is way too high and the user has to pay for all the versions of this tool whereas Selenium is an open source tool and the user does not have to pay for any of the versions of this tool.</p><p><strong>Flexibility: </strong>QTP is not very flexible when it comes to executing the test cases across different platforms. It mainly supports Windows and executes the tests there. It also tests Web, Mobile, and desktop applications whereas Selenium is highly flexible because the test cases can run across different platforms like Chrome, Firefox, IE and so on. It can only test web applications and cannot test mobile or desktop applications.</p><p><strong>Programming language: </strong>QTP test scripts are written only in VBScript which is an active scripting language developed by Microsoft and the test scripts cannot be written in any simple programming language whereas Selenium test scripts are written in the simple user-friendly programming languages like Java, Python, C#, Scala, Ruby and so on but the most commonly used language among these is Java.</p><p><strong>IDE basis: </strong>QTP test cases only work on QTP developed environment and not on any other IDEs apart from this whereas Selenium test scripts are integrated and run across different IDEs like Eclipse, NetBeans, .Net and so on.</p><p><strong>Repository: </strong>QTP has an inbuilt object repository which is a common storage location for all objects, and is a collection of all the objects and its properties with which QTP will be able to recognize them and act on it whereas Selenium does not have any inbuilt repository as it uses the web elements in the user interface to test the applications.</p><p><strong>Environment: </strong>QTP supports different environments like SAP, Oracle, and so on and it does not support additional plugins to the software whereas Selenium supports all additional plugins alongside its features.</p><p>So, these are the major differences between the two most predominantly used testing giants, QTP and Selenium.</p><h3>Conclusion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*666NsTEzhMWwq4bdnAv3tA.png" /></figure><p>Each tool has its own pros and cons. It completely depends on the user as to what he wants to test and how he wants to carry out certain operations. These tools have advantages and disadvantages over each other. Selenium is ahead of QTP based on certain parameters and also QTP is ahead of Selenium, based on a different set of parameters.</p><p>If you wish to check out more articles on the market’s most trending technologies like Artificial Intelligence, DevOps, Ethical Hacking, then you can refer to <a href="https://www.edureka.co/blog/?utm_source=medium&amp;utm_medium=content-link&amp;utm_campaign=qtp-vs-selenium">Edureka’s official site.</a></p><p>Do look out for other articles in this series which will explain the various other aspects of Selenium.</p><blockquote>1. <a href="https://medium.com/edureka/selenium-tutorial-77879a1d9af1">Selenium Tutorial</a></blockquote><blockquote>2. <a href="https://medium.com/edureka/selenium-webdriver-tutorial-e3e6219f21ad">Selenium WebDriver: TestNG For Test Case Management &amp; Report Generation</a></blockquote><blockquote>3. <a href="https://medium.com/edureka/selenium-framework-data-keyword-hybrid-frameworks-ea8d4f4ce99f">Building A Data Driven, Keyword Driven &amp; Hybrid Selenium Framework</a></blockquote><blockquote>4.<a href="https://medium.com/edureka/locators-in-selenium-f6e6b282aed8"> Locators in Selenium</a></blockquote><blockquote>5. <a href="https://medium.com/edureka/xpath-in-selenium-cd659373e01a">XPath Tutorial</a></blockquote><blockquote>6. <a href="https://medium.com/edureka/waits-in-selenium-5b57b56f5e5a">Waits in Selenium</a></blockquote><blockquote>7. <a href="https://medium.com/edureka/selenium-grid-tutorial-ef342799c484">Setting up a Selenium Grid for distributed Selenium testing</a></blockquote><blockquote>8. <a href="https://medium.com/edureka/selenium-using-python-edc22a44f819">Selenium Using Python</a></blockquote><blockquote>9. <a href="https://medium.com/edureka/cross-browser-testing-9299b04ce277">Cross Browser Testing Using LambdaTest</a></blockquote><blockquote>10. <a href="https://medium.com/edureka/cross-browser-testing-using-selenium-90b1911c6d60">Cross Browser Testing Using Selenium</a></blockquote><blockquote>11. <a href="https://medium.com/edureka/handle-multiple-windows-in-selenium-727ba5f8f6a7">Handle Multiple Windows in Selenium</a></blockquote><blockquote>12. <a href="https://medium.com/edureka/page-object-model-in-selenium-bc4d7c8c4203">Page Object Model In Selenium</a></blockquote><blockquote>13. <a href="https://medium.com/edureka/selenium-projects-b2df15d35fe2">Selenium Projects</a></blockquote><blockquote>14. <a href="https://medium.com/edureka/selenium-vs-rpa-84159dbcd0f2">Selenium vs RPA</a></blockquote><blockquote>15. <a href="https://medium.com/edureka/selenium-webdriver-architecture-565e2db26dd5">Selenium WebDriver Architecture</a></blockquote><blockquote>16. <a href="https://medium.com/edureka/exceptions-in-selenium-369c38155e7d">Handling Exceptions In Selenium</a></blockquote><blockquote>17. <a href="https://medium.com/edureka/cucumber-selenium-tutorial-aefec05f4733">Perform Website Testing Using Cucumber &amp; Selenium</a></blockquote><p><em>Originally published at </em><a href="https://www.edureka.co/blog/qtp-vs-selenium/"><em>https://www.edureka.co</em></a><em> on April 4, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=338f3d3bbfa7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/edureka/qtp-vs-selenium-338f3d3bbfa7">QTP vs Selenium — Battle Between The Automation Testing Giants</a> was originally published in <a href="https://medium.com/edureka">Edureka</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>