Tuesday, January 28, 2014

Selenium Testing Complete Tutorials

Well, here I am going to start working on Selenium complete tutorial which will help you a lot for learning and facing the interview.

    Hope this blog will provide you the complete knowledge for free of cost. I will  cover almost all the concepts and Topics in that.

    This is the best time learn selenium testing. i want to tell you for fresher who doesn't aware of this software tool.

    This tool is easy to learn and hard to practice. Because there are few topics which you need to learn before going to learn this tool. Learning this tool is not a matter of fact, practicing will make you perfect in this tool.

They are:
a. Manual testing.
b. Core java (OOPs).
c. XML basics.
d. CSS.
e. HTML.
f. Java Script... Etc

Day 1 :
Actually what is Selenium and where it was invented and how it was developed? We should know about the history of Selenium Tool.
      The Day1 is totally consisting with Selenium history. One more i am not writing my own knowledge. i have acquired knowledge form different sources and collected materials. i have referred famous selenium books and materials which are written by experts. So no need to worry about to learn in my site. You will get complete knowledge if read this. this is non stopping site to update new things which will come in selenium tool. i will keep on updating new things which helps you a lot. 

History of Selenium : 
         Selenium was originally developed by "Jason Huggins" in 2004. Who was later joined by other programmers and testers at "Thought Works". 
      It is completely Open source Software, released under the Apache 2.0 license, and can be downloaded and used without charge.

        The Selenium name comes from a joke made by Huggins in an email, mocking a competitor named mercury, saying that you can cure mercury poising by taking Selenium supplements. The others that received the email took the name and ran with it.

        The latest side project is selenium Grid, which provides a hub allowing the running of multiple Selenium tests concurrently on any number of logical or remote systems, thus minimizing test execution time.



Selenium components:

Selenium IDE :

Selenium IDE is a complete integrated development environment (IDE) for Selenium tests. It is implemented as a Firefox Add-On, and allows recording, editing, and debugging tests. It was previously known as Selenium Recorder. Selenium-IDE was originally created by Shinya Kasatani and donated to the Selenium project in 2006.[citation needed]
Scripts may be automatically recorded and edited manually providing autocompletion support and the ability to move commands around quickly. Scripts are recorded in Selenese, a special test scripting language for Selenium. Selenese provides commands for performing actions in a browser (click a link, select an option), and for retrieving data from the resulting pages.

Selenium Client API:

As an alternative to writing tests in Selenese, tests can also be written in various programming languages. These tests then communicate with Selenium by calling methods in the Selenium Client API. Selenium currently provides client APIs for Java, C#, Ruby and Python.
With Selenium 2, a new Client API was introduced (with WebDriver as its central component). However, the old API (using class Selenium) is still supported.

Selenium Remote Control:

Selenium Remote Control (RC) is a server, written in Java, that accepts commands for the browser via HTTP. RC makes it possible to write automated tests for a web application in any programming language, which allows for better integration of Selenium in existing unit test frameworks. To make writing tests easier, Selenium project currently provides client drivers for PHP, Python, Ruby, .NET, Perl and Java. The Java driver can also be used with JavaScript (via the Rhino engine). A new instance of selenium RC server is needed to launch html test case - which means that the port should be different for each parallel run.[citation needed] However, for Java/PHP test case only one Selenium RC instance needs to be running continuously.[citation needed].

Selenium Remote Control was a refactoring of Driven Selenium or Selenium B designed by Paul Hammant, credited with Jason as co-creator of Selenium. The original version directly launched a process for the browser in question, from the test language of Java, .Net, Python or Ruby. The wire protocol (called 'Selenese' in its day) was reimplemented in each language port. After the refactor by Dan Fabulich, and Nelson Sproul (with help from Pat Lightbody) there was an intermediate daemon process between the driving test script, and the browser. The benefits included the ability to drive remote browsers, and the reduced need to port every line of code to an increasingly growing set of languages. Selenium Remote Control completely took over from the Driven Selenium code-line in 2006. The browser pattern for 'Driven'/'B' and 'RC' was response/request, which subsequently became known as Comet.

Selenium Web Driver:

Selenium WebDriver is the successor to Selenium RC. Selenium WebDriver accepts commands (sent in Selenese, or via a Client API) and sends them to a browser. This is implemented through a browser-specific browser driver, which sends commands to a browser, and retrieves results. Most browser drivers actually launch and access a browser application (such as Firefox or Internet Explorer); there is also an HtmlUnit browser driver, which simulates a browser using HtmlUnit.
Unlike in Selenium 1, where the Selenium server was necessary to run tests, Selenium WebDriver does not need a special server to execute tests. Instead, the WebDriver directly starts a browser instance and controls it. However, Selenium Grid can be used with WebDriver to execute tests on remote systems (see below).
In practice, this means that the Selenium 2.0 API has significantly fewer calls than does the Selenium 1.0 API. Where Selenium 1.0 attempted to provide a rich interface for many different browser operations, Selenium 2.0 aims to provide a basic set of building blocks from which developers can create their own Domain Specific Language. One such DSL already exists: the Watir project in the Ruby language has a rich history of good design. Watir-webdriver implements the Watir API as a wrapper for Selenium-Webdriver in Ruby. Watir-webdriver is created entirely automatically, based on the WebDriver specification and the HTML specification.
As of early 2012, Simon Stewart (inventor of WebDriver), who was then with Google and now with Facebook, and David Burns of Mozilla were negotiating with the W3C to make WebDriver an internet standard. In early 2013, the working draft was released.[3] As such, Selenium-Webdriver (Selenium 2.0) aims to be the reference implementation of the WebDriver standard in various programming languages. Currently Selenium-WebDriver is fully implemented and supported in Python, Ruby, Java, and C#.

Selenium Grid:

Selenium Grid is a server that allows tests to use web browser instances running on remote machines. With Selenium Grid, one server acts as the hub. Tests contact the hub to obtain access to browser instances. The hub has a list of servers that provide access to browser instances (WebDriver nodes), and lets tests use these instances. Selenium Grid allows running tests in parallel on multiple machines, and to manage different browser versions and browser configurations centrally (instead of in each individual test).

------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
   
           Now we are going to start with Selenium IDE. So we are in Selenium right now. The rest of the topics Java,HTML,XML and CSS will learn after Selenium IDE.

      My first question goes to
1. What is Selenium IDE ? How to use it?
ans: Selenium IDE is Selenium Integrated Development Environment which
is a plug in to Firefox browser.
points to remember: 
A. It is add on or plug in to Firefox browser.
B. It will support to only Fire fox browser.
C. It is Recording and play back tool.
D. it will support only HTML scripting language. but we can export the HTML script into other languages like.
* Java, c#, Ruby and Python in RC and web driver using TestNg and Junit.

(You may not understand what is RC , web driver and TestNg kind of words mentioned above. Don't worry . will learn step by step. just remember.)

E. We can edit or Delete the test case in middle in the HTML script.

Selenium IDE is a fully-featured Integrated Development Environment (IDE) that installs as a plugin in Mozilla Firefox and enables developers to test their web applications through Selenium. With the Selenium IDE, you can record user interactions with the web browser and play them back to test for errors. It’s a powerful, robust IDE that radically simplifies and automates the QA testing process.
In this tutorial, we’ll learn the basics of the Selenium IDE, how to use it, and what you can use it for. To learn more about software and web application testing, check out this course on Selenium IDE and WebDriver.

What is Selenium IDE?

Selenium is a web application testing software developed by Jason Huggins in 2004. It’s an open-source software that works on all three major platforms – Windows, Mac and Linux. Selenium supports a wide range of languages, including, but not limited to, Java, Python, Ruby, Perl, C# and PHP. The best part? Selenium enables you to test web applications with zero knowledge of any test scripting language.
This brings us to Selenium IDE. As mentioned above, the Selenium IDE is a Firefox plugin that makes it possible to record, edit and debug tests. It was developed independently of the Selenium project by Shinya Kasatani and was merged with the former in 2006. It was previously known as the Selenium Recorder; don’t be surprised if you stumble upon old tutorials mentioning it by that name!

How to Use Selenium IDE?

The Selenium IDE is currently available only on Firefox. Chrome users might want to look at alternatives like iMacros, Sahi and Scirocco.
First of all, install Selenium IDE in Firefox by grabbing a copy of the software from the Selenium HQ. It’ll install as a set of 5 extensions with separate formatters for Python, Ruby, etc. (language formatters are optional; install formatters only for languages you want to use). Once installed, restart Firefox. If you now go to the main Firefox options menu -> Add Ons -> Extensions, you should see Selenium IDE along with language formatters for Ruby, Python, C# and Java.

Installation Process: 
 --> Open the Firefox browser any version.
--> Go to Add on -Manager .
--> Type Selenium IDE in Search field and press enter.
--> You will get an tool with Pencil symbol Selenium IDE with install button.
--> Click on install button and restart the fire fox browser and go to 
---> Tools menu and Find the Selenium IDE.











Using Selenium
To use the Selenium IDE, go to Firefox -> Web Developer -> Selenium IDE.

or 

You are now ready to use Selenium. Below, we’ll learn how to record and play back actions using Selenium.
Alternatively, press CTRL + ALT + S to open the Selenium IDE window.
Let’s take a closer look at the Selenium IDE window:
  • The left pane lists all the open test cases.
  • The ‘Base URL’ shows the URL the test is being performed on.
  • The ‘Table’ pane will show a list of actions recorded as part of the test. You can see how this works in the example below.
  • The ‘Fast-Slow’ slider dictates how fast/slow playback for the recorded test should be.
  • The ‘Play’ button plays back the test.
  • The big red button at the rightmost edge is the ‘Record’ toggle switch. Switch it on to record interactions on any website.
  • The bottom pane shows a log of actions and a reference list.
There are a number of other options – Selenium IDE is a fairly powerful tool, after all – but for now, we only need to be concerned with the options listed above.
New to software testing? Learn the basics of technical web testing in this course!
Creating a Simple Test in Selenium IDE
For the purpose of this tutorial, we will create a simple test that will enter a particular query into Google. In essence, this will be more like a macro than an actual ‘test’, but it will demonstrate the power of automated testing using Selenium IDE.
Step 1: Create a new test case by going to File -> New Test Case.


A new untitled test should show up in the test case pane to the left.

Step 2: We are now going to record our test. To do this, hit the red record switch to the right.
Now, perform the following actions in sequence:
1. Type in Google.com into your Firefox address bar:

2. On the Google.com homepage, search for any query. For this example, we used the query ‘automated testing.
3. Once the results page opens, stop the test by clicking the red toggle switch.
Step 3: Now that we’ve recorded the test, let’s play it back.
This is what your ‘Table’ pane should look like now:

Click on the ‘Play current test case’ button.
This will automatically open Google.com, type in ‘automated testing’ into the query field, and display the search results.
If you take a closer look at the two commands in the Table pane, you’ll see that you can not only change the command, but also alter the values associated with it.
For example, the first command is ‘open’. You can change this to anything else – Selenium IDE offers a huge list of built-in commands. You can also change the ‘Target’ url to anything that you like.
The next command is ‘type’. This basically instructs Selenium to type-in the desired query into the search bar. You can change the query to anything you want by changing the ‘value’.
For example, if you change it to ‘red and orange widgets’, Selenium IDE will automatically query ‘red and orange widgets’ into Google.
This is one of the most basic examples of what Selenium IDE can do. By combining different commands, you can make the IDE run complex tasks and test for bugs automatically.

Using Selenium IDE Contextual Menu

Besides the Selenium IDE window, the plugin also installs a contextual menu into Firefox that can be accessed by pressing the right mouse button.
Let’s see an example of how it works:
Like the previous example, create a new test case and hit ‘record’. Then go to Google.com, type in a query (‘automated testing’) and wait for the search results page to load.
After the results page opens, right click on the main search field on Google. A contextual menu will pop up with a list of actions you can perform.
At the bottom of the menu, you’ll see a ‘verifyValue’ option. If you select this option, Selenium will make sure that there is always a value present in the search bar – a simple test.
You can also see a list of all available commands on the same menu. This will give you a huge list of commands to choose from like ‘verifyTitle’, ‘verifyValue’, ‘open’, ‘storeTitle’, etc.
Using these different options, you can create automated tests to check different elements in a web app. For this example, if you stop the recording and play back the test, Selenium IDE will first open Google.com, type in the desired query, and finally, verify that the query has been entered into the search bar.
Selenium IDE is a very powerful tool for making QA tests. You can combine different commands, use the contextual menu, and even create your own commands through Selenium.
To learn more about Selenium and automated testing, check out this course onweb application testing with Selenium.



         








10 comments:

  1. Hi, Thank you for this informative blog, I am doing course on selenium testing online and this blog is really informative for me. Thank you for this blog!

    ReplyDelete
  2. This post is so helpful.Keep updating with more information...
    RPA Course
    RPA

    ReplyDelete
  3. Thank you for precious information, Contact us today to learn about Selenium automation software testing and how it can benefit your team today! some helpful tips as to how users can prevent.

    ReplyDelete
  4. International Nursing Recruitment Agencies in the USA are pivotal in addressing healthcare workforce shortages by recruiting skilled nurses from abroad. These agencies streamline the recruitment process, from candidate screening to placement, ensuring a seamless transition. They offer expertise in navigating the complex immigration and licensing frameworks essential for international hires. Furthermore, they provide cultural orientation and relocation support to ease nurses into their new environment. By maintaining ethical recruitment practices, they guarantee fair opportunities for candidates. These agencies forge strategic alliances with healthcare institutions, bolstering patient care standards through staffing solutions. Their efforts significantly enhance the diversity and proficiency of the nursing workforce in the US.
    https://www.dynamichealthstaff.com/international-nursing-recruitment-agencies-in-usa

    ReplyDelete

TestNG - Can i use the 2 different data providers to same @test methods in TestNG?

public Object [][] dp1 () { return new Object [][] { new Object [] { "a" , "b" }, new Obje...