Sunday, 23 November 2014

how to read data from properties file in selenium

package com.FrameworkStuff;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class ReadProperties {
public void test() throws FileNotFoundException, IOException {
WebDriver driver=new FirefoxDriver();
driver.get("http://www.gmail.com");
driver.findElement(By.id(getProperty("Username"))).sendKeys("selenium");
driver.findElement(By.id(getProperty("Password"))).sendKeys("selenium");
}
public String getProperty(String sprop) throws FileNotFoundException, IOException {
Properties prop=new Properties();
prop.load(new FileInputStream("D:\\WebDriverExamples\\WebDriverPrograms\\src\\gmail.properties"));
String property=prop.getProperty(sprop);
return property;
}
public static void main(String[] args) throws FileNotFoundException, IOException {
ReadProperties properties=new ReadProperties();
properties.test();
}


/* Create a gmail.properties file


Username=Email
Password=Passwd
}

How to Login in using selenium

package com.SeleniumGuru;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class Login {
WebDriver driver = new FirefoxDriver();
@BeforeTest
public void launchapp() {
// Puts a Implicit wait, Will wait for 10 seconds before throwing
// exception
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
// Launch website
driver.navigate().to("https://mail.google.com/mail/");
driver.manage().window().maximize();
}
@AfterTest
public void terminatetest() {
driver.quit();
}
@Test
public void Login() {
try {
driver.findElement(By.name("Email")).sendKeys("test@gmail.com");
driver.findElement(By.name("Passwd")).sendKeys("0judyqU2589r");
driver.findElement(By.name("signIn")).click();
} catch (Exception e) {
System.out.println(e);
}
}
}




login3

Test Design Considerations

Test Design Considerations
Introducing Test Design
We’ve provided in this chapter information that will be useful to both those new to test automation and for the experienced QA professional. Here we describe the most common types of automated tests. We also describe ‘design patterns’ commonly used in test automation for improving the maintenance and extensibily of your automation suite. The more experienced reader will find these interesting if not already using these techniques.
Types of Tests
What parts of your application should you test? That depends on aspects of your project: user expectations, time allowed for the project, priorities set by the project manager and so on. Once the project boundaries are defined though, you, the tester, will certainly make many decisions on what to test.
We’ve created a few terms here for the purpose of categorizing the types of test you may perform on your web application. These terms are by no means standard, although the concepts we present here are typical for web-application testing.
Testing Static Content
The simplest type of test, a content test, is a simple test for the existence of a static, non-changing, UI element. For instance
  • Does each page have its expected page title? This can be used to verify your test found an expected page after following a link.
  • Does the application’s home page contain an image expected to be at the top of the page?
  • Does each page of the website contain a footer area with links to the company contact page, privacy policy, and trademarks information?
  • Does each page begin with heading text using the <h1> tag? And, does each page have the correct text within that header?
You may or may not need content tests. If your page content is not likely to be affected then it may be more efficient to test page content manually. If, for example, your application involves files being moved to different locations, content tests may prove valuable.
Testing Links
A frequent source of errors for web-sites is broken links or missing pages behind links. Testing involves clicking each link and verifying the expected page. If static links are infrequently changed then manual testing may be sufficient. However if your web designers frequently alter links, or if files are occasionally relocated, link tests should be automated.
Function Tests
These would be tests of a specific function within your application, requiring some type of user input, and returning some type of results. Often a function test will involve multiple pages with a form-based input page containing a collection of input fields, Submit and Cancel operations, and one or more response pages. User input can be via text-input fields, check boxes, drop-down lists, or any other browser-supported input.
Function tests are often the most complex tests you’ll automate, but are usually the most important. Typical tests can be for login, registration to the site, user account operations, account settings changes, complex data retrieval operations, among others. Function tests typically mirror the user-scenarios used to specify the features and design or your application.
Testing Dynamic Elements
Often a web page element has a unique identifier used to uniquely locate that element within the page. Usually these are implemented using the html tag’s ‘id’ attribute or its ‘name’ attribute. These names can be a static, i.e unchanging, string constant. They can also be dynamically generated values that vary each instance of the page. For example, some web servers might name a displayed document doc3861 one instance of a page, and ‘doc6148’ on a different instance of the page depending on what ‘document’ the user was retrieving. A test script verifying that a document exists may not have a consistent identifier to use for locating that document. Often, dynamic elements with varying identifiers are on some type of result page based on a user action. This though certainly depends on the function of the web application.
Here’s an example.
testdesign1

This shows an HTML tag for a check box. Its ID (addForm:_ID74:_ID75:0:_ID79:0:checkBox) is a dynamically generated value. The next time the same page is opened it will likely be a different value.
Ajax Tests
Ajax is a technology which supports dynamically changing user interface elements which can dynamically change without the browser having to reload the page, such as animation, RSS feeds, and real-time data updates among others. There’s a countless ways Ajax can be used to update elements on a web page. But, the easy way to think of this is that in Ajax-driven applications, data can retrieved from the application server and then displayed on the page without reloading the entire page. Only a portion of the page, or strictly the element itself is reloaded.

How to get page title in selenium

//How to get page title in selenium
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;
public class GetTitleTest {
public static void main(String[] args) {
// Create a new instance of the Firefox driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
WebDriver driver = new FirefoxDriver();
// And now use this to visit Google
driver.get("http://www.google.com");
// Alternatively the same thing can be done like this
// driver.navigate().to("http://www.google.com");
// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"));
// Enter something to search for
element.sendKeys("Seleniumguru.in");
// Now submit the form. WebDriver will find the form for us from the element
element.submit();
// Check the title of the page
System.out.println("Page title is: " + driver.getTitle());
// Google's search is rendered dynamically with JavaScript.
// Wait for the page to load, timeout after 10 seconds
(new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
return d.getTitle().toLowerCase().startsWith("Seleniumguru.in");
}
});
// Should see: "Seleniumguru.in - Google Search"
System.out.println("Page title is: " + driver.getTitle());
//Close the browser
driver.quit();
}
}

DIFFERENT TYPES OF TESTING

DIFFERENT TYPES  OF TESTING
WHAT KINDS OF TESTING SHOULD BE CONSIDERED?
  1. Black box testing: not based on any knowledge of internal design or code.Tests are based on requirements and functionality
    2. White box testing: based on knowledge of the internal logic of an application’s code. Tests are based on coverage of code statements, branches, paths, and conditions.
    3. Unit testing: the most ‘micro’ scale of testing; to test particular functions or code modules. Typically done by the programmer and not by testers, as it requires detailed knowledge of the internal program design and code. Not always easily done unless the application has a well-designed architecture with tight code; may require developing test driver modules or test harnesses.
    4. Incremental integration testing: continuous testing of an application as new functionality is added; requires that various aspects of an applications functionality be independent enough to work separately before all parts of the program are completed, or that test drivers be developed as needed; done by programmers or by testers.
    6. Integration testing: testing of combined parts of an application to determine if they function together correctly the ‘parts’ can be code modules, individual applications, client and server applications on a networked. This type of testing is especially relevant to client/server and distributed systems.
    7. Functional testing: black-box type testing geared to functional requirements of an application; testers should do this type of testing. This does not mean that the programmers should not check their code works before releasing it(which of course applies to any stage of testing).
    8. System testing: black –box type testing that is based on overall requirements specifications; covers all combined parts of system.
    9. End to end testing: similar to system testing; the ‘macro’ end of the test scale; involves testing of a complete application environment in a situation that mimics real-world use, such as interacting with database, using network communications, or interacting with other hardware, applications, or systems if appropriate.
    10. Sanity testing: typically an initial testing effort to determine if a new software version is performing well enough to accept it for a major testing effort. For example, if the new software is crashing systems every 5minutes warrant further testing in item current state.
    11. Regression testing: re-testing after fixes or modifications of the software or its environment. It can be difficult to determine how much re-testing is needed, especially near the end of the development cycle. Automated testing tools can be especially useful for this type of testing.
    12. Acceptance testing: final testing based on specifications of the end-user or customer, or based on use by end users/customers over some limited period of time.
    13. Load testing: testing an application under heavy loads, such as testing of a web site under a range of loads to determine at what point the system’s response time degrades or fails.
    14. Stress testing: term often used interchangeably with ‘load’ and ‘performance’ testing. Also used to describe such tests as system functional testing while under unusually heavy loads, heavy repletion of certain actions or inputs input of large numerical values, large complex queries to a database system, etc.
    15. Performance testing: term often used interchangeable with ‘stress’ and ‘load’ testing. Ideally ‘performance’ testing (and another ‘type’ of testing) is defined in requirements documentation or QA or test plans.
    16. Usability testing: testing for ‘user-friendlinesses’. Clearly this is subjective,and will depend on the targeted end-ser or customer. User interviews, surveys, video recording of user sessions, and other techniques can be used programmers and testers are usually not appropriate as usability testers.
    17. Install/uninstall testing: testing of full, partial, or upgrade install/uninstall processes.
    18. Recovery testing: testing how well a system recovers from crashes, hardware failures or other catastrophic problems.
    19. Security testing: testing how well system protects against unauthorized internal or external access, damage, etc, any require sophisticated testing techniques.
    20. Compatibility testing: testing how well software performs in a particular hardware/software/operating/system/network/etc environment.
    21. Exploratory testing: often taken to mean a creative, informal software test that is not based on formal test plans of test cases; testers may be learning the software as they test it.
    22. Ad-hoc testing: similar to exploratory testing, but often taken to mean that the testers have significant understanding of the software testing it.
    23. User acceptance testing: determining if software is satisfactory to an end-user or customer.
    24. Comparison testing: comparing software weakness and strengths to competing products.
    25. Alpha testing: testing of an application when development is nearing completion; minor design changes may still be made as a result of such testing. Typically done by end-users or others, not by programmers or testers.
    26. Beta testing: testing when development and testing are essentially completed and final bugs and problems need to be found before final release. Typically done by end-users or others, not by programmers or testers.
    27. Mutation testing: method for determining if a set of test data or test cases is useful, by deliberately introducing various code changes (‘bugs’) and retesting with the original test data/cases to determine if the ‘bugs’ are detected proper implementation requires large computational resources.

How to read data from excel in selenium

Read data in excel
First,
download JXL or POI jar file and build it to your project
http://download.cnet.com/JExcelApi/3000-2077_4-75912876.html
Second,
We Should have access to workbook, sheet which we want to read as workbook contains multiple sheets and if you want to read a particular cell we need location of a Cell.


FileInputStream fis = new FileInputStream(
"D:\\SELENIUM\\EXCEL\\login.xls");
Workbook wb = Workbook.getWorkbook(fis);


Next to access sheet


Sheet s = wb.getSheet(0); // this is to get the access to Sheet0.


To get the cell contents as below:
 
Cell c = s.getCell(icol, irow);
String exceldata = c.getContents();


For reading more than one properties


if (sprop.startsWith("//")) {
driver.findElement(By.xpath(sprop)).sendKeys(sval);
} else {
driver.findElement(By.id(sprop)).sendKeys(sval);




For reading from excel
textBox(ExcelRead(2, i), ExcelRead(3, i));


exceldata1


Prog is :
//how to read data from excel in selenium
package com.Test;


import java.io.FileInputStream;
import java.io.IOException;
import java.util.concurrent.TimeUnit;


import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;


import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;


public class ReadDataExcel {
WebDriver driver;


@Test
public void text() throws BiffException, IOException {
driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("https://www.rightstart.com/customer/account/login");
for (int i = 1; i < 3; i++) {
textBox(ExcelRead(2, i), ExcelRead(3, i));
}
}


public String ExcelRead(int icol, int irow) throws BiffException,
IOException {
FileInputStream fis = new FileInputStream(
"D:\\SELENIUM\\EXCEL\\login.xls");
Workbook wb = Workbook.getWorkbook(fis);
Sheet s = wb.getSheet(0);
Cell c = s.getCell(icol, irow);
String exceldata = c.getContents();
return exceldata;
}


public void textBox(String sprop, String sval) {
if (sprop.startsWith("//")) {
driver.findElement(By.xpath(sprop)).sendKeys(sval);
} else {
driver.findElement(By.id(sprop)).sendKeys(sval);
}
}
}


OUTPUT IS






rigclickreaddata

Xpath in selenium

Locating Techniques
Useful XPATH patterns
text
Given: <div>Some Text</div>
XPath: //div[text()='Some Text']
Partial matching:
 
 
 
 
 
 
XPath: //div[contains(text(),'Somxpathe')]
starts-with
Many sites use dynamic values for element’s id attributes, which can make them difficult to locate. One simple solution is to use XPath functions and base the location on what you do know about the element. For example, if your dynamic ids have the format <input id="text-12345" /> where 12345 is a dynamic number you could use the following XPath: //input[starts-with(@id, 'text-')]
contains
If an element can be located by a value that could be surrounded by other text, the contains function can be used. To demonstrate, the element <span class="top heading bold"> can be located based on the ‘heading’ class without having to couple it with the ‘top’ and ‘bold’ classes using the following XPath: //span[contains(@class, 'heading')]. Incidentally, this would be much neater (and probably faster) using the CSS locator strategy css=span.heading
siblings
Not yet written - locate elements based on their siblings. Useful for forms and tables.
Example:

Tuesday, 18 November 2014

how to find dynamic elements in selenium

how to find dynamic elements in selenium

//how to find dynamic elements in selenium
package com.snapdeal;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Dynamicelments {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.get(“http://timesofindia.indiatimes.com/home”);
List<WebElement> frame = driver.findElements(By.tagName(“iframe”));
System.out.println(frame.size());
for (int i = 0; i < frame.size(); i++) {
System.out.println(frame.get(i).getAttribute(“id”));
driver.close();
}
}
}

/*
Output is
Run for first time o/p is
2
a9982952-2553-8973-fe5d-294b67e69809
Run for second time o/p is
2
902f94fd-3c30-c01d-e35a-269a7a300ef7
Run for third time o/p is
2
32bf57b6-5096-bc5c-df4a-b582df5ee5dd
*/

Interview questions by Virtusa on Testing

 Interview questions by Virtusa on Testing
by admin • November 18, 2014 • 0 Comments
inShare

Interview questions by Virtusa

    Tell me about Yourself?
    2. Testing process followed in your company …
    3. Testing Methodology
    4. Where u maintains the Repositories?
    5. What is CVS?
    6. Bug Tool used?
    7. How will you prepare traceability matrix if there is no Business Doc and Functional Doc?
    8. How will you validate the functionality of the Test cases, if there is no business requirement document or user requirement document as such…
    9. Testing process followed in your company?
    10. Tell me about CMM LEVEL -4 …what are steps that to be followed to achieve the CMM -IV standards?
    11. What is Back End testing?
    12. What is Unit Testing?
    13. How will u write test cases for an given scenario…i.e. main page, login screen, transaction, Report Verification?
    14. How will u write traceability matrix?
    15. What is CVS and why it is used?
    16. What will be specified in the Defect Report…?
    17. What is Test summary Report…?
    18. What is Test Closure report…?
    19. Explain Defect life cycle…
    20. What will be specified in the Test Case…
    21. What are the Testing methodologies that u have followed in your project ?
    22. What kind of testing that u have been involved in and explain about it….
    23. What is UAT Testing?
    24. What is joins and what are the different types of joins in SQL and explain the same?
    25. What is Foreign Key in SQL…?

(edit)

Monday, 17 November 2014

How to open new tab in selenium webdriver

How to open new tab in selenium webdriver




import org.openqa.selenium.By;

import org.openqa.selenium.Keys;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;



public class NewTabs {

public static void main(String[] args) {

WebDriver driver = new FirefoxDriver();

driver.get("http://www.google.co.in");

driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL + "t");

driver.get("http://www.gmail.com");

driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL + "t");

driver.get("http://www.linkedin.com");

driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL + "t");

driver.get("http://www.facebook.com");


}

}

how to right click on element using selenium webdriver


//how to right click on element using selenium webdriver

package com.Pack;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
public class RightClick {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.get(“http://www.google.co.in”);
driver.manage().window().maximize();
WebElement elementq = driver.findElement(By.name(“q”));
Actions builderq = new Actions(driver);
Action rClick = builderq.contextClick(elementq).build();
rClick.perform();
}
}

How to useTestNg annotations


//How to useTestNg annotations


import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class TestNgDemo {
@Test(priority=3)
public void test_1(){
System.out.println(“This is test case 1″);
}
@Test(priority=2)
public void test_2() {
System.out.println(“This is test case 2″);
}
@Test(priority=1)
public void test_3() {
System.out.println(“This is test case 3″);
Assert.assertEquals(“Hi”,”Hi”);
}
@BeforeMethod
public void setUp() {
System.out.println(“This iis precondition”);
}
}

What’s the big deal about ‘requirements’?

What’s the big deal about ‘requirements’?
One of the most reliable methods of insuring problems, or failure, in a complexsoftware project is to have poorly documented requirements specifications. Requirements are the details describing an application’s externally-perceived functionality and properties. Requirements should be clear, complete, reasonably detailed, cohesive, attainable, and testable. A non-testable requirement would be, for example, ‘user-friendly’ (too subjective). A testable requirement would be something like ‘the user must enter their previously-assigned password to access the application’. Determining and organizing requirements details in a useful and efficient way can be a difficult effort; different methods are available depending on the particular project. Many books are available that describe various approaches to this task. (See the Bookstore section’s ‘Software Requirements Engineering’ category for books on Software Requirements.)
Care should be taken to involve ALL of a project’s significant ‘customers’ in the requirements process. ‘Customers’ could be in-house personnel or out, and could include end-users, customer acceptance testers, customer contract officers, customer management, future software maintenance engineers, salespeople, etc. Anyone who could later derail the project if their expectations aren’t met should be included if possible.
Organizations vary considerably in their handling of requirements specifications. Ideally, the requirements are spelled out in a document with statements such as ‘The product shall…..’. ‘Design’ specifications should not be confused with ‘requirements'; design specifications should be traceable back to the requirements.
In some organizations requirements may end up in high level project plans, functional specification documents, in design documents, or in other documents at various levels of detail. No matter what they are called, some type of documentation with detailed requirements will be needed by testers in order to properly plan and execute tests. Without such documentation, there will be no clear-cut way to determine if a software application is performing correctly.
‘Agile’ methods such as XP use methods requiring close interaction and cooperation between programmers and customers/end-users to iteratively develop requirements. The programmer uses ‘Test first’ development to first create automated unit testing code, which essentially embodies the requirements.

What’s the role of documentation in QA

What’s the role of documentation in QA? 
Critical. (Note that documentation can be electronic, not necessarily paper.) QA practices should be documented such that they are repeatable. Specifications, designs, business rules, inspection reports, configurations, code changes, test plans, test cases, bug reports, user manuals, etc. should all be documented. There should ideally be a system for easily finding and obtaining documents and determining what documentation will have a particular piece of information.Change management for documentation should be used if possible.

What makes a good Software QA engineer?

What makes a good Software QA engineer? 
The same qualities a good tester has are useful for a QA engineer. Additionally, they must be able to understand the entire software development process and how it can fit into the business approach and goals of the organization. Communication skills and the ability to understand various sides of issues are important. In organizations in the early stages of implementing QA processes, patience and diplomacy are especially needed. An ability to find problems as well as to see ‘what’s missing’ is important for inspections and reviews.

What makes a good test engineer?

What makes a good test engineer?

A good test engineer has a ‘test to break’ attitude, an ability to take the point ofview of the customer, a strong desire for quality, and an attention to detail. Tact and diplomacy are useful in maintaining a cooperative relationship with developers, and an ability to communicate with both technical (developers) and non-technical (customers, management) people is useful. Previous software development experience can be helpful as it provides a deeper understanding of the software development process, gives the tester an appreciation for the developers’ point of view, and reduce the learning curve in automated test tool programming. Judgment skills are needed to assess high-risk areas of an application on which to focus testing efforts when time is limited.

how to get tooltip in selenium



import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class ToolTip {
public static void main(String[] args) {
WebDriver driver=new FirefoxDriver();
driver.get(“http://msdn.microsoft.com/en-in/library/windows/apps/hh465476.aspx”);
String toolTip=driver.findElement(By.linkText(“Get started”)).getAttribute(“title”);
System.out.println(“ToolTip is “+toolTip);
}
}

Exception Handling with example in selenium

//Exception Handling with example in selenium


import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class TestIsSelected {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
//Exception handling ie., using Try Catch block
try {
driver.get(“https://register.rediff.com/register/register.php?FormName=user_details”);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
WebElement e = driver.findElement(By.xpath(“//input[@type='radio']“));
boolean actual = e.isSelected();
if (actual) {
System.out.println(“Button is Selected”);
} else {
System.out.println(“Button is not Selected”);
}
} catch (Exception ex) {
System.out.println(“Exception” + ex.getMessage());
} finally {
driver.close();
}
}
}

Exception Handling

Exception Handling
An unexpected exception would be thrown if the worst case scenarios are not handled properly.Due to element not found or if the expected result doesn’t match with actuals, we should catch that exception and end the test in a Logical way that the script itself terminating abruptly.
Syntax
try
{
//Perform Action
}
catch(ExceptionType1 exp1)
{
//Catch block no 1
}
catch(ExceptionType2 exp2)
{
//Catch block no 2
}
catch(ExceptionType3 exp3)
{
//Catch block no 3
}
{
//The finally block no always executes.
}

How to Extract All Links Text in seleium


//How to Extract All Links Text in seleium

 

package com.snapdeal;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class ExtractAllLinkText {
public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver driver = new FirefoxDriver();
driver.get(“http://seleniumguru.in/”);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
List<WebElement> list = driver.findElements(By.tagName(“a”));
for (int i = 0; i < list.size(); i++) {
System.out.println(list.get(i).getText());
}
driver.close();
}
}