<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><!-- generator="FeedCreator 1.8.1 (obRSS 1.8.11)" --><rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
    <channel>
        <title>Guru99</title>
        <description><![CDATA[Best resource on Software Testing on Planet! Free Video Tutorials on Software Testing , Loadrunner , QTP , Quality Center]]></description>
        <link>http://www.guru99.com/</link>
        <lastBuildDate>Sat, 25 May 2013 16:09:27 GMT</lastBuildDate>
        <generator>FeedCreator 1.8.1 (obRSS 1.8.11)</generator>
        <image>
            <url>http://www.guru99.com/images/</url>
            <title>Guru99</title>
            <link>http://www.guru99.com/</link>
            <description>Best resource on Software Testing on Planet! Free Video Tutorials on Software Testing , Loadrunner , QTP , Quality Center</description>
        </image>
        <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Guru99" /><feedburner:info uri="guru99" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>Guru99</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
            <title>A discussion on automation testing with respect to agile methodology.</title>
            <link>http://feedproxy.google.com/~r/Guru99/~3/lrUnzqRNUA0/a-discussion-on-automation-testing-with-respect-to-agile-methodology.html</link>
            <description>&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;table style="font-size: 11.818181991577148px; line-height: 14.545454025268555px; "&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;/td&gt;
			&lt;td&gt;
				&lt;p&gt;
					&lt;em&gt;This post in contributed by Debanjan Banarjee who is an automation expert&lt;/em&gt;&lt;/p&gt;
				&lt;p&gt;
					In the last few years, ever since the agile methodology came on board with its founders shouting and willing to do away with the mundane and laborious realities of the traditional waterfall model, the impact of the same can be also felt when it comes to automation testing.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p style="font-size: 11.818181991577148px; line-height: 14.545454025268555px; "&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/agile1(1).jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;In the realm of the traditional process of software testing life cycle, automation testing is normally feasible when the application is stable, steady and the requirement is involving with a real considerable amount of time and in most cases involving a set of very skillful automation expert resources as well as a considerable amount of set-up costs. The basic purpose of automation testing is to reduce costs over long time and to ensure no new defects have been introduced as a result of existing test cases.&lt;/p&gt;
&lt;p&gt;
	Automation testing by the very nature of the technology is not exploratory in nature since the main role of automation testing is saving time and reducing costs. Automation testing is not meant to come up with new and innovative defects. Automation testing aims at mostly conformation of the already existing.&lt;/p&gt;
&lt;p&gt;
	Now by its very definition agile methodology talks about doing away with laborious and tedious documentation so that new and innovative ideas could be implemented and people could interact freely with each other so that more of these innovative and explorative ideas could be implemented.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/agile2.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	Thus we could see a contradiction between the basic fundamental philosophies of agile methodologies and automation testing.&lt;/p&gt;
&lt;p&gt;
	So we need to consider certain fundamental points here when it comes to evaluating the use of agile methodologies with respect to the automation testing methods and techniques. Thus we need to consider some fundamental points like time taken for design and coding, validation of the designed scripts with the existing test data and then adoption of the same for testing (whether the tests are of functional or regression purposes) So the real fact of all these events is that in order to perform all these facts, we need to ensure that a considerable amount of time is required for these tasks and in an agile environment where an average sprint takes an average 1-2 weeks to complete and thus it is obviously too difficult to contemplate affording so much time for automating scripts in such an way.&lt;/p&gt;
&lt;p&gt;
	Another significant factor remains here that the type of changes in requirements which come into picture when agile methodology is at play. Agile methodology by it&amp;rsquo;s own very definition is a sort of technique which is very helpful for responding to quick customer induced change requirements and which thus lends itself well to frequent changes during the overall development of the application.&lt;/p&gt;
&lt;p&gt;
	In contrast automation testing is very useful when it comes to the more stable and less frequent types of requirements. Thus by definition automation testing does not lend itself well to various types of frequent changes in requirements which comes alongside the adoption of any agile methodologies.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/agile3.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	The selection of relevant automation tool is also a potentially very important factor when it comes to the adoption of automation testing within the scope of an overall agile methodology. Licensed automation tools for example impose strict security access criterion to different types and levels of users when it comes &amp;nbsp;accessing various important resources belonging to that particular testing automation framework.&lt;/p&gt;
&lt;p&gt;
	In contrast agile methodology emphasizes upon mostly open collaboration and open ended interaction between team members and thus restrictive policies which directly affects how the users would have a negative impact in the overall cohesion within the team and thus may be leading into results which are neither very helpful nor very conducive to the overall success of the project.&lt;/p&gt;
&lt;p&gt;
	Therefore the primary importance of the process should be to ensure that in order to obtain the quality delivery of automation test scripts within a stipulated time as afforded by agile methodology; we need to choose our prospective test cases which would be automated in a more nuanced way such that these automated test scripts lend themselves well for future re-use as well as ensuring that they can be prepared within the proper duration of the allotted time (as required during the agile methodology process).&lt;/p&gt;
&lt;p&gt;
	After consideration of all the above factors we thus can realize that even while adopting agile methodologies, we need to bring into picture the types of tests like for example regression tests (since even during agile testing there is a considerable amount of testing work which is required to put into the job of agile methodologies for ensuring better quality of the overall product)&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	Now let us look at the most basic situations whereby automation testing can be used and how we can adopt the same towards the realm of agile testing.&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p style="font-size: 11.818181991577148px; line-height: 14.545454025268555px; text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/agile4.png" /&gt;&lt;/p&gt;
&lt;p style="font-size: 11.818181991577148px; line-height: 14.545454025268555px; "&gt;
	&lt;/p&gt;
&lt;p style="font-size: 11.818181991577148px; line-height: 14.545454025268555px; "&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p style="font-size: 11.818181991577148px; line-height: 14.545454025268555px; "&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p style="font-size: 11.818181991577148px; line-height: 14.545454025268555px; "&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Guru99?a=lrUnzqRNUA0:yyMx6xI73Hw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Guru99?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Guru99/~4/lrUnzqRNUA0" height="1" width="1"/&gt;</description>
            <author>sanjay</author>
            <pubDate>2013-05-13T10:55:38+00:00</pubDate>
            <guid isPermaLink="false">http://www.guru99.com/a-discussion-on-automation-testing-with-respect-to-agile-methodology.html</guid>
        <feedburner:origLink>http://www.guru99.com/a-discussion-on-automation-testing-with-respect-to-agile-methodology.html</feedburner:origLink></item>
        <item>
            <title>Complete Web Application Testing Checklist</title>
            <link>http://feedproxy.google.com/~r/Guru99/~3/Y9_SJvaExvE/complete-web-application-testing-checklist.html</link>
            <description>&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;table&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;/td&gt;
			&lt;td&gt;
				&lt;p&gt;
					&lt;em&gt;This post in contributed by Pradeep Agya. Pradeep is a QA Lead in a leading MNC&lt;/em&gt;&lt;/p&gt;
				&lt;p&gt;
					While testing the web applications, one should consider the below mentioned checklist. The below mentioned checklist is almost applicable for all types of web applications depending on the business requirements.&lt;/p&gt;
				&lt;p&gt;
					&lt;u&gt;The web application checklist consists of&lt;/u&gt;: -&lt;/p&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Usability Testing&lt;/li&gt;
					&lt;li&gt;
						Functional Testing&lt;/li&gt;
					&lt;li&gt;
						Compatibility Testing&lt;/li&gt;
					&lt;li&gt;
						Database Testing&lt;/li&gt;
					&lt;li&gt;
						Security Testing&lt;/li&gt;
					&lt;li&gt;
						Performance Testing&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p style=""&gt;
	&lt;br /&gt;
	&lt;span style="font-size: 11.818181991577148px; line-height: 14.545454025268555px;"&gt;Now let&amp;rsquo;s look each checklist in detail:&lt;/span&gt;&lt;/p&gt;
&lt;h2 style=""&gt;
	Usability Testing&lt;/h2&gt;
&lt;p style=""&gt;
	&lt;strong style="color: rgb(104, 99, 98); font-size: 12px;"&gt;What is Usability Testing?&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li style=""&gt;
		Usability testing is nothing but the User-friendliness check.&lt;/li&gt;
	&lt;li style=""&gt;
		In Usability testing, &amp;nbsp;the application flow is tested so that a new user can understand the application easily.&lt;/li&gt;
	&lt;li style=""&gt;
		Basically, system navigation is checked in Usability testing.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&lt;strong&gt;What is the purpose or Goal of Usability testing?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	A Usability test establishes the ease of use and effectiveness of a product using a standard Usability test practices.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Usability Test Scenarios:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Web page content should be correct without any spelling or grammatical errors&lt;/li&gt;
	&lt;li&gt;
		All fonts should be same as per the requirements.&lt;/li&gt;
	&lt;li&gt;
		All the text should be properly aligned.&lt;/li&gt;
	&lt;li&gt;
		All the error messages should be correct without any spelling or grammatical errors and the error message should match with the field label.&lt;/li&gt;
	&lt;li&gt;
		Tool tip text should be there for every field.&lt;/li&gt;
	&lt;li&gt;
		All the fields should be properly aligned.&lt;/li&gt;
	&lt;li&gt;
		Enough space should be provided between field labels, columns, rows, and error messages.&lt;/li&gt;
	&lt;li&gt;
		All the buttons should be in a standard format and size.&lt;/li&gt;
	&lt;li&gt;
		Home link should be there on every single page.&lt;/li&gt;
	&lt;li&gt;
		Disabled fields should be grayed out.&lt;/li&gt;
	&lt;li&gt;
		Check for broken links and images.&lt;/li&gt;
	&lt;li&gt;
		Confirmation message should be displayed for any kind of update and delete operation.&lt;/li&gt;
	&lt;li&gt;
		Check the site on different resolutions (640 x 480, 600x800 etc.?)&lt;/li&gt;
	&lt;li&gt;
		Check the end user can run the system without frustration.&lt;/li&gt;
	&lt;li&gt;
		Check the tab should work properly.&lt;/li&gt;
	&lt;li&gt;
		Scroll bar should appear only if required.&lt;/li&gt;
	&lt;li&gt;
		If there is an error message on submit, the information filled by the user should be there.&lt;/li&gt;
	&lt;li&gt;
		Title should display on each web page&lt;/li&gt;
	&lt;li&gt;
		All fields (Textbox, dropdown, radio button etc) and buttons should be accessible by keyboard shortcuts and the user should be able to perform all operations by using keyboard.&lt;/li&gt;
	&lt;li&gt;
		Check if the dropdown data is not truncated due to the field size and also check whether the data is hardcoded or managed via administrator.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Functional Testing:&lt;/h2&gt;
&lt;h2&gt;
	&lt;strong style="color: rgb(104, 99, 98); font-size: 12px;"&gt;What is Functional Testing?&lt;/strong&gt;&lt;/h2&gt;
&lt;ul&gt;
	&lt;li&gt;
		Testing the features and operational behavior of a product to ensure they correspond to its specifications.&lt;/li&gt;
	&lt;li&gt;
		Testing that ignores the internal mechanism of a system or component and focuses solely on the outputs generated in response to selected inputs and execution conditions.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&lt;strong&gt;What is the purpose or Goal of Functional testing?&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		The goal of Functional testing is to verify whether your product meets the intended functional specifications mentioned in your development documentation.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&lt;strong&gt;Functional Test Scenarios:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Test all the mandatory fields should be validated.&lt;/li&gt;
	&lt;li&gt;
		Test the asterisk sign should display for all the mandatory fields.&lt;/li&gt;
	&lt;li&gt;
		Test the system should not display the error message for optional fields.&lt;/li&gt;
	&lt;li&gt;
		Test that leap years are validated correctly &amp;amp; do not cause errors/miscalculations.&lt;/li&gt;
	&lt;li&gt;
		Test the numeric fields should not accept the alphabets and proper error message should display.&lt;/li&gt;
	&lt;li&gt;
		Test for negative numbers if allowed for numeric fields.&lt;/li&gt;
	&lt;li&gt;
		Test division by zero should be handled properly for calculations.&lt;/li&gt;
	&lt;li&gt;
		Test the max length of every field to ensure the data is not truncated.&lt;/li&gt;
	&lt;li&gt;
		Test the pop up message (&amp;ldquo;This field is limited to 500 characters) should display if the data reaches &amp;nbsp;the maximum size of the field.&lt;/li&gt;
	&lt;li&gt;
		Test that a confirmation message should display for update and delete operations.&lt;/li&gt;
	&lt;li&gt;
		Test the amount values should display in currency format.&lt;/li&gt;
	&lt;li&gt;
		Test all input fields for special characters.&lt;/li&gt;
	&lt;li&gt;
		Test the timeout functionality.&lt;/li&gt;
	&lt;li&gt;
		Test the Sorting functionality.&lt;/li&gt;
	&lt;li&gt;
		Test the functionality of the buttons available&lt;/li&gt;
	&lt;li&gt;
		Test the Privacy Policy &amp;amp; FAQ is clearly defined and should be available for users.&lt;/li&gt;
	&lt;li&gt;
		Test if any functionality fails the user gets redirected to the custom error page.&lt;/li&gt;
	&lt;li&gt;
		Test all the uploaded documents are opened properly.&lt;/li&gt;
	&lt;li&gt;
		Test the user should be able to download the uploaded files.&lt;/li&gt;
	&lt;li&gt;
		Test the email functionality of the system.&lt;/li&gt;
	&lt;li&gt;
		Test the java script is properly working in different browsers (IE, Firefox, Chrome, safari and Opera).&lt;/li&gt;
	&lt;li&gt;
		Test to see what happens if a user deletes cookies while in the site.&lt;/li&gt;
	&lt;li&gt;
		Test to see what happens if a user deletes cookies after visiting a site.&lt;/li&gt;
	&lt;li&gt;
		Test all the data inside combo/list box is arranged in chronological order.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Compatibility Testing:&lt;/h2&gt;
&lt;p&gt;
	&lt;strong style="color: rgb(104, 99, 98); font-size: 12px;"&gt;What is Compatibility testing?&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Comp ability testing is used to determine if your software is compatible with other elements of a system with which it should operate, e.g. Browsers, Operating Systems, or hardware.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&lt;strong&gt;What is the purpose or Goal of Compatibility testing?&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		The purpose of Comp ability testing is to evaluate how well software performs in a particular browser, Operating Systems, hardware or software.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&lt;strong&gt;Comp ability Test Scenarios:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Test the website in different browsers (IE, Firefox, Chrome, Safari and Opera) and ensure the website is displaying properly.&lt;/li&gt;
	&lt;li&gt;
		Test the HTML version being used is compatible with appropriate browser versions.&lt;/li&gt;
	&lt;li&gt;
		Test the images display correctly in different browsers.&lt;/li&gt;
	&lt;li&gt;
		Test the fonts are usable in different browsers.&lt;/li&gt;
	&lt;li&gt;
		Test the java script code is usable in different browsers.&lt;/li&gt;
	&lt;li&gt;
		Test the Animated GIF&amp;rsquo;s across different browsers.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Tool for Compatibility Testing:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Spoon.net: Spoon.net provides access to thousands of applications (Browsers) without any installs. This tool helps you to test your application on different browsers on one single machine&lt;strong&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Database Testing:&lt;/h2&gt;
&lt;p&gt;
	&lt;strong&gt;What is Database Testing?&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		In Database testing backend records are tested which have been inserted through the web or desktop applications. The data which is displaying in the web application should match with the data stored in the Database.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&lt;strong&gt;To perform the Database testing, the tester should be aware of the below mentioned points&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		The tester should understand the functional requirements, business logic, application flow and database design thoroughly.&lt;/li&gt;
	&lt;li&gt;
		The tester should figure out the tables, triggers, store procedures, views and cursors used for the application.&lt;/li&gt;
	&lt;li&gt;
		The tester should understand the logic of the triggers, store procedures, views and cursors created.&lt;/li&gt;
	&lt;li&gt;
		The tester should figure out the tables which get affected when insert update and delete (DML) operations are performed through the web or desktop applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&lt;strong&gt;With the help of the above mentioned points, &amp;nbsp;the tester can easily write the test scenarios for Database testing.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;&lt;u&gt;Test Scenarios for Database Testing:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Verify the database name:&amp;nbsp; The database name should match with the specifications.&lt;/li&gt;
	&lt;li&gt;
		Verify the Tables, columns, column types and defaults: All things should match with the specifications.&lt;/li&gt;
	&lt;li&gt;
		Verify whether the column allows a null or not.&lt;/li&gt;
	&lt;li&gt;
		Verify the Primary and foreign key of each table.&lt;/li&gt;
	&lt;li&gt;
		Verify the Stored Procedure:&lt;/li&gt;
	&lt;li&gt;
		Test whether the Stored procedure is installed or not.&lt;/li&gt;
	&lt;li&gt;
		Verify the Stored procedure name&lt;/li&gt;
	&lt;li&gt;
		Verify the parameter names, types and number of parameters.&lt;/li&gt;
	&lt;li&gt;
		Test the parameters if they are required or not.&lt;/li&gt;
	&lt;li&gt;
		Test the stored procedure by deleting some parameters&lt;/li&gt;
	&lt;li&gt;
		Test when the output is zero, the zero records should be affected.&lt;/li&gt;
	&lt;li&gt;
		Test the stored procedure by writing simple SQL queries.&lt;/li&gt;
	&lt;li&gt;
		Test whether the stored procedure returns the values&lt;/li&gt;
	&lt;li&gt;
		Test the stored procedure with sample input data.&lt;/li&gt;
	&lt;li&gt;
		Verify the behavior of each flag in the table.&lt;/li&gt;
	&lt;li&gt;
		Verify the data gets properly saved into the database after the each page submission.&lt;/li&gt;
	&lt;li&gt;
		Verify the data if the DML (Update, delete and insert) operations are performed.&lt;/li&gt;
	&lt;li&gt;
		Ch&lt;u&gt;eck&lt;/u&gt; the length of every field: The field length in the back end and front end must be same.&lt;/li&gt;
	&lt;li&gt;
		Verify the database names of QA, UAT and production. The names should be unique.&lt;/li&gt;
	&lt;li&gt;
		Verify the encrypted data in the database.&lt;/li&gt;
	&lt;li&gt;
		Verify the database size. Also test the response time of each query executed.&lt;/li&gt;
	&lt;li&gt;
		Verify the data displayed on the front end and make sure it is same in the back end.&lt;/li&gt;
	&lt;li&gt;
		Verify the data validity by inserting the invalid data in the database.&lt;/li&gt;
	&lt;li&gt;
		Verify the Triggers.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	What is Security Testing?&lt;/h2&gt;
&lt;p&gt;
	Security Testing involves the test to identify any flaws and gaps from a security point of view.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;&lt;u&gt;Test Scenarios for Security Testing:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;
		Verify the web page which contains important data like password, credit card numbers, secret answers for security question etc should be submitted via HTTPS (SSL).&lt;/li&gt;
	&lt;li&gt;
		Verify the important information like password, credit card numbers etc should display in encrypted format.&lt;/li&gt;
	&lt;li&gt;
		Verify password rules are implemented on all authentication pages like Registration, forgot password, change password.&lt;/li&gt;
	&lt;li&gt;
		Verify if the password is changed the user should not be able to login with the old password.&lt;/li&gt;
	&lt;li&gt;
		Verify the error messages should not display any important information.&lt;/li&gt;
	&lt;li&gt;
		Verify if the user is logged out from the system or user session was expired, the user should not be able to navigate the site.&lt;/li&gt;
	&lt;li&gt;
		Verify to access the secured and non secured web pages directly without login.&lt;/li&gt;
	&lt;li&gt;
		Verify the &amp;ldquo;View Source code&amp;rdquo; option is disabled and should not be visible to the user.&lt;/li&gt;
	&lt;li&gt;
		Verify the user account gets locked out if the user is entering the wrong password several times.&lt;/li&gt;
	&lt;li&gt;
		Verify the cookies should not store passwords.&lt;/li&gt;
	&lt;li&gt;
		Verify if, any functionality is not working, the system should not display any application, server, or database information. Instead, it should display the custom error page.&lt;/li&gt;
	&lt;li&gt;
		Verify the SQL injection attacks.&lt;/li&gt;
	&lt;li&gt;
		Verify the user roles and their rights. For Example The requestor should not be able to access the admin page.&lt;/li&gt;
	&lt;li&gt;
		Verify the important operations are written in log files, and that information should be traceable.&lt;/li&gt;
	&lt;li&gt;
		Verify the session values are in an encrypted format in the address bar.&lt;/li&gt;
	&lt;li&gt;
		Verify the cookie information is stored in encrypted format.&lt;/li&gt;
	&lt;li&gt;
		Verify the application for Brute Force Attacks&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	What is Performance Testing?&lt;/h2&gt;
&lt;p&gt;
	Performance testing is conducted to evaluate the compliance of a system or component with specified performance requirements.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;General Test scenarios:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		To determine the performance, stability and scalability of an application under different load conditions.&lt;/li&gt;
	&lt;li&gt;
		To determine if the current architecture can support the application at peak user levels.&lt;/li&gt;
	&lt;li&gt;
		To determine which configuration sizing provides the best performance level.&lt;/li&gt;
	&lt;li&gt;
		To identify application and infrastructure bottlenecks.&lt;/li&gt;
	&lt;li&gt;
		To determine if the new version of the software adversely had an impact on response time.&lt;/li&gt;
	&lt;li&gt;
		To evaluate product and/or hardware to determine if it can handle projected load volumes.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&lt;strong&gt;How to do Performance testing? By Manual Testing or by Automation&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	Practically it is not possible to do the performance testing manually because of some drawbacks like:&lt;/div&gt;
&lt;ul&gt;
	&lt;li&gt;
		More number of resources will be required.&lt;/li&gt;
	&lt;li&gt;
		Simultaneous actions are not possible.&lt;/li&gt;
	&lt;li&gt;
		Proper system monitoring is not available.&lt;/li&gt;
	&lt;li&gt;
		Not easy to perform the repetitive task.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
	Hence to overcome the above problems we should use Performance testing tool. Below is the list of some popular testing tools.&lt;/div&gt;
&lt;ul&gt;
	&lt;li&gt;
		Apache JMeter&lt;/li&gt;
	&lt;li&gt;
		Load Runner&lt;/li&gt;
	&lt;li&gt;
		Borland Silk Performer.&lt;/li&gt;
	&lt;li&gt;
		Rational Performance Tester&lt;/li&gt;
	&lt;li&gt;
		WAPT&lt;/li&gt;
	&lt;li&gt;
		NEO LOAD&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Guru99?a=Y9_SJvaExvE:o53bpYDagfc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Guru99?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Guru99/~4/Y9_SJvaExvE" height="1" width="1"/&gt;</description>
            <author>support</author>
            <pubDate>2013-04-29T09:23:11+00:00</pubDate>
            <guid isPermaLink="false">http://www.guru99.com/complete-web-application-testing-checklist.html</guid>
        <feedburner:origLink>http://www.guru99.com/complete-web-application-testing-checklist.html</feedburner:origLink></item>
        <item>
            <title>Alpha Beta Testing - DeMystified</title>
            <link>http://feedproxy.google.com/~r/Guru99/~3/9OMQ3JFvYlI/alpha-beta-testing-demystified.html</link>
            <description>&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;table style="line-height: 14.54px; font-size: 11.81px;"&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;/td&gt;
			&lt;td&gt;
				&lt;h2&gt;
					What is Alpha Testing ?&lt;/h2&gt;
				&lt;p&gt;
					Alpha testing is a type of acceptance testing; performed to identify all possible issues/bugs before releasing the product to everyday users or public.&amp;nbsp; The focus of this testing is to simulate real users by using blackbox and whitebox techniques. The aim is to carry out the tasks that a typical user might perform. Alpha testing is carried out in a lab environment and usually the testers are internal employees of the organization. To put it as simple as possible, this kind of testing is called alpha only because it is done early on, near the end of the development of the software, and before beta testing.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p style="line-height: 14.54px; font-size: 11.81px; text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/AlphaBetaTestingPhase.png" /&gt;&lt;/p&gt;
&lt;h2&gt;
	What is Beta Testing?&lt;/h2&gt;
&lt;p&gt;
	Beta Testing of a product is performed by &amp;ldquo;real users&amp;rdquo; of the software application in a &amp;ldquo;real environment&amp;rdquo; and can be considered as a form of external user acceptance testing.&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;Beta version of the software is released to a limited number of end-users of the product to obtain feedback on the product quality. Beta testing reduces product failure risks and provides increased quality of the product through customer validation.&lt;/p&gt;
&lt;p&gt;
	It is the final test before shipping a product to the customers. Direct feedback from customers is a major advantage of Beta Testing. This testing helps to tests the product in real time environment.&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Alpha Testing versus Beta testing:&lt;/h2&gt;
&lt;p&gt;
	Following are the differences of Alpha and Beta Testing:&lt;/p&gt;
&lt;p align="center"&gt;
	&lt;img src="file:///C:\Users\Amalraj\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/Compare.jpg" /&gt;&lt;/p&gt;
&lt;p style="line-height: 14.54px; font-size: 11.81px;"&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;table align="center" border="0" cellpadding="0" cellspacing="0" width="638"&gt;
	&lt;tbody style=""&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p align="center" class="moduleS1" style=""&gt;
					&lt;strong style=""&gt;Alpha Testing&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p align="center" class="moduleS1" style=""&gt;
					&lt;strong style=""&gt;Beta Testing&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Alpha testing performed by Testers&amp;nbsp; who are usually internal employees of the organization&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Beta testing is performed by Clients or End Users who are not employees of the organization&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Alpha Testing performed at developer&amp;rsquo;s site&lt;/p&gt;
				&lt;p style=""&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Beta testing is performed at client location or end user of the product&lt;/p&gt;
				&lt;p style=""&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Reliability and security testing are not performed &amp;nbsp;in-depth Alpha Testing&lt;/p&gt;
				&lt;p style=""&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Reliability, Security, Robustness are checked during Beta Testing&lt;/p&gt;
				&lt;p style=""&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Alpha testing involves both the white box and black box techniques&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Beta Testing typically uses black box testing&lt;/p&gt;
				&lt;p style=""&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Alpha testing requires lab environment or testing environment&lt;/p&gt;
				&lt;p style=""&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Beta testing doesn&amp;rsquo;t require any lab environment or testing environment. Software is made available to the public and&amp;nbsp; is said to be real time environment&lt;/p&gt;
				&lt;p style=""&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Long execution cycle may be required for Alpha testing&lt;/p&gt;
				&lt;p style=""&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Only few weeks of execution are required for Beta testing&lt;/p&gt;
				&lt;p style=""&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Critical issues or fixes can be addressed by developers immediately in Alpha testing&lt;/p&gt;
				&lt;p style=""&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Most of the issues or feedback is collected from Beta testing will be implemented in future versions of the product&lt;/p&gt;
				&lt;p style=""&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Alpha testing is to ensure the quality of the product before moving to Beta testing&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 319px;"&gt;
				&lt;p style=""&gt;
					Beta testing also concentrates on quality of the product, but gathers users input on the product and ensures that the product is ready for real time users.&lt;/p&gt;
				&lt;p style=""&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Types of Beta Testing&lt;/h2&gt;
&lt;p&gt;
	There are different types of Beta tests, and they are as follows:&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Traditional Beta testing: &lt;/strong&gt;Product is distributed to the target market, and related data is gathered in all aspects. This data can be used for Product improvement.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Public Beta Testing: &lt;/strong&gt;Product is publicly released to the outside world via online channels and data can be gathered from anyone. Based on feedback, product improvements can be done. For example, Microsoft conducted the largest of all Beta Tests for its OS -- Windows 8 before officially releasing it.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Technical Beta Testing: &lt;/strong&gt;Product is released to the internal group of an organization and gather feedback/data from the employees of the organization.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Focused Beta: &lt;/strong&gt;Product is released to the market for gathering feedback on specific features of the program. For example, important functionality of the software.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Post release Beta: &lt;/strong&gt;Product is released to the market and data is gathered to make improvements for the future release of the product.&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Entry and Exit criteria&lt;/h2&gt;
&lt;p align="center"&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	Entry Criteria for &lt;strong&gt;Alpha testing:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Software requirements document or Business requirements specification&lt;/li&gt;
	&lt;li&gt;
		Test Cases for all the requirements&lt;/li&gt;
	&lt;li&gt;
		Testing Team with good knowledge about the software application&lt;/li&gt;
	&lt;li&gt;
		Test Lab environment setup&lt;/li&gt;
	&lt;li&gt;
		QA Build ready for execution&lt;/li&gt;
	&lt;li&gt;
		Test Management tool for uploading test cases and logging defects&lt;/li&gt;
	&lt;li&gt;
		Traceability Matrix to ensure that each design requirement has alteast one test case that verifies it&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	Exit Criteria for &lt;strong&gt;Alpha testing&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		All the test cases have been executed and passed.&lt;/li&gt;
	&lt;li&gt;
		All severity issues need to be fixed and closed&lt;/li&gt;
	&lt;li&gt;
		Delivery of Test summary report&lt;/li&gt;
	&lt;li&gt;
		Make sure that no more additional features can be included&lt;/li&gt;
	&lt;li&gt;
		Sign off on Alpha testing&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	Entrance criteria for&lt;strong&gt; Beta Testing: &lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Sign off document on Alpha testing&lt;/li&gt;
	&lt;li&gt;
		Beta version of the software should be ready&lt;/li&gt;
	&lt;li&gt;
		Environment ready to release the software application to the public&lt;/li&gt;
	&lt;li&gt;
		Tool to capture real time faults&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	Exit Criteria &lt;strong&gt;for Beta Testing:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		All major and minor issues are closed&lt;/li&gt;
	&lt;li&gt;
		Feedback report should be prepared from public&lt;/li&gt;
	&lt;li&gt;
		Delivery of Beta test summary report&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Phases of Testing&lt;/h2&gt;
&lt;p&gt;
	Alpha and Beta tests are typically carried for &amp;ldquo;off-the shelf&amp;rdquo; software or product oriented companies. The Phases of Testing for a product company typically varies from a service oriented organization. Following is the testing phase adopted by product firms&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/TestingPhase.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;img cropbottom="-120019f" croptop="-118871f" src="file:///C:\Users\Amalraj\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Pre-Alpha&lt;/strong&gt;:- Software is a prototype. UI is complete. But not all features are completed. At this stage software is not published.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Alpha&lt;/strong&gt;: Software is near its development and is internally tested for bugs/issues&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Beta&lt;/strong&gt;: Software is stable and is released to limited user base. The goal is to get customer feedback on the product and make changes in software accordingly&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Release Candidate (RC):&lt;/strong&gt; Based on the feedback of Beta Test, you make changes to the software and want to test out the bug fixes. At this stage, &amp;nbsp;you do not want to make radical changes in functionality but just check for bugs. RC is also put out to the public&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Release:&lt;/strong&gt; All works, software is released to public.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Note&lt;/strong&gt;: Above is a standard definition of the Testing stages but in order to garner marketing buzz, companies combine stages like &amp;ldquo;pre-alpha beta&amp;rdquo;, &amp;ldquo;pre-beta&amp;rdquo; etc.&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Advantages &amp;amp; Disadvantages&lt;/h2&gt;
&lt;p style="margin-left: 1.25in;"&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Advantages Beta Testing&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Reduces product failure risk via customer validation.&lt;/li&gt;
	&lt;li&gt;
		Beta Testing allows a company to test post-launch infrastructure.&lt;/li&gt;
	&lt;li&gt;
		Improves product quality via customer feedback&lt;/li&gt;
	&lt;li&gt;
		Cost effective compared to similar data gathering methods&lt;/li&gt;
	&lt;li&gt;
		Creates goodwill with customers and increases customer satisfaction&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Disadvantages Beta Testing&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Test Management is an issue. As compared to other testing types which are usually executed inside a company in a controlled environment, beta testing is executed out in the real world where you seldom have control.&lt;/li&gt;
	&lt;li&gt;
		Finding the right beta users and maintaining their participation could be a challenge&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Advantages of Alpha Testing:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Provides better view about the reliability of the software at an early stage&lt;/li&gt;
	&lt;li&gt;
		Helps simulate real time user behavior and environment.&lt;/li&gt;
	&lt;li&gt;
		Detect many showstopper or serious errors&lt;/li&gt;
	&lt;li&gt;
		Ability to provide early detection of errors with respect to design and functionality&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Disadvantages of Alpha Testing: &lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		In depth functionality cannot be tested as software is still under development stage Sometimes developers and testers are dissatisfied with the results of alpha testing&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Myths of Alpha and Beta Testing:&lt;/h2&gt;
&lt;blockquote&gt;
	&lt;p&gt;
		Myth: Alpha and Beta testing are carried out too late in the testing life cycle to merit a benefit&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
	Truth: &amp;nbsp;Alpha and Beta testing help highlight crucial issues with the software application and provide user feedback.&lt;/p&gt;
&lt;blockquote&gt;
	&lt;p&gt;
		Myth: Same type of testing is done in Alpha and Beta Testing and they are not different scenarios&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
	Truth: Alpha Testing is done in a lab environment, whereas Beta testing is done by real users reporting real problems based on firsthand experience. Both scenarios are remarkably different.&lt;/p&gt;
&lt;blockquote&gt;
	&lt;p&gt;
		Myth: Beta type of testing is difficult and time consuming&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
	Truth: Beta testing takes time/experience to obtain the most value. But the data/feedback it provides is invaluable.&lt;/p&gt;
&lt;blockquote&gt;
	&lt;p&gt;
		Myth: Beta testing generates little or no useful data&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
	Truth: A successful Beta Test can generate tons of valuable information which is otherwise difficult to procure in a lab environment.&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Conclusion&lt;/h2&gt;
&lt;p&gt;
	No matter how many tests you perform, how many bugs you kill, your software is useless if your users do not like it. Beta testing (second Greek alphabet)helps provide authentic feedback of your software from real users.&lt;/p&gt;
&lt;p&gt;
	Alpha testing (first Greek alphabet) helps simulate realtime user environment before the software is sent for Beta Testing and helps shape a stable software candidate eligible for Beta Tests.&lt;/p&gt;
&lt;p&gt;
	Alpha and Beta Testing are indispensable in your testing life cycle.&lt;/p&gt;
&lt;p style="line-height: 14.54px; font-size: 11.81px;"&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p style="line-height: 14.54px; font-size: 11.81px;"&gt;
	&lt;/p&gt;
&lt;p style="line-height: 14.54px; font-size: 11.81px;"&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p style="line-height: 14.54px; font-size: 11.81px;"&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href="http://www.guru99.com/software-testing.html"&gt;Back to Software Testing Index&amp;nbsp; Page&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Guru99?a=9OMQ3JFvYlI:JI20jH6qhZ8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Guru99?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Guru99/~4/9OMQ3JFvYlI" height="1" width="1"/&gt;</description>
            <author>support</author>
            <pubDate>2013-04-02T05:19:22+00:00</pubDate>
            <guid isPermaLink="false">http://www.guru99.com/alpha-beta-testing-demystified.html</guid>
        <feedburner:origLink>http://www.guru99.com/alpha-beta-testing-demystified.html</feedburner:origLink></item>
        <item>
            <title>Learn Penetration Testing</title>
            <link>http://feedproxy.google.com/~r/Guru99/~3/Pe-dNZII-DA/learn-penetration-testing.html</link>
            <description>&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;table style="line-height: 14.54px; font-size: 11.81px"&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;/td&gt;
			&lt;td&gt;
				Penetration testing is a type of security testing used to test the insecure areas of the system or application. The goal of this testing is to find all security vulnerabilities that are present in the system being tested. Vulnerability is the risk that an attacker can disrupt or gain authorized access to the system or any data contained within it.&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p style="line-height: 14.54px; font-size: 11.81px; text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/SoftwareVulnerable.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	Vulnerabilities are usually introduced by accident during software development and implementation phase. Common vulnerabilities include design errors, configuration errors, software bugs etc.&lt;/p&gt;
&lt;h1 align="center"&gt;
	&amp;nbsp;&lt;/h1&gt;
&lt;h2&gt;
	Need of a Penetration testing:&lt;/h2&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/WhyPenetrationTesting1.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Penetration is essential in an enterprise because -&lt;/p&gt;
&lt;ul class="checklist"&gt;
	&lt;li&gt;
		Financial sectors like Banks, Investment Banking , Stock Trading Exchanges want their data to be secured , and penetration testing is essential to ensure security&lt;/li&gt;
	&lt;li&gt;
		In case if the software system is already hacked and organization wants to determine whether any threats are still present in the system to avoid future hacks.&lt;/li&gt;
	&lt;li&gt;
		Proactive Penetration Testing is the best safeguard against hackers&lt;/li&gt;
&lt;/ul&gt;
&lt;p align="center"&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Types of Penetration testing:&lt;/h2&gt;
&lt;p&gt;
	The type of penetration test selected usually depends on the scope and whether the organization wants to simulate an attack by an employee, Network Admin (Internal Sources) or by External Sources .There are three types of Penetration testing and they are&lt;/p&gt;
&lt;ul class="checklist"&gt;
	&lt;li&gt;
		Black Box Testing&lt;/li&gt;
	&lt;li&gt;
		White Box Penetration testing&lt;/li&gt;
	&lt;li&gt;
		Grey Box Penetration Testing&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	In black box penetration testing, tester has no knowledge about the systems to be tested .He is responsible to collect information about the target network or system.&lt;/p&gt;
&lt;p&gt;
	In a white-box penetration testing, the tester is usually provided with a complete information about the network or systems to be tested including the IP address schema, source code, OS details, etc. This can be considered as a simulation of an attack by any Internal sources (Employees of an Organization).&lt;/p&gt;
&lt;p&gt;
	In a grey box penetration testing, tester is provided with partial knowledge of the system. It can considered an attack by an external hacker who had gained illegitimate access to an organization&amp;rsquo;s network infrastructure documents.&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Steps in &amp;nbsp;Penetration testing:&lt;/h2&gt;
&lt;p&gt;
	Following are activities needs to be performed to execute Penetration Test -&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/PenetrationStepspng.png" /&gt;&lt;/p&gt;
&lt;p align="center"&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;
		Planning phase
		&lt;ol&gt;
			&lt;li&gt;
				Scope &amp;amp; Strategy &amp;nbsp;of the assignment is determined&lt;/li&gt;
			&lt;li&gt;
				Existing security policies, standards are used for defining the scope&lt;/li&gt;
		&lt;/ol&gt;
	&lt;/li&gt;
	&lt;li&gt;
		Discovery phase
		&lt;ol&gt;
			&lt;li&gt;
				Collect as much information as possible about the system including data in the system, user names and even passwords. This is also called as &lt;strong&gt;FINGERPRINTING&lt;/strong&gt;&lt;/li&gt;
			&lt;li&gt;
				Scan and Probe into the ports&lt;/li&gt;
			&lt;li&gt;
				Check for vulnerabilities of the system&lt;/li&gt;
		&lt;/ol&gt;
	&lt;/li&gt;
	&lt;li&gt;
		Attack Phase
		&lt;ol&gt;
			&lt;li&gt;
				Find exploits for various vulnerabilities You need necessary security Privileges to exploit the system&lt;/li&gt;
		&lt;/ol&gt;
	&lt;/li&gt;
	&lt;li&gt;
		Reporting Phase
		&lt;ol&gt;
			&lt;li&gt;
				Report must contain detailed findings&lt;/li&gt;
			&lt;li&gt;
				Risks of vulnerabilities found and their Impact on business&lt;/li&gt;
			&lt;li&gt;
				Recommendations and solutions, if any&lt;/li&gt;
		&lt;/ol&gt;
	&lt;/li&gt;
&lt;/ol&gt;
&lt;p style="margin-left: 1in"&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	The prime task in penetration testing is to gather system information. There are two ways to gather information -&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		&amp;lsquo;One to one&amp;#39; or &amp;#39;one to many&amp;#39; model with respect to host: A tester performs techniques in a linear way against either one target host or a logical grouping of target hosts (e.g. a subnet).&lt;/li&gt;
	&lt;li&gt;
		&amp;#39;Many to one&amp;#39; or &amp;#39;many to many&amp;#39; model :The tester utilizes multiple hosts to execute information gathering techniques in a random, rate-limited, and in non-linear.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Tools of Penetration testing:&lt;/h2&gt;
&lt;p&gt;
	There is a wide variety of tools that are used in penetration testing and the important tools are:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;
		&lt;a href="http://www.nmap.org/"&gt;NMap&lt;/a&gt;&amp;ndash; This tool is used to do port scanning, OS identification, Trace the route and for Vulnerability scanning.&lt;/li&gt;
	&lt;li&gt;
		&lt;a href="http://www.nessus.org/"&gt;Nessus&lt;/a&gt;- This is traditional network based vulnerabilities tool.&lt;/li&gt;
	&lt;li&gt;
		Pass-The-Hash &amp;ndash; This tool is mainly used for password cracking.&lt;/li&gt;
	&lt;li&gt;
		&lt;a href="http://www.oxid.it/"&gt;Cain and Abel&lt;/a&gt;&amp;ndash; This tool mainly used for Password recovery, Network sniffing, Wireless scanning and VoIP.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Role and Responsibilities of Penetration Testers:&lt;/h2&gt;
&lt;p&gt;
	Penetration Testers job is to:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Testers should collect required information from the Organization to enable penetration tests&lt;/li&gt;
	&lt;li&gt;
		Find flaws that could allow hackers to attack a target machine&lt;/li&gt;
	&lt;li&gt;
		Pen Testers should think &amp;amp; act like real hackers albeit ethically.&amp;nbsp;&lt;/li&gt;
	&lt;li&gt;
		Work done by Penetration testers should be reproducible so that it will be easy for developers to fix it&lt;/li&gt;
	&lt;li&gt;
		Start date and End date of test execution should be defined in advance.&lt;/li&gt;
	&lt;li&gt;
		Tester should be responsible for any loss in the system or information during the testing&lt;/li&gt;
	&lt;li&gt;
		Tester should keep data and information confidential&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Manual Penetration vs. automated penetration testing:&lt;/h2&gt;
&lt;ol&gt;
	&lt;li&gt;
		Manual testing requires expert professionals to run the tests whereas Automated test tools provides clear reports with less experienced professionals&lt;/li&gt;
	&lt;li&gt;
		Manual Testing requires excel and other tools to track it , but automation has centralized and standard tools &amp;ndash;&lt;/li&gt;
	&lt;li&gt;
		In Manual testing, results vary from test to test but not in the case of Automated tests&lt;/li&gt;
	&lt;li&gt;
		Memory Cleaning up should be remembered by users , but automated testing will have comprehensive clean ups.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Limitations of Penetration testing:&lt;/h2&gt;
&lt;p&gt;
	Penetration Testing cannot find all vulnerabilities in the system .There are limitations of time , budget , scope , skills of&amp;nbsp; Penetration Testers&lt;/p&gt;
&lt;p&gt;
	Following will be side effects when we are doing penetration testing:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Data Loss and Corruption&lt;/li&gt;
	&lt;li&gt;
		Down Time&lt;/li&gt;
	&lt;li&gt;
		Increase costs&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="margin-left: 1in"&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Conclusion:&lt;/h2&gt;
&lt;p&gt;
	Testers should act like a real hacker and test the application or system and needs to check whether code is securely written. A penetration test will be effective if there is a well-implemented security policy. Penetration testing policy and methodology should be a place to make penetration testing more effective.&lt;/p&gt;
&lt;p style="line-height: 14.54px; font-size: 11.81px"&gt;
	&lt;/p&gt;
&lt;p style="line-height: 14.54px; font-size: 11.81px"&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p style="line-height: 14.54px; font-size: 11.81px"&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href="http://www.guru99.com/software-testing.html"&gt;Back to Software Testing Index&amp;nbsp; Page&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Guru99?a=Pe-dNZII-DA:3Tu3WD9eZX4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Guru99?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Guru99/~4/Pe-dNZII-DA" height="1" width="1"/&gt;</description>
            <author>support</author>
            <pubDate>2013-03-22T04:44:14+00:00</pubDate>
            <guid isPermaLink="false">http://www.guru99.com/learn-penetration-testing.html</guid>
        <feedburner:origLink>http://www.guru99.com/learn-penetration-testing.html</feedburner:origLink></item>
        <item>
            <title>Accessing Forms  in WebDriver</title>
            <link>http://feedproxy.google.com/~r/Guru99/~3/VMyFXjcCdq0/accessing-forms-in-webdriver.html</link>
            <description>&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;table&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;/td&gt;
			&lt;td&gt;
				&lt;p&gt;
					In this tutorial , we will learn how to access forms and its&amp;nbsp; elements using Webdriver&lt;/p&gt;
				&lt;h2&gt;
					Accessing Form Elements&lt;/h2&gt;
				&lt;p&gt;
					&lt;strong&gt;Input Box&lt;/strong&gt;&lt;/p&gt;
				&lt;p&gt;
					Input boxes refer to either of these two types:&lt;/p&gt;
				&lt;ol&gt;
					&lt;li&gt;
						&lt;strong&gt;Text Fields&lt;/strong&gt;&amp;ndash; text boxes that accept typed values and show them as they are.&lt;/li&gt;
					&lt;li&gt;
						&lt;strong&gt;Password Fields&lt;/strong&gt;&amp;ndash; text boxes that accept typed values but mask them as a series of special characters (commonly dots and asterisks) to avoid sensitive values to be displayed.&lt;/li&gt;
				&lt;/ol&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;img alt="" src="http://www.guru99.com/images/image002(1).png" /&gt;&lt;/p&gt;
				&lt;p&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;
	Entering Values in Input Boxes&lt;/h3&gt;
&lt;p&gt;
	The &lt;strong&gt;sendKeys()&lt;/strong&gt; method is used to enter values into input boxes.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image003(2).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Deleting Values in Input Boxes&lt;/h3&gt;
&lt;p&gt;
	The &lt;strong&gt;clear()&lt;/strong&gt; method is used to delete the text in an input box. &lt;strong&gt;This method does not need any parameter&lt;/strong&gt;. The code snippet below will clear out the text &amp;ldquo;tutorial&amp;rdquo; in the User Name text box.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image004(3).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Radio Button&lt;/h3&gt;
&lt;p&gt;
	Toggling a radio button on is done using the &lt;strong&gt;click() &lt;/strong&gt;method.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image005(3).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Check Box&lt;/h3&gt;
&lt;p&gt;
	Toggling a check box on/off is also done using the &lt;strong&gt;click()&lt;/strong&gt; method.&lt;/p&gt;
&lt;p&gt;
	The code below will click on Facebook&amp;rsquo;s &amp;ldquo;Keep me logged in&amp;rdquo; check box twice and then output the result as TRUE when it is toggled on, and FALSE if it is toggled off.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image006(3).png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image007(3).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;
	Links&lt;/h3&gt;
&lt;p&gt;
	Links also are accessed by using the &lt;strong&gt;click()&lt;/strong&gt; method.&lt;/p&gt;
&lt;p&gt;
	Consider the below link found in Mercury Tours&amp;rsquo; homepage.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image008(4).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	You can access this link using linkText() or partialLinkText() together with click(). Either of the two lines below will be able to access the &amp;ldquo;Register here&amp;rdquo; link shown above.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image009(4).png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image010(3).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;
	Drop-Down Box&lt;/h3&gt;
&lt;p&gt;
	Before we can control drop-down boxes, we must do following two things :&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;
		Import the package &lt;strong&gt;org.openqa.selenium.support.ui.Select&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;
		Instantiate the drop-down box as a &amp;ldquo;Select&amp;rdquo; object in WebDriver&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
	As an example, go to Mercury Tours&amp;rsquo; Registration page (&lt;a href="http://newtours.demoaut.com/mercuryregister.php"&gt;http://newtours.demoaut.com/mercuryregister.php&lt;/a&gt;) and notice the &amp;ldquo;Country&amp;rdquo; drop-down box there.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image011(3).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Import the &amp;ldquo;Select&amp;rdquo; package.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image012(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Declare the drop-down element as an instance of the Select class. In the example below, we named this instance as &amp;ldquo;drpCountry&amp;rdquo;.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image013(3).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	We can now start controlling &amp;ldquo;drpCountry&amp;rdquo; by using any of the available Select methods. The sample code below will select the option &amp;ldquo;ANTARCTICA&amp;rdquo;.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image014(3).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Selecting Items in a Multiple SELECT element&lt;/h3&gt;
&lt;p&gt;
	We can also use the &lt;strong&gt;selectByVisibleText()&lt;/strong&gt; method in selecting multiple options in a multi SELECT element. As an example, we will take &lt;a href="http://jsbin.com/osebed/2"&gt;http://jsbin.com/osebed/2&lt;/a&gt; as the base URL. It contains a drop-down box that allows multiple selections at a time.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image015(3).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	The code below will select the first two options using the selectByVisibleText() method.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image016(3).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Select Methods&lt;/h3&gt;
&lt;p&gt;
	The following are the most common methods used on drop-down elements.&lt;/p&gt;
&lt;table align="center" border="1" cellpadding="0" cellspacing="0" style="width: 629px;"&gt;
	&lt;tbody&gt;
		&lt;tr bgcolor="#B6DDE8"&gt;
			&lt;td style="width: 270px; height: 23px;"&gt;
				&lt;p align="center"&gt;
					&lt;strong&gt;Method&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 353px; height: 23px;"&gt;
				&lt;p align="center"&gt;
					&lt;strong&gt;Description&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 270px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;selectByVisibleText() &lt;/strong&gt;and&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;deselectByVisibleText()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Example:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;img alt="" src="http://www.guru99.com/images/image017(3).png" /&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 353px;"&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Selects/deselects the option that displays the text matching the parameter.&lt;/li&gt;
					&lt;li&gt;
						&lt;strong&gt;Parameter&lt;/strong&gt;: The exactly displayed text of a particular option&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 270px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;selectByValue()&lt;/strong&gt; and&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;deselectByValue()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Example:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;img alt="" src="http://www.guru99.com/images/image018(3).png" /&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 353px;"&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Selects/deselects the option whose &amp;ldquo;value&amp;rdquo; attribute matches the specified parameter.&lt;/li&gt;
					&lt;li&gt;
						&lt;strong&gt;Parameter&lt;/strong&gt;: value of the &amp;ldquo;value&amp;rdquo; attribute&lt;/li&gt;
					&lt;li&gt;
						Remember that not all drop-down options have the same text and &amp;ldquo;value&amp;rdquo;, like in the example below.&lt;/li&gt;
				&lt;/ul&gt;
				&lt;p&gt;
					&lt;img alt="" src="http://www.guru99.com/images/image019(2).png" /&gt;&lt;/p&gt;
				&lt;p&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 270px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;selectByIndex()&lt;/strong&gt; and&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;deselectByValue()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Example:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;&lt;img alt="" src="http://www.guru99.com/images/image020(2).png" /&gt;&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 353px;"&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Selects/deselects the option at the given index.&lt;/li&gt;
					&lt;li&gt;
						&lt;strong&gt;Parameter&lt;/strong&gt;: the index of the option to be selected.&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 270px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;isMultiple()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Example:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;&lt;img alt="" src="http://www.guru99.com/images/image021(2).png" /&gt;&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 353px;"&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Returns TRUE if the drop-down element allows multiple selections at a time; FALSE if otherwise.&lt;/li&gt;
					&lt;li&gt;
						&lt;strong&gt;Needs parameters needed&lt;/strong&gt;&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 270px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;deselectAll()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Example:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;&lt;img alt="" src="http://www.guru99.com/images/image022(2).png" /&gt;&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 353px;"&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Clears all selected entries. This is only valid when the drop-down element supports multiple selections.&lt;/li&gt;
					&lt;li&gt;
						&lt;strong&gt;No parameters needed&lt;/strong&gt;&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;
	Submitting a Form&lt;/h3&gt;
&lt;p&gt;
	The &lt;strong&gt;submit() &lt;/strong&gt;method is used to submit a form. This is an alternative to clicking the form&amp;rsquo;s submit button.&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;You can use submit() on any element within the form, not just on the submit button itself.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image023(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;When submit() is used, WebDriver will look up the DOM to know which form the element belongs to, and then trigger its submit function.&lt;/strong&gt;&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Summary&lt;/h2&gt;
&lt;/div&gt;
&lt;ul&gt;
	&lt;li&gt;
		The table below summarizes the commands to access each type of element discussed above.&lt;/li&gt;
&lt;/ul&gt;
&lt;table align="center" border="1" cellpadding="0" cellspacing="0" height="627" width="584"&gt;
	&lt;tbody&gt;
		&lt;tr bgcolor="#B6DDE8"&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p align="center"&gt;
					&lt;strong&gt;Element&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p align="center"&gt;
					&lt;strong&gt;Command&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p align="center"&gt;
					&lt;strong&gt;Description&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td rowspan="2" style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;Input Box&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;sendKeys()&lt;/em&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style="text-align: center;"&gt;
					used to enter values onto text boxes&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;clear()&lt;/em&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style="text-align: center;"&gt;
					used to clear text boxes of its current value&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;Check Box,&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;Radio Button,&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;click()&lt;/em&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style="text-align: center;"&gt;
					used to toggle the element on/off&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;click()&lt;/em&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style="text-align: center;"&gt;
					used to click on the link and wait for page load to complete before proceeding to the next command.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td rowspan="5" style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;Drop-Down Box&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;selectByVisibleText()/&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;deselectByVisibleText()&lt;/em&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style="text-align: center;"&gt;
					selects/deselects an option by its displayed text&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;selectByValue()/&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;deselectByValue()&lt;/em&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style="text-align: center;"&gt;
					selects/deselects an option by the value of its &amp;ldquo;value&amp;rdquo; attribute&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;selectByIndex()/&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;deselectByIndex()&lt;/em&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style="text-align: center;"&gt;
					selects/deselects an option by its index&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;isMultiple()&lt;/em&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style="text-align: center;"&gt;
					returns TRUE if the drop-down element allows multiple selection at a time; FALSE if otherwise&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;deselectAll()&lt;/em&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style="text-align: center;"&gt;
					deselects all previously selected options&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;Submit Button&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 129px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;submit()&lt;/em&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;ul&gt;
	&lt;li&gt;
		WebDriver allows selection of more than one option in a multiple SELECT element.&lt;/li&gt;
	&lt;li&gt;
		To control drop-down boxes, you must first import the org.openqa.selenium.support.ui.Select package and then create a Select instance.&lt;/li&gt;
	&lt;li&gt;
		You can use the submit() method on any element within the form. WebDriver will automatically trigger the submit function of the form where that element belongs to.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;a href="http://www.guru99.com/first-webdriver-script.html"&gt;Previous Tutorial&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href="http://www.guru99.com/selenium-tutorial.html"&gt;Back to Selenium Tutorials Index&amp;nbsp; Page&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href="http://www.guru99.com/accessing-links-tables-selenium-webdriver.html"&gt;Next Tutorial&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Guru99?a=VMyFXjcCdq0:WxZ7vB5HwOI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Guru99?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Guru99/~4/VMyFXjcCdq0" height="1" width="1"/&gt;</description>
            <author>support</author>
            <pubDate>2013-03-04T12:55:48+00:00</pubDate>
            <guid isPermaLink="false">http://www.guru99.com/accessing-forms-in-webdriver.html</guid>
        <feedburner:origLink>http://www.guru99.com/accessing-forms-in-webdriver.html</feedburner:origLink></item>
        <item>
            <title>First WebDriver Script</title>
            <link>http://feedproxy.google.com/~r/Guru99/~3/PiD7mdw6FoA/first-webdriver-script.html</link>
            <description>&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;table&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;/td&gt;
			&lt;td&gt;
				&lt;p&gt;
					Using the Java class&amp;nbsp;&amp;ldquo;myclass&amp;rdquo; &amp;nbsp;that we created in the previous tutorial, let us try to create a WebDriver script that would:&lt;/p&gt;
				&lt;p&gt;
					&amp;nbsp;&lt;/p&gt;
				&lt;ol&gt;
					&lt;li style="margin-left: 40px;"&gt;
						fetch Mercury Tours&amp;rsquo; homepage&lt;/li&gt;
					&lt;li style="margin-left: 40px;"&gt;
						verify its title&lt;/li&gt;
					&lt;li style="margin-left: 40px;"&gt;
						print out the result of the comparison&lt;/li&gt;
					&lt;li style="margin-left: 40px;"&gt;
						close it before ending the entire program.&lt;/li&gt;
				&lt;/ol&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;
	WebDriver Code&lt;/h3&gt;
&lt;p&gt;
	Below is the actual WebDriver code for the logic presented by the scenario above&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	package mypackage;&lt;br /&gt;
	&lt;br /&gt;
	import org.openqa.selenium.WebDriver;&lt;br /&gt;
	import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;
	&lt;br /&gt;
	public class myclass {&lt;br /&gt;
	&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;public static void main(String[] args) {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // declaration and instantiation of objects/variables&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WebDriver driver = new FirefoxDriver();&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String baseUrl = &amp;quot;http://newtours.demoaut.com&amp;quot;;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String expectedTitle = &amp;quot;Welcome: Mercury Tours&amp;quot;;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String actualTitle = &amp;quot;&amp;quot;;&lt;br /&gt;
	&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // launch Firefox and direct it to the Base URL&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; driver.get(baseUrl);&lt;br /&gt;
	&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // get the actual value of the title&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; actualTitle = driver.getTitle();&lt;br /&gt;
	&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* compare the actual title of the page witht the expected one and print&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;* the result as &amp;quot;Passed&amp;quot; or &amp;quot;Failed&amp;quot;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (actualTitle.contentEquals(expectedTitle)){&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&amp;quot;Test Passed!&amp;quot;);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&amp;quot;Test Failed&amp;quot;);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //close Firefox&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; driver.close();&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // exit the program explicitly&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.exit(0);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
	&lt;br /&gt;
	}&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;h2&gt;
	Explaining the code&lt;/h2&gt;
&lt;h3&gt;
	Importing Packages&lt;/h3&gt;
&lt;p&gt;
	To get started, you need to import following two packages:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;
		&lt;strong&gt;org.openqa.selenium.*&lt;/strong&gt;- contains the WebDriver class needed to instantiate a new browser loaded with a specific driver&lt;/li&gt;
	&lt;li&gt;
		&lt;strong&gt;org.openqa.selenium.firefox.FirefoxDriver &lt;/strong&gt;&amp;ndash; contains the FirefoxDriver class needed to instantiate a Firefox-specific driver onto the browser instantiated by the WebDriver class&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
	If your test needs more complicated actions such as accessing another class, taking browser screenshots, or manipulating external files, definitely you will need to import more packages.&lt;/p&gt;
&lt;h3&gt;
	Instantiating objects and variables&lt;/h3&gt;
&lt;p&gt;
	Normally, this is how a driver object is instantiated.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image004(2).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	A FirefoxDriver class with no parameters means that the default Firefox profile will be launched by our Java program. The default Firefox profile is similar to launching Firefox in safe mode (no extensions are loaded).&lt;/p&gt;
&lt;p&gt;
	For convenience, we saved the Base URL and the expected title as variables.&lt;/p&gt;
&lt;h3&gt;
	Launching a Browser Session&lt;/h3&gt;
&lt;p&gt;
	WebDriver&amp;rsquo;s &lt;strong&gt;get()&lt;/strong&gt; method is used to launch a new browser session and directs it to the URL that you specify as its parameter.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image005(2).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Get the Actual Page Title&lt;/h3&gt;
&lt;p&gt;
	The WebDriver class has the &lt;strong&gt;getTitle()&lt;/strong&gt; method that is always used to obtain the page title of the currently loaded page.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image006(2).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Compare the Expected and Actual Values&lt;/h3&gt;
&lt;p&gt;
	This portion of the code simply uses a basic Java if-else structure to compare the actual title with the expected one.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image007(2).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Terminating a Browser Session&lt;/h3&gt;
&lt;p&gt;
	The &amp;ldquo;&lt;strong&gt;close()&lt;/strong&gt;&amp;rdquo; method is used to close the browser window.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image008(3).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Terminating the Entire Program&lt;/h3&gt;
&lt;p&gt;
	If you use this command without closing all browser windows first, your whole Java program will end, while leaving browser window open.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image009(3).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Running the Test&lt;/h3&gt;
&lt;p&gt;
	There are two ways to execute code in Eclipse IDE.&lt;/p&gt;
&lt;ol&gt;
	&lt;li style="margin-left: 40px;"&gt;
		On Eclipse&amp;rsquo;s menu bar, click &lt;strong&gt;Run &amp;gt; Run.&lt;/strong&gt;&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		Press &lt;strong&gt;Ctrl+F11&lt;/strong&gt; to run the entire code.&lt;/li&gt;
&lt;/ol&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image010(2).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;If you did everything correctly, Eclipse would output &amp;ldquo;Test Passed!&amp;rdquo;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image011(2).png" /&gt;&lt;/p&gt;
&lt;h2&gt;
	Locating GUI Elements&lt;/h2&gt;
&lt;p&gt;
	Locating elements in WebDriver is done by using the &amp;ldquo;&lt;strong&gt;findElement(By.&lt;em&gt;locator&lt;/em&gt;())&lt;/strong&gt;&amp;rdquo; method. The &amp;ldquo;locator&amp;rdquo; part of the code is same as any of the&amp;nbsp; locators previously discussed in the Selenium IDE chapters of these tutoriasl.Infact , it is recommeded you locate GUI elements using IDE and once successfully identified export the code to webdriver.&lt;/p&gt;
&lt;p&gt;
	Here is a sample code that locates an element by its id. Facebook is used as the Base URL.&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	package mypackage;&lt;br /&gt;
	import org.openqa.selenium.By;&lt;br /&gt;
	import org.openqa.selenium.WebDriver;&lt;br /&gt;
	import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;
	public class myclass {&lt;br /&gt;
	&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;public static void main(String[] args) {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WebDriver driver = new FirefoxDriver();&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String baseUrl = &amp;quot;http://www.facebook.com&amp;quot;;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String tagName = &amp;quot;&amp;quot;;&lt;br /&gt;
	&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; driver.get(baseUrl);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tagName = driver.findElement(By.id(&amp;quot;email&amp;quot;)).getTagName();&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(tagName);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; driver.close();&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.exit(0);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
	}&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	We used the &lt;strong&gt;getTagName()&lt;/strong&gt; method to extract the tag name of that particular element whose id is &amp;ldquo;email&amp;rdquo;. When run, this code should be able to correctly identify the tag name &amp;ldquo;input&amp;rdquo; and will print it out on Eclipse&amp;rsquo;s Console window.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image013(2).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Summary for locating elements&lt;/p&gt;
&lt;table align="center" border="1" cellpadding="0" cellspacing="0" style="width: 695px;" width="100%"&gt;
	&lt;tbody&gt;
		&lt;tr bgcolor="#FFFFCC"&gt;
			&lt;td style="width: 18.96%;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;Variation&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 34.3%;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;Description&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 290px;"&gt;
				&lt;p align="center"&gt;
					&lt;strong&gt;Sample&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 18.96%;"&gt;
				&lt;p style="text-align: center;"&gt;
					By.&lt;strong&gt;className&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 34.3%;"&gt;
				&lt;p style="text-align: center;"&gt;
					finds elements based on the value of the &amp;ldquo;class&amp;rdquo; attribute&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 290px;"&gt;
				&lt;p style="text-align: center;"&gt;
					findElement(By.className(&amp;ldquo;someClassName&amp;rdquo;))&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 18.96%;"&gt;
				&lt;p style="text-align: center;"&gt;
					By.&lt;strong&gt;cssSelector&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 34.3%;"&gt;
				&lt;p style="text-align: center;"&gt;
					finds elements based on the driver&amp;rsquo;s underlying CSS Selector engine&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 290px;"&gt;
				&lt;p style="text-align: center;"&gt;
					findElement(By.cssSelector(&amp;ldquo;input#email&amp;rdquo;))&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 18.96%;"&gt;
				&lt;p style="text-align: center;"&gt;
					By.&lt;strong&gt;id&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 34.3%;"&gt;
				&lt;p style="text-align: center;"&gt;
					locates elements by the value of their &amp;ldquo;id&amp;rdquo; attribute&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 290px;"&gt;
				&lt;p style="text-align: center;"&gt;
					findElement(By.id(&amp;ldquo;someId&amp;rdquo;))&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 18.96%;"&gt;
				&lt;p style="text-align: center;"&gt;
					By.&lt;strong&gt;linkText&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 34.3%;"&gt;
				&lt;p style="text-align: center;"&gt;
					finds a link element by the exact text it displays&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 290px;"&gt;
				&lt;p style="text-align: center;"&gt;
					findElement(By.linkText(&amp;ldquo;REGISTRATION&amp;rdquo;))&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 18.96%;"&gt;
				&lt;p style="text-align: center;"&gt;
					By.&lt;strong&gt;name&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 34.3%;"&gt;
				&lt;p style="text-align: center;"&gt;
					locates elements by the value of the &amp;ldquo;name&amp;rdquo; attribute&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 290px;"&gt;
				&lt;p style="text-align: center;"&gt;
					findElement(By.name(&amp;ldquo;someName&amp;rdquo;))&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 18.96%;"&gt;
				&lt;p style="text-align: center;"&gt;
					By.&lt;strong&gt;partialLinkText&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 34.3%;"&gt;
				&lt;p style="text-align: center;"&gt;
					locates elements that contain the given link text&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 290px;"&gt;
				&lt;p style="text-align: center;"&gt;
					findElement(By.partialLinkText(&amp;ldquo;REG&amp;rdquo;))&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 18.96%;"&gt;
				&lt;p style="text-align: center;"&gt;
					By.&lt;strong&gt;tagName&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 34.3%;"&gt;
				&lt;p style="text-align: center;"&gt;
					locates elements by their tag name&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 290px;"&gt;
				&lt;p style="text-align: center;"&gt;
					findElement(By.tagName(&amp;ldquo;div&amp;rdquo;))&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 18.96%;"&gt;
				&lt;p style="text-align: center;"&gt;
					By.&lt;strong&gt;xpath&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 34.3%;"&gt;
				&lt;p style="text-align: center;"&gt;
					locates elements via XPath&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 290px;"&gt;
				&lt;p&gt;
					findElement(By.xpath(&amp;ldquo;//html/body/div/table/tbody/tr/td[2]/table/tbody/tr[4]/td/table/tbody/tr/td[2]/table/tbody/tr[2]/td[3]/form/table/tbody/tr[5]&amp;rdquo;))&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;
	Note on Using findElement(By.cssSelector())&lt;/h3&gt;
&lt;p&gt;
	&lt;strong&gt;By.cssSelector() does not support the &amp;ldquo;contains&amp;rdquo; feature&lt;/strong&gt;. Consider the Selenium IDE code below -&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image014(2).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	In Selenium IDE above, the entire test passed. However in the WebDriver script below, the same test generated an error because WebDriver does not support the &amp;ldquo;contains&amp;rdquo; keyword when used in the By.cssSelector() method.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image015(2).png" style="height: 372px; width: 700px;" /&gt;&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Common Commands&lt;/h2&gt;
&lt;/div&gt;
&lt;h3&gt;
	Instantiating Web Elements&lt;/h3&gt;
&lt;p&gt;
	Instead of using the long &amp;ldquo;driver.findElement(By.locator())&amp;rdquo; syntax every time you will access a particular element, we can instantiate a WebElement object for it. The WebElement class is contained in the &amp;ldquo;org.openqa.selenium.*&amp;rdquo; package.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image016(2).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Clicking on an Element&lt;/h3&gt;
&lt;p&gt;
	Clicking is perhaps the most common way of interacting with web elements&lt;strong&gt;. The click() method is used to simulate the clicking of any element. &lt;/strong&gt;&amp;nbsp;The following example shows how click() was used to click on Mercury Tours&amp;rsquo;&amp;nbsp; &amp;ldquo;Sign-In&amp;rdquo; button.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image017(2).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Following things must be noted when using the click() method.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		&lt;strong&gt;It does not take any parameter/argument.&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;
		The method &lt;strong&gt;automatically waits for a new page to load&lt;/strong&gt; if applicable.&lt;/li&gt;
	&lt;li&gt;
		The element to be clicked-on, &lt;strong&gt;must be visible&lt;/strong&gt; (height and width must not be equal to zero).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
	Get Commands&lt;/h3&gt;
&lt;p&gt;
	Get commands fetch various important information about the page/element. Here are some important &amp;ldquo;get&amp;rdquo; commands you must be familiar with.&lt;/p&gt;
&lt;table align="center" border="1" cellpadding="0" cellspacing="0" style="width: 621px;"&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;get()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Sample usage:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 509px;"&gt;
				&lt;ul&gt;
					&lt;li&gt;
						It automatically opens a new browser window and fetches the page that you specify inside its parentheses.&lt;/li&gt;
					&lt;li&gt;
						It is the counterpart of Selenium IDE&amp;rsquo;s &amp;ldquo;open&amp;rdquo; command.&lt;/li&gt;
					&lt;li&gt;
						The parameter must be a &lt;strong&gt;String&lt;/strong&gt; object.&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;getTitle()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Sample usage:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 509px;"&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Needs no parameters&lt;/li&gt;
					&lt;li&gt;
						Fetches the title of the current page&lt;/li&gt;
					&lt;li&gt;
						Leading and trailing white spaces are trimmed&lt;/li&gt;
					&lt;li&gt;
						Returns a null string if the page has no title&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;getPageSource()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Sample usage:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 509px;"&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Needs no parameters&lt;/li&gt;
					&lt;li&gt;
						Returns the &lt;strong&gt;source code of the page&lt;/strong&gt; as a String value&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;getCurrentUrl()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Sample usage:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 509px;"&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Needs no parameters&lt;/li&gt;
					&lt;li&gt;
						Fetches the string representing the &lt;strong&gt;current URL&lt;/strong&gt; that the browser is looking at&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;getText()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Sample usage:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 509px;"&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Fetches the &lt;strong&gt;inner text&lt;/strong&gt; of the element that you specify&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;
	Navigate commands&lt;/h3&gt;
&lt;p&gt;
	These commands allow you to&amp;nbsp; refresh,go-into and switch back and forth between different web pages.&lt;/p&gt;
&lt;table align="center" border="1" cellpadding="0" cellspacing="0" height="388" width="514"&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;navigate().to()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Sample usage:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td&gt;
				&lt;ul&gt;
					&lt;li&gt;
						It automatically &lt;strong&gt;opens a new browser window and fetches the page&lt;/strong&gt; that you specify inside its parentheses.&lt;/li&gt;
					&lt;li&gt;
						&lt;strong&gt;It does exactly the same thing as the get() method.&lt;/strong&gt;&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;navigate().refresh()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Sample usage:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Needs no parameters.&lt;/li&gt;
					&lt;li&gt;
						It &lt;strong&gt;refreshes&lt;/strong&gt; the current page.&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;navigate().back()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Sample usage:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Needs no parameters&lt;/li&gt;
					&lt;li&gt;
						Takes you &lt;strong&gt;back by one page&lt;/strong&gt; on the browser&amp;rsquo;s history.&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;navigate().forward()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Sample usage:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Needs no parameters&lt;/li&gt;
					&lt;li&gt;
						Takes you &lt;strong&gt;forward by one page&lt;/strong&gt; on the browser&amp;rsquo;s history.&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;
	Closing and Quitting Browser Windows&lt;/h3&gt;
&lt;table align="center" border="1" cellpadding="0" cellspacing="0" style="width: 564px;"&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td style="width: 169px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;close()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Sample usage:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 389px;"&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Needs no parameters&lt;/li&gt;
					&lt;li&gt;
						&lt;strong&gt;It closes only the browser window that WebDriver is currently controlling&lt;/strong&gt;.&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td style="width: 169px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong&gt;quit()&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em&gt;Sample usage:&lt;/em&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&amp;nbsp;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 389px;"&gt;
				&lt;ul&gt;
					&lt;li&gt;
						Needs no parameters&lt;/li&gt;
					&lt;li&gt;
						&lt;strong&gt;It closes all windows that WebDriver has opened.&lt;/strong&gt;&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image029.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	To clearly illustrate the difference between close() and quit(), try to execute the code below. It uses a webpage that automatically pops up a window upon page load and opens up another after exiting.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image030(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Notice that only the parent browser window was closed and not the two pop-up windows.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image031.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	But if you use quit(), all windows will be closed &amp;ndash; not just the parent one. Try running the code below and you will notice that the two pop-ups above will automatically be closed as well.&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	package mypackage;&lt;br /&gt;
	&lt;br /&gt;
	import org.openqa.selenium.WebDriver;&lt;br /&gt;
	import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;
	&lt;br /&gt;
	public class myclass {&lt;br /&gt;
	&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;public static void main(String[] args) {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WebDriver driver = new FirefoxDriver();&lt;br /&gt;
	&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; driver.get(&amp;quot;http://www.popuptest.com/popuptest2.html&amp;quot;);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; driver.quit();&amp;nbsp; // using QUIT all windows will close&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
	}&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Switching Between Frames&lt;/h2&gt;
&lt;p&gt;
	To access GUI elements in a Frame, we should first direct WebDriver to focus on the frame or pop-up window first before we can access elements within them. Let us take, for example, the web page &lt;a href="http://selenium.googlecode.com/svn/trunk/docs/api/java/index.html"&gt;http://selenium.googlecode.com/svn/trunk/docs/api/java/index.html&lt;/a&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image033.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	This page has 3 frames whose &amp;ldquo;name&amp;rdquo; attributes are indicated above. We wish to access the &amp;ldquo;Deprecated&amp;rdquo; link encircled above in yellow. In order to do that, we must first instruct WebDriver to switch to the &amp;ldquo;classFrame&amp;rdquo; frame using the &lt;strong&gt;&amp;ldquo;switchTo().frame()&amp;rdquo;&lt;/strong&gt; method. We will use the name attribute of the frame as the parameter for the &amp;ldquo;frame()&amp;rdquo; part.&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	package mypackage;&lt;br /&gt;
	&lt;br /&gt;
	import org.openqa.selenium.By;&lt;br /&gt;
	import org.openqa.selenium.WebDriver;&lt;br /&gt;
	import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;
	&lt;br /&gt;
	public class myclass {&lt;br /&gt;
	&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;public static void main(String[] args) {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WebDriver driver = new FirefoxDriver();&lt;br /&gt;
	&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; driver.get(&amp;quot;http://selenium.googlecode.com/svn/trunk/docs/api/java/index.html&amp;quot;);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; driver.switchTo().frame(&amp;quot;classFrame&amp;quot;);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; driver.findElement(By.linkText(&amp;quot;Deprecated&amp;quot;)).click();&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; driver.quit();&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
	}&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	After executing this code, you will see that the &amp;ldquo;classFrame&amp;rdquo; frame is taken to the &amp;ldquo;Deprecated API&amp;rdquo; page, meaning that our code was successfully able to access the &amp;ldquo;Deprecated&amp;rdquo; link.&lt;/p&gt;
&lt;h2&gt;
	Switching Between Pop-up Windows&lt;/h2&gt;
&lt;p&gt;
	WebDriver allows pop-up windows like alerts to be displayed, unlike in Selenium IDE. To access the elements within the alert (such as the message it contains), we must use the &lt;strong&gt;&amp;ldquo;switchTo().alert()&amp;rdquo;&lt;/strong&gt; method. In the code below, we will use this method to access the alert box and then retrieve its message using the &lt;strong&gt;&amp;ldquo;getText()&amp;rdquo;&lt;/strong&gt; method, and then automatically close the alert box using the &lt;strong&gt;&amp;ldquo;switchTo().alert().accept()&amp;rdquo;&lt;/strong&gt; method.&lt;/p&gt;
&lt;p&gt;
	First,&amp;nbsp; head over to &lt;a href="http://jsbin.com/usidix/1"&gt;http://jsbin.com/usidix/1&lt;/a&gt; and manually click the &amp;ldquo;Go!&amp;rdquo; button there and see for yourself the message text.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image037(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Lets see the WebDriver code to do this-&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	package mypackage;&lt;br /&gt;
	&lt;br /&gt;
	import org.openqa.selenium.By;&lt;br /&gt;
	import org.openqa.selenium.WebDriver;&lt;br /&gt;
	import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;
	&lt;br /&gt;
	public class myclass {&lt;br /&gt;
	&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;public static void main(String[] args) {&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WebDriver driver = new FirefoxDriver();&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String alertMessage = &amp;quot;&amp;quot;;&lt;br /&gt;
	&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; driver.get(&amp;quot;http://jsbin.com/usidix/1&amp;quot;);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; driver.findElement(By.cssSelector(&amp;quot;input[value=\&amp;quot;Go!\&amp;quot;]&amp;quot;)).click();&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alertMessage = driver.switchTo().alert().getText();&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; driver.switchTo().alert().accept();&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(alertMessage);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; driver.quit();&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
	}&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	On the Eclipse console, notice that the printed alert message is:&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image036(1).png" /&gt;&lt;/p&gt;
&lt;h2&gt;
	Waits&lt;/h2&gt;
&lt;p&gt;
	There are two kinds of waits.&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;
		Implicit wait &amp;ndash; used to set the default waiting time throughout the program&lt;/li&gt;
	&lt;li&gt;
		Explicit wait &amp;ndash; used to set the waiting time for a particular instance only&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
	Implicit Wait&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;
		It is simpler to code than Explicit Waits.&lt;/li&gt;
	&lt;li&gt;
		It is usually declared in the instantiation part of the code.&lt;/li&gt;
	&lt;li&gt;
		You will only need one additional package to import.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	To start using an implicit wait, you would have to import this package into your code.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image038(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Then on the instantiation part of your code, add this.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image039(1).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Explicit Wait&lt;/h3&gt;
&lt;p&gt;
	&lt;strong&gt;Explicit waits are done using the WebDriverWait and ExpectedCondition classes&lt;/strong&gt;. For the following example, we shall wait up to 10 seconds for an element whose id is &amp;ldquo;username&amp;rdquo; to become visible before proceeding to the next command. Here are the steps.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Import these two packages:&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;strong&gt;&lt;img alt="" src="http://www.guru99.com/images/image040(1).png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Declare a WebDriverWait variable. In this example, we will use &amp;ldquo;myWaitVar&amp;rdquo; as the name of the variable.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image041(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Use myWaitVar with ExpectedConditions on portions where you need the explicit wait to occur. In this case, we will use explicit wait on the &amp;ldquo;username&amp;rdquo; (Mercury Tours HomePage) input before we type the text &amp;ldquo;tutorial&amp;rdquo; onto it.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image042(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Conditions&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;
	Following&amp;nbsp; methods are used&amp;nbsp; in conditional and looping operations --&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		&lt;strong&gt;isEnabled()&lt;/strong&gt; is used when you want to verify whether a certain element is enabled or not before executing a command.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image043(1).png" /&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		&lt;strong&gt;isDisplayed()&lt;/strong&gt; is used when you want to verify whether a certain element is displayed or not before executing a command.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image044(1).png" /&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		&lt;strong&gt;isSelected()&lt;/strong&gt; is used when you want to verify whether a certain &lt;strong&gt;check box, radio button, or option in a drop-down box&lt;/strong&gt; is selected. It does not work on other elements.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image045.png" /&gt;&lt;/p&gt;
&lt;h2&gt;
	Using ExpectedConditions&lt;/h2&gt;
&lt;p&gt;
	The ExpectedConditions class offers a wider set of conditions that you can use in conjunction with WebDriverWait&amp;rsquo;s until() method.&lt;/p&gt;
&lt;p&gt;
	Below are some of the most common ExpectedConditions methods.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		&lt;strong&gt;alertIsPresent() &lt;/strong&gt;&amp;ndash; waits until an alert box is displayed.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image046(1).png" /&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		&lt;strong&gt;elementToBeClickable()&lt;/strong&gt; &amp;ndash; waits until an element is visible and, at the same time, enabled. The sample code below will wait until the element with id=&amp;rdquo;username&amp;rdquo; to become visible and enabled first before assigning that element as a WebElement variable named &amp;ldquo;txtUserName&amp;rdquo;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image047(1).png" /&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		&lt;strong&gt;frameToBeAvailableAndSwitchToIt() &lt;/strong&gt;&amp;ndash; waits until the given frame is already available, and then automatically switches to it.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image048(1).png" /&gt;&lt;/p&gt;
&lt;h2&gt;
	Catching Exceptions&lt;/h2&gt;
&lt;p&gt;
	When using isEnabled(), isDisplayed(), and isSelected(), WebDriver assumes that the element already exists on the page. Otherwise, it will throw a &lt;strong&gt;NoSuchElementException&lt;/strong&gt;. To avoid this, we should use a try-catch block so that the program will not be interrupted.&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	WebElement txtbox_username = driver.findElement(By.id(&amp;quot;username&amp;quot;));&lt;br /&gt;
	try{&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(txtbox_username.isEnabled()){&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; txtbox_username.sendKeys(&amp;quot;tutorial&amp;quot;);&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
	&amp;nbsp; &amp;nbsp; }&lt;/p&gt;
&lt;p&gt;
	catch(NoSuchElementException nsee){&lt;br /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(nsee.toString());&lt;br /&gt;
	&amp;nbsp;}&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	If you use explicit waits, the type of exception that you should catch is the &amp;ldquo;TimeoutException&amp;rdquo;.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image050(2).png" /&gt;&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Summary&lt;/h2&gt;
&lt;/div&gt;
&lt;ul class="checklist"&gt;
	&lt;li&gt;
		To start using the WebDriver API, you must import at least these two packages.&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		&lt;strong&gt;org.openqa.selenium.*&lt;/strong&gt;&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		&lt;strong&gt;org.openqa.selenium.firefox.FirefoxDriver&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;
		The &lt;strong&gt;get()&lt;/strong&gt; method is the equivalent of Selenium IDE&amp;rsquo;s &amp;ldquo;open&amp;rdquo; command.&lt;/li&gt;
	&lt;li&gt;
		Locating elements in WebDriver is done by using the &lt;strong&gt;findElement(By())&lt;/strong&gt; method.&lt;/li&gt;
	&lt;li&gt;
		The following are the available options for locating elements in WebDriver:&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		By.&lt;strong&gt;className&lt;/strong&gt;&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		By.&lt;strong&gt;cssSelector&lt;/strong&gt;&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		By.&lt;strong&gt;id&lt;/strong&gt;&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		By.&lt;strong&gt;linkText&lt;/strong&gt;&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		By.&lt;strong&gt;name&lt;/strong&gt;&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		By.&lt;strong&gt;partialLinkText&lt;/strong&gt;&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		By.&lt;strong&gt;tagName&lt;/strong&gt;&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		By.&lt;strong&gt;xpath&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;
		TheBy.cssSelector() &lt;strong&gt;does not&lt;/strong&gt; support the &lt;strong&gt;&amp;ldquo;contains&amp;rdquo;&lt;/strong&gt; feature.&lt;/li&gt;
	&lt;li&gt;
		You can instantiate an element using the &lt;strong&gt;WebElement&lt;/strong&gt; class.&lt;/li&gt;
	&lt;li&gt;
		Clicking on an element is done by using the &lt;strong&gt;click()&lt;/strong&gt; method.&lt;/li&gt;
	&lt;li&gt;
		WebDriver provides these useful &lt;strong&gt;get commands&lt;/strong&gt;:&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		get()&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		getTitle()&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		getPageSource()&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		getCurrentUrl()&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		getText()&lt;/li&gt;
	&lt;li&gt;
		WebDriver provides these useful &lt;strong&gt;navigation commands&lt;/strong&gt;&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		navigate().forward()&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		navigate().back()&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		navigate().to()&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		navigate().refresh()&lt;/li&gt;
	&lt;li&gt;
		The close() and quit() methods are used to close browser windows. &lt;strong&gt;Close()&lt;/strong&gt; is used to close a single window; while &lt;strong&gt;quit()&lt;/strong&gt; is used to close all windows associated to the parent window that the WebDriver object was controlling.&lt;/li&gt;
	&lt;li&gt;
		The &lt;strong&gt;switchTo().frame()&lt;/strong&gt; and &lt;strong&gt;switchTo().alert()&lt;/strong&gt; methods are used to direct WebDriver&amp;rsquo;s focus onto a frame or alert, respectively.&lt;/li&gt;
	&lt;li&gt;
		&lt;strong&gt;Implicit waits&lt;/strong&gt; are used to set the waiting time throughout the program, while &lt;strong&gt;explicit waits&lt;/strong&gt; are used only on specific portions.&lt;/li&gt;
	&lt;li&gt;
		You can use the &lt;strong&gt;isEnabled(), isDisplayed(),isSelected(),&lt;/strong&gt; and a combination of &lt;strong&gt;WebDriverWait&lt;/strong&gt; and &lt;strong&gt;ExpectedConditions&lt;/strong&gt; methods when verifying the state of an element. However, they do not verify if the element exists.&lt;/li&gt;
	&lt;li&gt;
		When isEnabled(), isDisplayed(),or isSelected() was called while the element was not existing, WebDriver will throw a &lt;strong&gt;NoSuchElementException&lt;/strong&gt;.&lt;/li&gt;
	&lt;li&gt;
		When WebDriverWait and ExpectedConditions methods were called while the element was not existing, WebDriver would throw a &lt;strong&gt;TimeoutException&lt;/strong&gt;.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;a href="http://www.guru99.com/installing-selenium-webdriver.html"&gt;Previous Tutorial&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href="http://www.guru99.com/selenium-tutorial.html"&gt;Back to Selenium Tutorials Index&amp;nbsp; Page&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href="http://www.guru99.com/accessing-forms-in-webdriver.html"&gt;Next Tutorial&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Guru99?a=PiD7mdw6FoA:3VSYczRjWDc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Guru99?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Guru99/~4/PiD7mdw6FoA" height="1" width="1"/&gt;</description>
            <author>support</author>
            <pubDate>2013-03-04T07:09:38+00:00</pubDate>
            <guid isPermaLink="false">http://www.guru99.com/first-webdriver-script.html</guid>
        <feedburner:origLink>http://www.guru99.com/first-webdriver-script.html</feedburner:origLink></item>
        <item>
            <title>Keyboard Mouse Events , Uploading Files - Webdriver</title>
            <link>http://feedproxy.google.com/~r/Guru99/~3/S-1KOobgHU4/keyboard-mouse-events-files-webdriver.html</link>
            <description>&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;table&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;/td&gt;
			&lt;td&gt;
				In this tutorial we will learn handling keyboard and mouse in Webdriver and deal with file uploads and downloads&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;
	Handling Keyboard &amp;amp; Mouse Events&lt;/h2&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/funny_pic(1).jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Handling special keyboard and mouse events are done using the Advanced User Interactions API&lt;/strong&gt;. It contains the &lt;strong&gt;Actions&lt;/strong&gt; and the &lt;strong&gt;Action&lt;/strong&gt; classes that are needed when executing these events. The following are the most commonly used keyboard and mouse events provided by the Actions class.&lt;/p&gt;
&lt;table align="center" border="1" cellpadding="0" cellspacing="0"&gt;
	&lt;tbody style=""&gt;
		&lt;tr bgcolor="#FFFFCC"&gt;
			&lt;td style="width: 246px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;Method&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 399px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;Description&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 246px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;clickAndHold()&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 399px;"&gt;
				&lt;p style="text-align: center;"&gt;
					Clicks (without releasing) at the current mouse location.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 246px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;contextClick()&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 399px;"&gt;
				&lt;p style="text-align: center;"&gt;
					Performs a context-click at the current mouse location.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 246px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;doubleClick()&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 399px;"&gt;
				&lt;p style="text-align: center;"&gt;
					Performs a double-click at the current mouse location.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 246px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;dragAndDrop(source, target)&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 399px;"&gt;
				&lt;p style="text-align: center;"&gt;
					Performs click-and-hold at the location of the source element, moves to the location of the target element, then releases the mouse.&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;Parameters:&lt;/strong&gt;&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em style=""&gt;source&lt;/em&gt;- element to emulate button down at.&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em style=""&gt;target&lt;/em&gt;- element to move to and release the mouse at.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 246px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;dragAndDropBy(source, x-offset, y-offset)&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 399px;"&gt;
				&lt;p style="text-align: center;"&gt;
					Performs click-and-hold at the location of the source element, moves by a given offset, then releases the mouse.&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;Parameters&lt;/strong&gt;:&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em style=""&gt;source&lt;/em&gt;- element to emulate button down at.&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em style=""&gt;xOffset&lt;/em&gt;- horizontal move offset.&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em style=""&gt;yOffset&lt;/em&gt;- vertical move offset.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 246px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;keyDown(modifier_key)&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 399px;"&gt;
				&lt;p style="text-align: center;"&gt;
					Performs a modifier key press. Does not release the modifier key - subsequent interactions may assume it&amp;#39;s kept pressed.&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;Parameters&lt;/strong&gt;:&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					modifier&lt;em style=""&gt;_key&lt;/em&gt; &amp;ndash; any of the modifier keys (Keys.ALT, Keys.SHIFT, or Keys.CONTROL)&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 246px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;keyUp(modifier _key)&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 399px;"&gt;
				&lt;p style="text-align: center;"&gt;
					Performs a key release.&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;Parameters&lt;/strong&gt;:&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					modifier&lt;em style=""&gt;_key&lt;/em&gt; &amp;ndash; any of the modifier keys (Keys.ALT, Keys.SHIFT, or Keys.CONTROL)&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 246px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;moveByOffset(x-offset, y-offset)&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 399px;"&gt;
				&lt;p style="text-align: center;"&gt;
					Moves the mouse from its current position (or 0,0) by the given offset.&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;Parameters&lt;/strong&gt;:&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em style=""&gt;x-offset&lt;/em&gt;- horizontal offset. A negative value means moving the mouse left.&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em style=""&gt;y-offset&lt;/em&gt;- vertical offset. A negative value means moving the mouse up.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 246px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;moveToElement(toElement)&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 399px;"&gt;
				&lt;p style="text-align: center;"&gt;
					Moves the mouse to the middle of the element. &lt;strong style=""&gt;Parameters&lt;/strong&gt;:&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em style=""&gt;toElement&lt;/em&gt;- element to move to.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 246px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;release()&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 399px;"&gt;
				&lt;p style="text-align: center;"&gt;
					Releases the depressed left mouse button at the current mouse location&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 246px;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;sendKeys(onElement, charsequence)&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 399px;"&gt;
				&lt;p style="text-align: center;"&gt;
					Sends a series of keystrokes onto the element. &lt;strong style=""&gt;Parameters&lt;/strong&gt;:&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em style=""&gt;onElement &lt;/em&gt;- element that will receive the keystrokes, usually a text field&lt;/p&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;em style=""&gt;charsequence &lt;/em&gt;&amp;ndash; any string value representing the sequence of keystrokes to be sent&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	In the following example, we shall use the moveToElement() method to mouse-over on one Mercury Tours&amp;rsquo; table rows. See the example below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image046.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	The cell shown above is a portion of a &amp;lt;TR&amp;gt; element. If not hovered, its color is #FFC455 (orange). After hovering, the cell&amp;rsquo;s color becomes transparent. It becomes the same color as the blue background of the whole orange table.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Import the &lt;strong&gt;Actions&lt;/strong&gt; and &lt;strong&gt;Action&lt;/strong&gt; classes.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image047.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Instantiate a new Actions object.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image048.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Instantiate an Action using the Actions object in step 2.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image049.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	In this case, we are going to use the moveToElement() method because we are simply going to mouse-over the &amp;ldquo;Home&amp;rdquo; link. The build() method is always the final method used so that all the listed actions will be compiled into a single step.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 4&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Use the perform() method when executing the Action object we designed in Step 3.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image050.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Below is the whole WebDriver code to check the background color of the &amp;lt;TR&amp;gt; element before and after the mouse-over.&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
	package mypackage;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	import org.openqa.selenium.*;&lt;/div&gt;
&lt;div&gt;
	import org.openqa.selenium.firefox.FirefoxDriver;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	import org.openqa.selenium.interactions.Action;&lt;/div&gt;
&lt;div&gt;
	import org.openqa.selenium.interactions.Actions;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	public class myclass {&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	public static void main(String[] args) {&lt;/div&gt;
&lt;div&gt;
	String baseUrl = &amp;quot;http://newtours.demoaut.com/&amp;quot;;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WebDriver driver = new FirefoxDriver();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; driver.get(baseUrl); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WebElement link_Home = driver.findElement(By.linkText(&amp;quot;Home&amp;quot;));&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WebElement td_Home = driver&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .findElement(By&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .xpath(&amp;quot;//html/body/div&amp;quot;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &amp;quot;/table/tbody/tr/td&amp;quot;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &amp;quot;/table/tbody/tr/td&amp;quot;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &amp;quot;/table/tbody/tr/td&amp;quot;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &amp;quot;/table/tbody/tr&amp;quot;)); &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Actions builder = new Actions(driver);&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Action mouseOverHome = builder&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .moveToElement(link_Home)&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .build();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String bgColor = td_Home.getCssValue(&amp;quot;background-color&amp;quot;);&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&amp;quot;Before hover: &amp;quot; + bgColor); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mouseOverHome.perform(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bgColor = td_Home.getCssValue(&amp;quot;background-color&amp;quot;);&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&amp;quot;After hover: &amp;quot; + bgColor);&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; driver.quit();&lt;/div&gt;
&lt;div&gt;
	}&lt;/div&gt;
&lt;div&gt;
	}&lt;/div&gt;
&lt;div&gt;
	&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	The output below clearly states that the background color became transparent after the mouse-over.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image052.png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Building a Series of Multiple Actions&lt;/h3&gt;
&lt;p&gt;
	&lt;strong&gt;You can build a series of actions using the Action and Actions classes&lt;/strong&gt;. Just remember to close the series with the build() method. Consider the sample code below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image053.png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image054.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Uploading Files&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;
	For this section, we will use &lt;a href="http://www.megafileupload.com/"&gt;http://www.megafileupload.com/&lt;/a&gt; as our test application. This site easily allows any visitor to upload and download files without requiring them to sign up.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Uploading files in WebDriver is done by simply using the sendKeys() method on the file-select input field to enter the path to the file to be uploaded. &lt;/strong&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image055.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Let&amp;rsquo;s say we wish to upload the file &amp;ldquo;C:\newhtml.html&amp;rdquo;. Our WebDriver code should be like the one shown below.&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	package mypackage;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	import org.openqa.selenium.*;&lt;/div&gt;
&lt;div&gt;
	import org.openqa.selenium.firefox.FirefoxDriver;&lt;/div&gt;
&lt;div&gt;
	public class myclass {&lt;/div&gt;
&lt;div&gt;
	public static void main(String[] args) {&lt;/div&gt;
&lt;div&gt;
	String baseUrl = &amp;quot;http://www.megafileupload.com/&amp;quot;;&lt;/div&gt;
&lt;div&gt;
	WebDriver driver = new FirefoxDriver();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	driver.get(baseUrl);&lt;/div&gt;
&lt;div&gt;
	WebElement uploadElement = driver.findElement(By.id(&amp;quot;uploadfile_0&amp;quot;));&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	// enter the file path onto the file-selection input field&lt;/div&gt;
&lt;div&gt;
	uploadElement.sendKeys(&amp;quot;C:\\newhtml.html&amp;quot;);&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	// check the &amp;quot;I accept the terms of service&amp;quot; check box&lt;/div&gt;
&lt;div&gt;
	driver.findElement(By.id(&amp;quot;terms&amp;quot;)).click();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	// click the &amp;quot;UploadFile&amp;quot; button&lt;/div&gt;
&lt;div&gt;
	driver.findElement(By.name(&amp;quot;send&amp;quot;)).click();&lt;/div&gt;
&lt;div&gt;
	}&lt;/div&gt;
&lt;div&gt;
	}&lt;/div&gt;
&lt;div&gt;
	&lt;/div&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	After running this script, you should be able to upload the file successfully and you should get a message similar to this.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image057.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Remember following two things when uploading files in WebDriver&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;
		There is no need to simulate the clicking of the &amp;ldquo;Browse&amp;rdquo; button.&amp;nbsp; WebDriver automatically enters the file path onto the file-selection text box of the &amp;lt;input type=&amp;rdquo;file&amp;rdquo;&amp;gt; element&lt;/li&gt;
	&lt;li&gt;
		When setting the file path in your Java IDE, use the proper escape character for the back-slash.&lt;/li&gt;
&lt;/ol&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image058.png" /&gt;&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Downloading Files&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;
	&lt;strong&gt;WebDriver has no capability to access the Download dialog boxes&lt;/strong&gt;presented by browsers when you click on a download link or button. However, we can bypass these dialog boxes using a separate program called &amp;ldquo;wget&amp;rdquo;.&lt;/p&gt;
&lt;h3&gt;
	What is Wget?&lt;/h3&gt;
&lt;p&gt;
	&lt;strong&gt;Wget is a small and easy-to-use command-line program used to automate downloads&lt;/strong&gt;. Basically, we will access Wget from our WebDriver script to perform the download process. &amp;nbsp;&lt;/p&gt;
&lt;h3&gt;
	&lt;strong&gt;Setting up Wget&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;
	&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	In your C Drive, create a new folder and name it as &amp;ldquo;Wget&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;
	Download wget.exe &lt;a href="http://users.ugent.be/~bpuype/cgi-bin/fetch.pl?dl=wget/wget.exe "&gt;here&lt;/a&gt;&amp;nbsp;and place it in the Wget folder you created from the step above.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Bring up the System Properties window by pressing Win + Pause on your keyboard.&lt;/p&gt;
&lt;p&gt;
	Click on &amp;ldquo;Advanced System Settings&amp;rdquo;.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image059.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Click on the &amp;ldquo;Environment Variables&amp;rdquo;.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/3-2-2013_4-59-04_PM.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	In the Environment Variables dialog box, in the &amp;ldquo;System variables&amp;rdquo; section, scroll down the list until you find &amp;ldquo;Path&amp;rdquo; and then double-click it.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image061.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 4&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	In the &amp;ldquo;Variable value&amp;rdquo; text box, add the new path &amp;ldquo;C:\Wget\&amp;rdquo;. Just be sure that there is a semi-colon separating this new entry from the preexisting values.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image062.png" style="text-align: center;" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 5&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Click OK on all dialog boxes.&lt;/p&gt;
&lt;p&gt;
	Launch the command prompt and type the command &amp;ldquo;wget&amp;rdquo;. You should get the following response.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image063.png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Using WebDriver and Wget&lt;/h3&gt;
&lt;p&gt;
	In the following example, we will use WebDriver and wget to download a popular chat software called Yahoo Messenger. Our base URL shall be &lt;a href="http://messenger.yahoo.com/"&gt;http://messenger.yahoo.com/&lt;/a&gt;.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image064.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Import the &amp;ldquo;java.io.IOException&amp;rdquo; package because we will have to catch an IOException later in Step 4.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image065.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Use getCssAttribute() to obtain the &amp;ldquo;href&amp;rdquo; value of the download link and save it as a String variable. In this case, we named the variable as &amp;ldquo;sourceLocation&amp;rdquo;.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image066.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Set-up the syntax for wget using the following command.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image067.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 4&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Initiate the download process by calling wget from our WebDriver code.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image068.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	To sum it all up, your WebDriver code could look like the one shown below.&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	package mypackage;&lt;/p&gt;
&lt;p&gt;
	import java.io.IOException;&lt;/p&gt;
&lt;div&gt;
	import org.openqa.selenium.*;&lt;/div&gt;
&lt;div&gt;
	import org.openqa.selenium.firefox.FirefoxDriver;&lt;/div&gt;
&lt;div&gt;
	public class myclass {&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	public static void main(String[] args) {&lt;/div&gt;
&lt;div&gt;
	String baseUrl = &amp;quot;http://messenger.yahoo.com/&amp;quot;;&lt;/div&gt;
&lt;div&gt;
	WebDriver driver = new FirefoxDriver();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	driver.get(baseUrl);&lt;/div&gt;
&lt;div&gt;
	WebElement downloadButton = driver.findElement(By&lt;/div&gt;
&lt;div&gt;
	.id(&amp;quot;messenger-download&amp;quot;));&lt;/div&gt;
&lt;div&gt;
	String sourceLocation = downloadButton.getAttribute(&amp;quot;href&amp;quot;);&lt;/div&gt;
&lt;div&gt;
	String wget_command = &amp;quot;cmd /c wget -P c: &amp;quot; + sourceLocation;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	try {&lt;/div&gt;
&lt;div&gt;
	Process exec = Runtime.getRuntime().exec(wget_command);&lt;/div&gt;
&lt;div&gt;
	int exitVal = exec.waitFor();&lt;/div&gt;
&lt;div&gt;
	System.out.println(&amp;quot;Exit value: &amp;quot; + exitVal);&lt;/div&gt;
&lt;div&gt;
	} catch (InterruptedException | IOException ex) {&lt;/div&gt;
&lt;div&gt;
	System.out.println(ex.toString());&lt;/div&gt;
&lt;div&gt;
	}&lt;/div&gt;
&lt;div&gt;
	driver.quit();&lt;/div&gt;
&lt;div&gt;
	}&lt;/div&gt;
&lt;div&gt;
	}&lt;/div&gt;
&lt;div&gt;
	&lt;/div&gt;
&lt;p&gt;
	After executing this code, check your C drive and verify that the Yahoo Messenger installer was successfully downloaded there.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/3-2-2013_5-03-28_PM.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Summary&lt;/h2&gt;
&lt;/div&gt;
&lt;ul class="checklist"&gt;
	&lt;li&gt;
		Handling special keyboard and mouse events are done using the AdvancedUserInteractions API.&lt;/li&gt;
	&lt;li&gt;
		Uploading files in WebDriver is done by simply using the sendKeys() method on the file-select input field to enter the path to the file to be uploaded.&lt;/li&gt;
	&lt;li&gt;
		WebDriver cannot automate downloading of files on its own.&lt;/li&gt;
	&lt;li&gt;
		The eaasiest way to download files using WebDriver is to use Wget.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;a href="http://www.guru99.com/accessing-links-tables-selenium-webdriver.html"&gt;Previous Tutorial&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href="http://www.guru99.com/selenium-tutorial.html"&gt;Back to Selenium Tutorials Index&amp;nbsp; Page&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href="http://www.guru99.com/all-about-testng-and-selenium.html"&gt;Next Tutorial&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Guru99?a=S-1KOobgHU4:RoZVjngNtWE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Guru99?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Guru99/~4/S-1KOobgHU4" height="1" width="1"/&gt;</description>
            <author>support</author>
            <pubDate>2013-03-02T09:45:44+00:00</pubDate>
            <guid isPermaLink="false">http://www.guru99.com/keyboard-mouse-events-files-webdriver.html</guid>
        <feedburner:origLink>http://www.guru99.com/keyboard-mouse-events-files-webdriver.html</feedburner:origLink></item>
        <item>
            <title>Accessing Links &amp; Tables  - Selenium Webdriver</title>
            <link>http://feedproxy.google.com/~r/Guru99/~3/P-zgMarMKQ0/accessing-links-tables-selenium-webdriver.html</link>
            <description>&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;table&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;/td&gt;
			&lt;td&gt;
				&lt;p&gt;
					In this tutorial, we are going to learn about accessing links &amp;amp; Tables using Webdriver&lt;/p&gt;
				&lt;p&gt;
					&amp;nbsp;&lt;/p&gt;
				&lt;div&gt;
					&amp;nbsp;&lt;/div&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;
	Accessing Links&lt;/h2&gt;
&lt;h3&gt;
	Links Matching a Criterion&lt;/h3&gt;
&lt;p&gt;
	Links can be accessed using an exact or partial match of their link text. The examples below provide scenarios where multiple matches would exist, and would explain how WebDriver would deal with them.&lt;/p&gt;
&lt;h3&gt;
	Exact Match&lt;/h3&gt;
&lt;p&gt;
	&lt;strong&gt;Accessing links using their exact link text is done through the By.linkText() method&lt;/strong&gt;. However, if there are two links that have the very same link text, this method will only access the first one. Consider the HTML code below&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image002.png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image003(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	When you try to run the WebDriver code below, you will be accessing the first &amp;ldquo;click here&amp;rdquo; link&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	.&lt;img alt="" src="http://www.guru99.com/images/image004(1).png" style="text-align: center;" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	As a result, you will automatically be taken to Google.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image005(1).png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;
	Partial Match&lt;/h3&gt;
&lt;p&gt;
	Accessing links using a portion of their link text is done using the &lt;strong&gt;By.partialLinkText() &lt;/strong&gt;method. If you specify a partial link text that has multiple matches, only the first match will be accessed. Consider the HTML code below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image006(1).png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image007(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	When you execute the WebDriver code below, you will still be taken to Google.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image008(1).png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image009(1).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Case-sensitivity&lt;/h3&gt;
&lt;p&gt;
	The parameters for &lt;strong&gt;By.linkText()&lt;/strong&gt; and &lt;strong&gt;By.partialLinkText() &lt;/strong&gt;are both case-sensitive, meaning that capitalization matters. For example, in Mercury Tours&amp;rsquo; homepage, there are two links that contain the text &amp;ldquo;egis&amp;rdquo; &amp;ndash; one is the &amp;ldquo;REGISTER&amp;rdquo; link found at the top menu, and the other is the &amp;ldquo;Register here&amp;rdquo; link found at the lower right portion of the page.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image010(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Though both links contain the character sequence &amp;ldquo;egis&amp;rdquo;, the &amp;quot;By.partialLinkText()&amp;quot; method will access these two links separately depending on capitilization of the characters. See the sample code below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image011(1).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	All Links&lt;/h3&gt;
&lt;p&gt;
	One of the common procedures in web testing is to test if all the links present within the page are working. This can be conveniently done using a combination of the &lt;strong&gt;Java for-each loop&lt;/strong&gt; and the &lt;strong&gt;By.tagName(&amp;ldquo;a&amp;rdquo;)&lt;/strong&gt; method. The WebDriver code below checks each link from the Mercury Tours homepage to determine those that are working and those that are still under construction.&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	package practice_webdriver;&lt;/p&gt;
&lt;p&gt;
	import java.util.List;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
	import java.util.concurrent.TimeUnit;&lt;/div&gt;
&lt;div&gt;
	import org.openqa.selenium.*;&lt;/div&gt;
&lt;div&gt;
	import org.openqa.selenium.firefox.FirefoxDriver;&lt;/div&gt;
&lt;div&gt;
	import org.openqa.selenium.support.ui.ExpectedConditions;&lt;/div&gt;
&lt;div&gt;
	import org.openqa.selenium.support.ui.WebDriverWait;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	public class AllLinks {&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; public static void main(String[] args) {&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String baseUrl = &amp;quot;http://newtours.demoaut.com/&amp;quot;;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WebDriver driver = new FirefoxDriver();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String underConsTitle = &amp;quot;Under Construction: Mercury Tours&amp;quot;;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; driver.get(baseUrl);&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; List&amp;lt;WebElement&amp;gt; linkElements = driver.findElements(By.tagName(&amp;quot;a&amp;quot;));&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String[] linkTexts = new String[linkElements.size()];&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int i = 0;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //extract the link texts of each link element&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (WebElement e : linkElements) {&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; linkTexts[i] = e.getText();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; i++;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //test each link&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (String t : linkTexts) {&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; driver.findElement(By.linkText(t)).click();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (driver.getTitle().equals(underConsTitle)) {&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&amp;quot;\&amp;quot;&amp;quot; + t + &amp;quot;\&amp;quot;&amp;quot;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &amp;quot; is under construction.&amp;quot;);&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } else {&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&amp;quot;\&amp;quot;&amp;quot; + t + &amp;quot;\&amp;quot;&amp;quot;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; + &amp;quot; is working.&amp;quot;);&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; driver.navigate().back();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; driver.quit();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
	}&lt;/div&gt;
&lt;div&gt;
	&lt;/div&gt;
&lt;p&gt;
	The output should be similar to the one indicated below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image013(1).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Links Outside and Inside a Block&lt;/h3&gt;
&lt;p&gt;
	The latest HTML5 standard allows the &amp;lt;a&amp;gt; tags to be placed inside and outside of block-level tags like &amp;lt;div&amp;gt;, &amp;lt;p&amp;gt;, or &amp;lt;h1&amp;gt;. The &amp;quot;By.linkText()&amp;quot; and &amp;quot;By.partialLinkText()&amp;quot; methods can access a link located outside and inside these block-level elements. Consider the HTML code below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image014(1).png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image015(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	The WebDriver code below accesses both of these links using By.partialLinkText() method.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image016(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	The output above confirms that both links were accessed successfully because their respective page titles were retrieved correctly.&lt;/p&gt;
&lt;h3&gt;
	Accessing Image Links&lt;/h3&gt;
&lt;p&gt;
	Image links are images that act as references to other sites or sections within the same page. Since they are images, we cannot use the By.linkText() and By.partialLinkText() methods because image links basically have no link texts at all. In this case, we should resort to using either By.cssSelector or By.xpath. The first method is more preferred because of its simplicity.&lt;/p&gt;
&lt;p&gt;
	In the example below, we will access the &amp;ldquo;Facebook&amp;rdquo; logo on the upper left portion of Facebook&amp;rsquo;s Password Recovery page.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image017(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	We will use By.cssSelector and the element&amp;rsquo;s &amp;ldquo;title&amp;rdquo; attribute to access the image link. And then we will verify if we are taken to Facebook&amp;rsquo;s homepage.&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	package practice_webdriver;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
	import org.openqa.selenium.*;&lt;/div&gt;
&lt;div&gt;
	import org.openqa.selenium.firefox.FirefoxDriver;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	public class ImageLink {&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; public static void main(String[] args) {&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String baseUrl = &amp;quot;https://www.facebook.com/login/identify?ctx=recover&amp;quot;;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WebDriver driver = new FirefoxDriver();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; driver.get(baseUrl);&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //click on the &amp;quot;Facebook&amp;quot; logo on the upper left portion&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; driver.findElement(By.cssSelector(&amp;quot;a[title=\&amp;quot;Go to Facebook Home\&amp;quot;]&amp;quot;)).click();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //verify that we are now back on Facebook&amp;#39;s homepage&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (driver.getTitle().equals(&amp;quot;Welcome to Facebook - Log In, Sign Up or Learn More&amp;quot;)) {&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&amp;quot;We are back at Facebook&amp;#39;s homepage&amp;quot;);&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } else {&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&amp;quot;We are NOT in Facebook&amp;#39;s homepage&amp;quot;);&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; driver.quit();&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
	}&lt;/div&gt;
&lt;div&gt;
	&lt;/div&gt;
&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
	Result&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image018(2).png" /&gt;&lt;/div&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Reading a Table&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;
	There are times when we need to access elements (usually texts) that are within HTML tables. However, it is very seldom for a web designer to provide an id or name attribute to a certain cell in the table. Therefore, we cannot use the usual methods such as &amp;ldquo;By.id()&amp;rdquo;, &amp;ldquo;By.name()&amp;rdquo;, or &amp;ldquo;By.cssSelector()&amp;rdquo;. In this case, the most reliable option is to access them using the &amp;ldquo;By.xpath()&amp;rdquo; method.&lt;/p&gt;
&lt;h3&gt;
	XPath Syntax&lt;/h3&gt;
&lt;p&gt;
	Consider the HTML code below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image019(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	We will use XPath to get the inner text of the cell containing the text &amp;ldquo;fourth cell&amp;rdquo;.&amp;nbsp;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image020(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 1 &amp;ndash; Set the Parent Element (table)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;XPath locators in WebDriver always start with a double forward slash &amp;ldquo;//&amp;rdquo; and then followed by the parent element&lt;/strong&gt;. Since we are dealing with tables, the parent element should always be the &amp;lt;table&amp;gt; tag. The first portion of our XPath locator should therefore start with &amp;ldquo;//table&amp;rdquo;.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image021(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 2 &amp;ndash; Add the child elements&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	The element immediately under &amp;lt;table&amp;gt; is &amp;lt;tbody&amp;gt; so we can say that &amp;lt;tbody&amp;gt; is the &amp;ldquo;child&amp;rdquo; of &amp;lt;table&amp;gt;. And also, &amp;lt;table&amp;gt; is the &amp;ldquo;parent&amp;rdquo; of &amp;lt;tbody&amp;gt;. All child elements in XPath are placed to the right of their parent element, separated with one forward slash &amp;ldquo;/&amp;rdquo; like the code shown below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image022(1).png" /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;img alt="" src="http://www.guru99.com/images/image023.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 3 &amp;ndash; Add Predicates&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	The &amp;lt;tbody&amp;gt; element contains two &amp;lt;tr&amp;gt; tags. We can now say that these two &amp;lt;tr&amp;gt; tags are &amp;ldquo;children&amp;rdquo; of &amp;lt;tbody&amp;gt;. Consequently, we can say that &amp;lt;tbody&amp;gt; is the parent of both the &amp;lt;tr&amp;gt; elements.&lt;/p&gt;
&lt;p&gt;
	Another thing we can conclude is that the two &amp;lt;tr&amp;gt; elements are siblings. &lt;strong&gt;Siblings refer to child elements having the same parent&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;
	To get to the &amp;lt;td&amp;gt; we wish to access (the one with the text &amp;ldquo;fourth cell&amp;rdquo;), we must first access the &lt;strong&gt;second&lt;/strong&gt; &amp;lt;tr&amp;gt; and not the first. If we simply write &amp;ldquo;//table/tbody/tr&amp;rdquo;, then we will be accessing the first &amp;lt;tr&amp;gt; tag.&lt;/p&gt;
&lt;p&gt;
	So, how do we access the second &amp;lt;tr&amp;gt; then? The answer to this is to use &lt;strong&gt;Predicates&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Predicates are numbers or HTML attributes enclosed in a pair of square brackets &amp;ldquo;[ ]&amp;rdquo; that distinguish a child element from its siblings&lt;/strong&gt;. Since the &amp;lt;tr&amp;gt; we need to access is the second one, we shall use &amp;ldquo;[2]&amp;rdquo; as the predicate.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image024.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	If we won&amp;rsquo;t use any predicate, XPath will access the first sibling. Therefore, we can access the first &amp;lt;tr&amp;gt; using either of these XPath codes.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image025.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 4 &amp;ndash; Add the Succeeding Child Elements Using the Appropriate Predicates&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	The next element we need to access is the second &amp;lt;td&amp;gt;. Applying the principles we have learned from steps 2 and 3, we will finalize our XPath code to be like the one shown below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image026.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Now that we have the correct XPath locator, we can already access the cell that we wanted to and obtain its inner text using the code below. It assumes that you have saved the HTML code above as &amp;ldquo;newhtml.html&amp;rdquo; within your C Drive.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image027.png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image028.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Accessing Nested Tables&lt;/h2&gt;
&lt;p&gt;
	The same principles discussed above applies to nested tables. &lt;strong&gt;Nested tables are tables located within another table&lt;/strong&gt;. An example is shown below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image029.png" /&gt;&lt;img alt="" src="http://www.guru99.com/images/image030.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	To access the cell with the text &amp;ldquo;4-5-6&amp;rdquo; using the &amp;ldquo;//parent/child&amp;rdquo; and predicate concepts from the previous section, we should be able to come up with the XPath code below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image031.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	The WebDriver code below should be able to retrieve the inner text of the cell which we are accessing.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image008(2).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	The output below confirms that the inner table was successfully accessed.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image009(2).png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Using Attributes as Predicates&lt;/h3&gt;
&lt;p&gt;
	If the element is written deep within the HTML code such that the number to use for the predicate is very difficult to determine, we can use that element&amp;rsquo;s unique attribute instead.&lt;/p&gt;
&lt;p&gt;
	In the example below, the &amp;ldquo;New York to Chicago&amp;rdquo; cell is located deep into Mercury Tours homepage&amp;rsquo;s HTML code.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image034.png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/burried_deep.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	In this case, we can use the table&amp;rsquo;s unique attribute (width=&amp;rdquo;270&amp;rdquo;) as the predicate. &lt;strong&gt;Attributes are used as predicates by prefixing them with the @ symbol&lt;/strong&gt;. In the example above, the &amp;ldquo;New York to Chicago&amp;rdquo; cell is located in the first &amp;lt;td&amp;gt; of the fourth &amp;lt;tr&amp;gt;, and so our XPath should be as shown below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image036.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Remember that when we put the XPath code in Java, we should use the escape character backward slash &amp;ldquo;\&amp;rdquo; for the double quotation marks on both sides of &amp;ldquo;270&amp;rdquo; so that the string argument of By.xpath() will not be terminated prematurely.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image037.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	We are now ready to access that cell using the code below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image038.png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image039.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;
	Shortcut: Use Firebug&lt;/h2&gt;
&lt;p&gt;
	If the number or attribute of an element is extremely difficult or impossible to obtain, the quickest way to generate the XPath code is thru Firebug.&lt;/p&gt;
&lt;p&gt;
	Consider the example below from Mercury Tours homepage.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image040.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Use Firebug to obtain the XPath code.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image041.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Look for the first &amp;ldquo;table&amp;rdquo; parent element and delete everything to the left of it.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image042.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Prefix the remaining portion of the code with double forward slash &amp;ldquo;//&amp;rdquo; and copy it over to your WebDriver code.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image043.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	The WebDriver code below will be able to successfully retrieve the inner text of the element we are accessing.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/image044.png" /&gt;&lt;/p&gt;
&lt;h2&gt;
	Summary&lt;/h2&gt;
&lt;ul class="checklist"&gt;
	&lt;li&gt;
		Accessing links using their exact match is done using By.linkText() method.&lt;/li&gt;
	&lt;li&gt;
		Accessing links using their partial match is done using By.partialLinkText() method.&lt;/li&gt;
	&lt;li&gt;
		If there are multiple matches, By.linkText() and By.partialLinkText() will only select the first match.&lt;/li&gt;
	&lt;li&gt;
		Pattern matching using By.linkText() and By.partialLinkText() is case-sensitive.&lt;/li&gt;
	&lt;li&gt;
		The By.tagName(&amp;quot;a&amp;quot;) method is used to fetch all links within a page.&lt;/li&gt;
	&lt;li&gt;
		Links can be accessed by the By.linkText() and By.partialLinkText() whether they are inside or outside block-level elements.&lt;/li&gt;
	&lt;li&gt;
		Accessing image links are done using By.cssSelector() and By.xpath() methods.&lt;/li&gt;
	&lt;li&gt;
		By.xpath() is commonly used to access table elements.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;a href="http://www.guru99.com/accessing-forms-in-webdriver.html"&gt;Previous Tutorial&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href="http://www.guru99.com/selenium-tutorial.html"&gt;Back to Selenium Tutorials Index&amp;nbsp; Page&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href="http://www.guru99.com/keyboard-mouse-events-files-webdriver.html"&gt;Next Tutorial&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Guru99?a=P-zgMarMKQ0:7N0gOo1L_pY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Guru99?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Guru99/~4/P-zgMarMKQ0" height="1" width="1"/&gt;</description>
            <author>support</author>
            <pubDate>2013-03-02T08:28:36+00:00</pubDate>
            <guid isPermaLink="false">http://www.guru99.com/accessing-links-tables-selenium-webdriver.html</guid>
        <feedburner:origLink>http://www.guru99.com/accessing-links-tables-selenium-webdriver.html</feedburner:origLink></item>
        <item>
            <title>All about TestNG and Selenium</title>
            <link>http://feedproxy.google.com/~r/Guru99/~3/H8DDPRGd31M/all-about-testng-and-selenium.html</link>
            <description>&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;table&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;/td&gt;
			&lt;td&gt;
				&lt;div&gt;
					&lt;h2&gt;
						What is TestNG?&lt;/h2&gt;
				&lt;/div&gt;
				&lt;p&gt;
					So far we had been doing Selenium tests without generating a proper format for the test results. From this point on, we shall tackle how to make these reports using a test framework called TestNG.&lt;/p&gt;
				&lt;p&gt;
					TestNG is a testing framework that overcomes the limitations of another popular testing framework called JUnit. The &amp;ldquo;NG&amp;rdquo; means &amp;ldquo;Next Generation&amp;rdquo;. Most Selenium users use this more than JUnit because of its advantages. There are so many features of TestNG, but we will only focus on the most important ones that we can use in Selenium.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;
	Advantages of TestNG over JUnit&lt;/h2&gt;
&lt;p&gt;
	There are three major advantages of TestNG over JUnit:&lt;/p&gt;
&lt;ul&gt;
	&lt;li style="margin-left: 0.2in;"&gt;
		&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Annotations are easier to understand&lt;/li&gt;
	&lt;li style="margin-left: 0.2in;"&gt;
		&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test cases can be grouped more easily&lt;/li&gt;
	&lt;li style="margin-left: 0.2in;"&gt;
		&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Parallel testing is possible&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&lt;strong&gt;Annotations in TestNG are lines of code that can control how the method below them will be executed&lt;/strong&gt;. They are always preceded by the @ symbol. A very early and quick example is the one shown below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/annotations_1-0000.png" style="text-align: center;" /&gt;&lt;/p&gt;
&lt;p&gt;
	Annotations will be discussed later in the section named &amp;ldquo;Annotations used in TestNG&amp;rdquo;, so it is perfectly ok if you do not understand the above example just yet. It is just important to note for now that annotations in TestNG are easier to code and understand than in JUnit.&lt;/p&gt;
&lt;p&gt;
	The ability to run tests in parallel is available in TestNG but not in JUnit, so it is the more preferred framework of testers using Selenium Grid.&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Why do we need TestNG in Selenium?&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;
	TestNG can generate reports based on our Selenium test results.&lt;/p&gt;
&lt;ul&gt;
	&lt;li style="margin-left: 40px;"&gt;
		WebDriver has no native mechanism for generating reports.&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		TestNG can generate the report in a readable format like the one shown below.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/report-0057.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	TestNG simplifies the way the tests are coded&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		There is no more need for a static main method in our tests. The sequence of actions is regulated by easy-to-understand annotations that do not require methods to be static.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/usual_structure-0059.png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/testng_structure-0058.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Uncaught exceptions are automatically handled by TestNG without terminating the test prematurely. These exceptions are reported as failed steps in the report.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
	&lt;h2&gt;
		Installing TestNG in Eclipse&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;
	&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Launch Eclipse.&lt;/li&gt;
	&lt;li&gt;
		On the menu bar, click Help.&lt;/li&gt;
	&lt;li&gt;
		Choose the &amp;ldquo;Install New Software&amp;hellip;&amp;rdquo; option.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_1-0046.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	In the Install dialog box, click the Add button&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_2-0047.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
	&lt;li style="margin-left: 40px;"&gt;
		In &amp;ldquo;Name&amp;rdquo;, type TestNG.&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		In &amp;ldquo;Location&amp;rdquo;, type &lt;a href="http://beust.com/eclipse"&gt;http://beust.com/eclipse&lt;/a&gt;.&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		Click OK&lt;/li&gt;
&lt;/ol&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_3-0048.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 4&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Notice that &amp;ldquo;TestNG - &lt;a href="http://beust.com/eclipse"&gt;http://beust.com/eclipse&lt;/a&gt;&amp;rdquo; was populated onto the &amp;ldquo;Work with:&amp;rdquo; textbox.&lt;/li&gt;
	&lt;li&gt;
		Check the &amp;ldquo;TestNG&amp;rdquo; check box as shown below, then click Next.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_4-0049.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 5&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Click Next again on the succeeding dialog box until you reach the License Agreement dialog.&lt;/li&gt;
	&lt;li&gt;
		Click &amp;ldquo;I accept the terms of the license agreement&amp;rdquo; then click Finish.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_5-0050.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 6&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Wait for the installation to finish&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_6-0052.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	If you encounter a Security warning, just click OK&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_6_b-0051.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 7&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	When Eclipse prompts you for a restart, just click Yes.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_7-0053.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 8&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	After restart, verify if TestNG was indeed successfully installed. Click Window &amp;gt; Preferences and see if TestNG is included on the Preferences list.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_8-0056.png" /&gt;&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		First test case using annotations&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;
	Before we create a test case, we should first setup a new TestNG Project in Eclipse and name it as &amp;ldquo;FirstTestNGProject&amp;rdquo;.&lt;/p&gt;
&lt;h3&gt;
	Setting up a new TestNG Project&lt;/h3&gt;
&lt;p&gt;
	&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Click File &amp;gt; New &amp;gt; Java Project&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_1-0034.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Type &amp;ldquo;FirstTestNGProject&amp;rdquo; as the Project Name then click Next.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_2-0037.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	We will now start to import the TestNG Libraries onto our project. Click on the &amp;ldquo;Libraries&amp;rdquo; tab, and then &amp;ldquo;Add Library&amp;hellip;&amp;rdquo;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_3-0038.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 4&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	On the Add Library dialog, choose &amp;ldquo;TestNG&amp;rdquo; and click Next.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_4-0039.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 5&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Click Finish.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_5-0041.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	You should notice that TestNG is included on the Libraries list.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_5_b-0040.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 6&lt;/strong&gt;&lt;/p&gt;
&lt;p class="Normal-Guru99"&gt;
	We will now add the JAR files that contain the Selenium API. These files are found in the Java client driver that we downloaded from &lt;span lang="EN-PH"&gt;&lt;a href="http://docs.seleniumhq.org/download/"&gt;&lt;span lang="EN-US"&gt;http://docs.seleniumhq.org/download/&lt;/span&gt;&lt;/a&gt;&lt;/span&gt; when we were installing Selenium and Eclipse in the previous chapters.&lt;/p&gt;
&lt;p class="Normal-Guru99" style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_6a.png" /&gt;&lt;/p&gt;
&lt;p class="Normal-Guru99"&gt;
	&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class="Normal-Guru99"&gt;
	Then, navigate to where you have placed the Selenium JAR files.&lt;/p&gt;
&lt;p class="Normal-Guru99"&gt;
	&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_6b.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p class="Normal-Guru99"&gt;
	After adding the external JARs, your screen should look like this.&lt;/p&gt;
&lt;p class="Normal-Guru99"&gt;
	&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_6c.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 7&lt;/strong&gt;&lt;/p&gt;
&lt;p class="Normal-Guru99"&gt;
	Click Finish and verify that our FirstTestNGProject is visible on Eclipse&amp;rsquo;s Package Explorer window.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_7-0045.png" /&gt;&lt;/p&gt;
&lt;h2&gt;
	Creating a New TestNG Test File&lt;/h2&gt;
&lt;p&gt;
	Now that we are done setting up our project, let us create a new TestNG file.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Right-click on the &amp;ldquo;src&amp;rdquo; package folder then choose New &amp;gt; Other&amp;hellip;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_1-0029.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Click on the TestNG folder and select the &amp;ldquo;TestNG class&amp;rdquo; option. Click Next.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_2-0030.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Type the values indicated below on the appropriate input boxes and click Finish. Notice that we have named our Java file as &amp;ldquo;FirstTestNGFile&amp;rdquo;.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_3_final-0032.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Eclipse should automatically create the template for our TestNG file shown below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_4-0033.png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Coding Our First Test Case&lt;/h3&gt;
&lt;p&gt;
	Let us now create our first test case that will check if Mercury Tours&amp;rsquo; homepage is correct. Type your code as shown below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/first_test_script-0024.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Notice the following.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		TestNG does not require you to have a main() method.&lt;/li&gt;
	&lt;li&gt;
		Methods need not be static.&lt;/li&gt;
	&lt;li&gt;
		We used the @Test annotation. &lt;strong&gt;@Test is used to tell that the method under it is a test case&lt;/strong&gt;. In this case, we have set the verifyHomepageTitle() method to be our test case so we placed an &amp;lsquo;@Test&amp;rsquo; annotation above it.&lt;/li&gt;
	&lt;li&gt;
		Since we use annotations in TestNG, we needed to import the package org.testng.annotations.*.&lt;/li&gt;
	&lt;li&gt;
		We used the Assert class. &lt;strong&gt;The Assert class is used to conduct verification operations in TestNG&lt;/strong&gt;. To use it, we need to import the org.testng.Assert package.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	You may have multiple test cases (therefore, multiple @Test annotations) in a single TestNG file. This will be tackled in more detail later in the section &amp;ldquo;Annotations used in TestNG&amp;rdquo;.&lt;/p&gt;
&lt;h3&gt;
	Running the Test&lt;/h3&gt;
&lt;p&gt;
	To run the test, simply run the file in Eclipse as you normally do. Eclipse will provide two outputs &amp;ndash; one in the Console window and the other on the TestNG Results window.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/testng_results_window-0025.png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/console_window-0023.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Checking reports created by TestNG&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;
	The Console window in Eclipse gives a text-based report of our test case results while the TestNG Results window gives us a graphical one.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/text_vs_graphical-0016.png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Generating HTML Reports&lt;/h3&gt;
&lt;p&gt;
	TestNG has the ability to generate reports in HTML format.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	After running our FirstTestNGFile that we created in the previous section, right-click the project name (FirstTestNGProject) in the Project Explorer window then click on the &amp;ldquo;Refresh&amp;rdquo; option.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/step_1-0019.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Notice that a &amp;ldquo;test-output&amp;rdquo; folder was created. Expand it and look for an index.html file. This HTML file is a report of the results of the most recent test run.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/test-output___index-0022.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Double-click on that index.html file to open it within Eclipse&amp;rsquo;s built-in web browser. You can refresh this page any time after you rerun your test by simply pressing F5 just like in ordinary web browsers.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/3-1-2013_4-58-41_PM.png" /&gt;&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Annotations used in TestNG&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;
	In the previous section, you have been introduced to the @Test annotation. Now, we shall be studying more advanced annotations and their usages.&lt;/p&gt;
&lt;h3&gt;
	Multiple Test Cases&lt;/h3&gt;
&lt;p&gt;
	We can use multiple @Test annotations in a single TestNG file. By default, methods annotated by @Test are executed alphabetically. See the code below. Though the methods c_test, a_test, and b_test are not arranged alphabetically in the code, they will be executed as such.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/code-0008.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Run this code and on the generated index.html page, click &amp;ldquo;Chronological view&amp;rdquo;.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/chronological-0007.png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Parameters&lt;/h3&gt;
&lt;p&gt;
	If you want the methods to be executed in a different order, use the parameter &amp;ldquo;priority&amp;rdquo;. &lt;strong&gt;Parameters are keywords that modify the annotation&amp;rsquo;s function&lt;/strong&gt;.&lt;/p&gt;
&lt;ul&gt;
	&lt;li style="margin-left: 40px;"&gt;
		Parameters require you to assign a value to them. You do.this by placing a &amp;ldquo;=&amp;rdquo; next to them, and then followed by the value.&lt;/li&gt;
	&lt;li style="margin-left: 40px;"&gt;
		Parameters are enclosed in a pair of parentheses which are placed right after the annotation like the code snippet shown below.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="margin-left: 40px; text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/parameter_and_value-0011.png" style="text-align: center;" /&gt;&lt;/p&gt;
&lt;p&gt;
	TestNG will execute the @Test annotation with the lowest priority value up to the largest. There is no need for your priority values to be consecutive.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/whole_code-0013.png" /&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	The TestNG HTML report will confirm that the methods were executed based on the ascending value of priority.&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/result_of_priority-0012.png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Multiple Parameters&lt;/h3&gt;
&lt;p&gt;
	Aside from &amp;ldquo;priority&amp;rdquo;, @Test has another parameter called &amp;ldquo;alwaysRun&amp;rdquo; which can only be set to either &amp;ldquo;true&amp;rdquo; or &amp;ldquo;false&amp;rdquo;. &lt;strong&gt;To use two or more parameters in a single annotation, separate them with a comma&lt;/strong&gt; such as the one shown below.&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;
	&lt;img alt="" src="http://www.guru99.com/images/multiple_parameters-0010.png" /&gt;&lt;/h3&gt;
&lt;p&gt;
	&lt;img alt="" src="http://www.guru99.com/images/3-4-2013_9-06-43_PM.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;
	&amp;nbsp;&lt;/h3&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	@BeforeTest and @AfterTest&lt;/p&gt;
&lt;table align="center" border="1" cellpadding="0" cellspacing="0" style="width: 772px;" width="100%"&gt;
	&lt;tbody style=""&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 14.58%;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;@BeforeTest&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 652px;"&gt;
				&lt;p style="text-align: center;"&gt;
					methods under this annotation will be executed &lt;strong style=""&gt;prior to the first test case in the TestNG file&lt;/strong&gt;.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 14.58%;"&gt;
				&lt;p style="text-align: center;"&gt;
					&lt;strong style=""&gt;@AfterTest&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 652px;"&gt;
				&lt;p style="text-align: center;"&gt;
					methods under this annotation will be executed &lt;strong style=""&gt;after all test cases in the TestNG file are executed&lt;/strong&gt;.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
	Consider the code below.&lt;/p&gt;
&lt;p&gt;
	&lt;img alt="" src="http://www.guru99.com/images/1-0004.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Applying the logic presented by the table and the code above, we can predict that the sequence by which methods will be executed is:&lt;/p&gt;
&lt;ul&gt;
	&lt;li style="margin-left: 80px;"&gt;
		1&lt;sup&gt;st&lt;/sup&gt; &amp;ndash; launchBrowser()&lt;/li&gt;
	&lt;li style="margin-left: 80px;"&gt;
		2&lt;sup&gt;nd&lt;/sup&gt; &amp;ndash; verifyHomepageTitle()&lt;/li&gt;
	&lt;li style="margin-left: 80px;"&gt;
		3&lt;sup&gt;rd&lt;/sup&gt; &amp;ndash; terminateBrowser()&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&lt;strong&gt;The placement of the annotation blocks can be interchanged without affecting the chronological order by which they will be executed&lt;/strong&gt;. For example, try to rearrange the annotation blocks such that your code would look similar to the one below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/jumble-0005.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Run the code above and notice that&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/result-0006.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	@BeforeMethod and @AfterMethod&lt;/p&gt;
&lt;table align="center" border="1" cellpadding="0" cellspacing="0" style="width: 671px;" width="100%"&gt;
	&lt;tbody style=""&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 14.58%;"&gt;
				&lt;p style=""&gt;
					&lt;strong style=""&gt;@BeforeMethod&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 561px;"&gt;
				&lt;p style=""&gt;
					methods under this annotation will be executed &lt;strong style=""&gt;prior to each method in each test case&lt;/strong&gt;.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 14.58%;"&gt;
				&lt;p style=""&gt;
					&lt;strong style=""&gt;@AfterMethod&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 561px;"&gt;
				&lt;p style=""&gt;
					methods under this annotation will be executed &lt;strong style=""&gt;after each method in each test case.&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
	In Mercury Tours, suppose we like to verify the titles of the target pages of the two links below.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/3_links_from_aut-0001.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	The flow of our test would be:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Go to the homepage and verify its title.&lt;/li&gt;
	&lt;li&gt;
		Click REGISTER and verify the title of its target page.&lt;/li&gt;
	&lt;li&gt;
		Go back to the homepage and verify if it still has the correct title.&lt;/li&gt;
	&lt;li&gt;
		Click SUPPORT and verify the title of its target page.&lt;/li&gt;
	&lt;li&gt;
		Go back to the homepage and verify if it still has the correct title.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	The code below illustrates how @BeforeMethod and @AfterMethod are used to efficiently execute the scenario mentioned above.&lt;/p&gt;
&lt;p&gt;
	&lt;img alt="" src="http://www.guru99.com/images/code-0002.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	After executing this test, your TestNG should report the following sequence.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/result-0003.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	Simply put, @BeforeMethod should contain methods that you need to run &lt;strong&gt;before&lt;/strong&gt; each test case while @AfterMethod should contain methods that you need to run &lt;strong&gt;after&lt;/strong&gt; each test case.&lt;/p&gt;
&lt;h3&gt;
	Summary of TestNG Annotations&lt;/h3&gt;
&lt;p&gt;
	&lt;strong&gt;@BeforeSuite&lt;/strong&gt;: The annotated method will be run before all tests in this suite have run.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;@AfterSuite&lt;/strong&gt;: The annotated method will be run after all tests in this suite have run.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;@BeforeTest&lt;/strong&gt;: The annotated method will be run before any test method belonging to the classes inside the &lt;test&gt; tag is run.&lt;/test&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;@AfterTest&lt;/strong&gt;: The annotated method will be run after all the test methods belonging to the classes inside the &lt;test&gt; tag have run.&lt;/test&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;@BeforeGroups&lt;/strong&gt;: The list of groups that this configuration method will run before. This method is guaranteed to run shortly before the first test method that belongs to any of these groups is invoked.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;@AfterGroups&lt;/strong&gt;: The list of groups that this configuration method will run after. This method is guaranteed to run shortly after the last test method that belongs to any of these groups is invoked.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;@BeforeClass&lt;/strong&gt;: The annotated method will be run before the first test method in the current class is invoked.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;@AfterClass&lt;/strong&gt;: The annotated method will be run after all the test methods in the current class have been run.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;@BeforeMethod&lt;/strong&gt;: The annotated method will be run before each test method.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;@AfterMethod&lt;/strong&gt;: The annotated method will be run after each test method.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;@Test&lt;/strong&gt;: The annotated method is a part of a test case&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Conclusion&lt;/h2&gt;
&lt;/div&gt;
&lt;ul style=""&gt;
	&lt;li&gt;
		TestNG is a testing framework that is capable of making Selenium tests easier to understand and of generating reports that are easy to understand.&lt;/li&gt;
	&lt;li&gt;
		The main advantages of TestNG over JUnit are the following.&lt;/li&gt;
	&lt;li style="margin-left: 80px;"&gt;
		Annotations are easier to use and understand.&lt;/li&gt;
	&lt;li style="margin-left: 80px;"&gt;
		Test cases can be grouped more easily.&lt;/li&gt;
	&lt;li style="margin-left: 80px;"&gt;
		TestNG allows us to create parallel tests.&lt;/li&gt;
	&lt;li&gt;
		The Console window in Eclipse generates a text-based result while the TestNG window is more useful because it gives us a graphical output of the test result plus other meaningful details such as:
		&lt;ul&gt;
			&lt;li style="margin-left: 40px;"&gt;
				Runtimes of each method.&lt;/li&gt;
			&lt;li style="margin-left: 40px;"&gt;
				The chronological order by which methods were executed.&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;
		TestNG is capable of generating HTML-based reports.&lt;/li&gt;
	&lt;li&gt;
		Annotations can use parameters just like the usual Java methods.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;a href="http://www.guru99.com/keyboard-mouse-events-files-webdriver.html"&gt;Previous Tutorial&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href="http://www.guru99.com/selenium-tutorial.html"&gt;Back to Selenium Tutorials Index&amp;nbsp; Page&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href="http://www.guru99.com/introduction-to-selenium-grid.html"&gt;Next Tutorial&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Guru99?a=H8DDPRGd31M:jmzzqlZnwQU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Guru99?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Guru99/~4/H8DDPRGd31M" height="1" width="1"/&gt;</description>
            <author>support</author>
            <pubDate>2013-03-01T09:23:35+00:00</pubDate>
            <guid isPermaLink="false">http://www.guru99.com/all-about-testng-and-selenium.html</guid>
        <feedburner:origLink>http://www.guru99.com/all-about-testng-and-selenium.html</feedburner:origLink></item>
        <item>
            <title>Introduction to Selenium Grid</title>
            <link>http://feedproxy.google.com/~r/Guru99/~3/K9qaByCfzko/introduction-to-selenium-grid.html</link>
            <description>&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;table&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;/td&gt;
			&lt;td&gt;
				&lt;div&gt;
					&lt;h2&gt;
						What is Selenium Grid?&lt;/h2&gt;
				&lt;/div&gt;
				&lt;p&gt;
					&amp;nbsp;&lt;/p&gt;
				&lt;p&gt;
					&lt;strong&gt;Selenium Grid is a part of the Selenium Suite that specializes on running multiple tests across different browsers, operating systems, and machines in parallel&lt;/strong&gt;.&lt;/p&gt;
				&lt;p&gt;
					Selenium Grid has 2 versions &amp;ndash; the older Grid 1 and the newer Grid 2. We will only focus on Grid 2 because Grid 1 is gradually being deprecated by the Selenium Team.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/hub_and_nodes.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	Selenium Grid uses a hub-node concept where you only run the test on a single machine called a &lt;strong&gt;hub&lt;/strong&gt;, but the execution will be done by different machines called &lt;strong&gt;nodes&lt;/strong&gt;.&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		When to Use Selenium Grid?&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;
	You should use Selenium Grid when you want to do either one or both of following :&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		&lt;strong&gt;Run your tests against different browsers, operating systems, and machines all at the same time.&lt;/strong&gt;This will ensure that the application you are testing is fully compatible with a wide range of browser-OS combinations.&lt;/li&gt;
	&lt;li&gt;
		&lt;strong&gt;Save time in execution of your test suites&lt;/strong&gt;. If you set up Selenium Grid to run, say, 4 tests at a time, then you would be able to finish the whole suite around 4 times faster.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Grid 1.0 Vs Grid 2.0&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;
	Following are the main differences between Selenium Grid 1 and 2.&lt;/p&gt;
&lt;table align="center" border="1" cellpadding="0" cellspacing="0"&gt;
	&lt;tbody&gt;
		&lt;tr bgcolor="#B6DDE8"&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p align="center" style=""&gt;
					&lt;strong style=""&gt;Grid 1&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p align="center" style=""&gt;
					&lt;strong style=""&gt;Grid 2&lt;/strong&gt;&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style=""&gt;
					Selenium Grid 1 has its own remote control that is different from the Selenium RC server. They are two different programs.&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style=""&gt;
					Selenium Grid 2 is now bundled with the Selenium Server jar file&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style=""&gt;
					You need to install and configure Apache Ant first before you can use Grid 1.&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style=""&gt;
					You do not need to install Apache Ant in Grid 2.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style=""&gt;
					Can only support Selenium RC commands/scripts.&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style=""&gt;
					Can support both Selenium RC and WebDriver scripts.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr style=""&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style=""&gt;
					You can only automate one browser per remote control.&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style="width: 367px;"&gt;
				&lt;p style=""&gt;
					One remote control can automate up to 5 browsers.&lt;/p&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;div&gt;
	&lt;h2&gt;
		What is a Hub and Node?&lt;/h2&gt;
&lt;/div&gt;
&lt;h3&gt;
	The Hub&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;
		The hub is the central point where you load your tests into.&lt;/li&gt;
	&lt;li&gt;
		There should only be one hub in a grid.&lt;/li&gt;
	&lt;li&gt;
		The hub is launched only on a single machine, say, a computer whose OS is Windows 7 and whose browser is IE.&lt;/li&gt;
	&lt;li&gt;
		The machine containing the hub is where the tests will be run, but you will see the browser being automated on the node.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
	The Nodes&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;
		Nodes are the Selenium instances that will execute the tests that you loaded on the hub.&lt;/li&gt;
	&lt;li&gt;
		There can be one or more nodes in a grid.&lt;/li&gt;
	&lt;li&gt;
		Nodes can be launched on multiple machines with different platforms and browsers.&lt;/li&gt;
	&lt;li&gt;
		The machines running the nodes need not be the same platform as that of the hub.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
	&lt;h2&gt;
		How to Install and Use Grid 2.0?&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;
	In this section, you will use 2 machines. The first machine will be the system that will run the hub, while the other machine will run a node. For simplicity, let us call the machine where the hub runs as &amp;ldquo;Machine A&amp;rdquo; while the machine where the node runs will be &amp;ldquo;Machine B&amp;rdquo;. It is also important to note their IP addresses. Let us say that Machine A has an IP address of 192.168.1.3 while Machine B has an IP of 192.168.1.4.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Download the Selenium Server by &lt;a href="http://docs.seleniumhq.org/download/"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/download_selenium_server.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	You can place the Selenium Server .jar file anywhere in your HardDrive.But for the purpose of this tutorial, place it on the C drive of both Machine A and Machine B. After doing this, you are now done installing Selenium Grid. The following steps will launch the hub and the node.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 3&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		We are now going to launch a hub. Go to Machine A. Using the command prompt, navigate to the root of Machine A&amp;rsquo;s - C drive ,because that is the directory where we placed the Selenium Server.&lt;/li&gt;
	&lt;li&gt;
		On the command prompt, type &lt;strong&gt;java &amp;ndash;jar selenium-server-standalone-2.30.0.jar &amp;ndash;role hub&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;
		The hub should successfully be launched. Your command prompt should look similar to the image below&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/launch_hub.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 4&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Another way to verify whether the hub is running is by using a browser. Selenium Grid, by default, uses Machine A&amp;rsquo;s port 4444 for its web interface. Simply open up a browser and go to &lt;a href="http://localhost:4444/grid/console"&gt;http://localhost:4444/grid/console&lt;/a&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/view_hub_from_browser.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	Also, you can check if Machine B can access the hub&amp;rsquo;s web interface by launching a browser there and going to &lt;a href="http://iporhostnameofmachinea:4444/grid/console"&gt;http://iporhostnameofmachineA:4444/grid/console&lt;/a&gt; where &amp;ldquo;iporhostnameofmachineA&amp;rdquo; should be the IP address or the hostname of the machine where the hub is running. Since Machine A&amp;rsquo;s IP address is 192.168.1.3, then on the browser on Machine B you should type &lt;a href="http://192.168.1.11:4444/grid/console"&gt;http://192.168.1.3:4444/grid/console&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 5&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		Now that the hub is already set up, we are going to launch a node. Go to Machine B and launch a command prompt there.&lt;/li&gt;
	&lt;li&gt;
		Navigate to the root of Drive C and type the code below. We used the IP address 192.168.1.3 because that is where the hub is running. We also used port 5566 though you may choose any free port number you desire.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/grid_2_launch_node.png" /&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		When you press Enter, your command prompt should be similar to the image below.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/after_node_is_launched.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Step 6&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	Go to the Selenium Grid web interface and refresh the page. You should see something like this.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/view_node_from_browser.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;
	At this point, you have already configured a simple grid. You are now ready to run a test remotely on Machine B.&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Designing Test Scripts That Can Run on the Grid&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;
	To design test scripts that will run on the grid, we need to use &lt;strong&gt;DesiredCapabilites&lt;/strong&gt; and the &lt;strong&gt;RemoteWebDriver&lt;/strong&gt; objects.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		&lt;strong&gt;DesiredCapabilites &lt;/strong&gt;is used to set the type of &lt;strong&gt;browser&lt;/strong&gt; and &lt;strong&gt;OS &lt;/strong&gt;that we will automate&lt;/li&gt;
	&lt;li&gt;
		&lt;strong&gt;RemoteWebDriver &lt;/strong&gt;is used to set which node (or machine) that our test will run against.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	To use the &lt;strong&gt;DesiredCapabilites &lt;/strong&gt;object, you must first import this package&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/import_desired_capabilites.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	To use the &lt;strong&gt;RemoteWebDriver &lt;/strong&gt;object, you must import these packages.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/import_RemoteWebDriver.png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Using the DesiredCapabilites Object&lt;/h3&gt;
&lt;p&gt;
	Go to the Grid&amp;rsquo;s web interface and hover on an image of the browser that you want to automate. Take note of the &lt;strong&gt;platform&lt;/strong&gt; and the &lt;strong&gt;browserName &lt;/strong&gt;shown by the tooltip.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/ToolTip(1).png" /&gt;&lt;/p&gt;
&lt;p&gt;
	In this case, the platform is &amp;ldquo;XP&amp;rdquo; and the browserName is &amp;ldquo;firefox&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;
	We will use the platform and the browserName in our WebDriver as shown below (of course you need to import the necessary packages first).&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/DesiredCapabilities_code.png" /&gt;&lt;/p&gt;
&lt;h3&gt;
	Using the RemoteWebDriver Object&lt;/h3&gt;
&lt;p&gt;
	Import the necessary packages for RemoteWebDriver and then pass the DesiredCapabilities object that we created above as a parameter for the RemoteWebDriver object.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/RemoteWebDriver_code.png" /&gt;&lt;/p&gt;
&lt;div&gt;
	&lt;h2&gt;
		Running a Sample Test Case on the Grid&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;
	Below is a simple WebDriver TestNG code that you can create in Eclipse on Machine A. Once you run it, automation will be performed on Machine B.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;
	&lt;img alt="" src="http://www.guru99.com/images/whole_code.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;The test should pass.&lt;/p&gt;
&lt;table align="center"&gt;
	&lt;tbody style=""&gt;
		&lt;tr style=""&gt;
			&lt;td style=""&gt;
				&lt;p style=""&gt;
					&lt;img alt="" src="http://www.guru99.com/images/result_1.png" style="" /&gt;&lt;/p&gt;
			&lt;/td&gt;
			&lt;td style=""&gt;
				&lt;img alt="" src="http://www.guru99.com/images/result_2.png" style="" /&gt;&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
	&lt;h3&gt;
		Summary&lt;/h3&gt;
&lt;/div&gt;
&lt;ul class="checklist"&gt;
	&lt;li&gt;
		Selenium Grid is used to run multiple tests simultaneously in different browsers and platforms.&lt;/li&gt;
	&lt;li&gt;
		Grid uses the hub-node concept.&lt;/li&gt;
	&lt;li style="margin-left: 0.75in;"&gt;
		The hub is the central point wherein you load your tests.&lt;/li&gt;
	&lt;li style="margin-left: 0.75in;"&gt;
		Nodes are the Selenium instances that will execute the tests that you loaded on the hub.&lt;/li&gt;
	&lt;li&gt;
		To install Selenium Grid, you only need to download the Selenium Server jar file &amp;ndash; the same file used in running Selenium RC tests.&lt;/li&gt;
	&lt;li&gt;
		There are 2 ways to verify if the hub is running: one was through the command prompt, and the other was through&amp;nbsp;a browser&lt;/li&gt;
	&lt;li&gt;
		To run test scripts on the Grid, you should use the DesiredCapabilities and the RemoteWebDriver objects.&lt;/li&gt;
	&lt;li style="margin-left: 0.75in;"&gt;
		DesiredCapabilites is used to set the type of browser and OS that we will automate&lt;/li&gt;
	&lt;li style="margin-left: 0.75in;"&gt;
		RemoteWebDriver is used to set which node (or machine) that our test will run against.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;a href="http://www.guru99.com/all-about-testng-and-selenium.html"&gt;Previous Tutorial&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;a href="http://www.guru99.com/selenium-tutorial.html"&gt;Back to Selenium Tutorials Index&amp;nbsp; Page&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Guru99?a=K9qaByCfzko:Pc5Ld7yRGes:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Guru99?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Guru99/~4/K9qaByCfzko" height="1" width="1"/&gt;</description>
            <author>support</author>
            <pubDate>2013-02-28T12:02:03+00:00</pubDate>
            <guid isPermaLink="false">http://www.guru99.com/introduction-to-selenium-grid.html</guid>
        <feedburner:origLink>http://www.guru99.com/introduction-to-selenium-grid.html</feedburner:origLink></item>
    </channel>
</rss>
