QA Testing+Selenium Interview Questions

What is Software Testing?

Software testing is the process of evaluating a system to check if it satisfies its business requirements. It measures the overall quality of the system in terms of attributes like correctness, completeness, usability, performance etc. Basically, it is used for ensuring the quality of software to the stakeholders of the application.

Why is testing required?

We need software testing for the following reasons-

1. Testing provides an assurance to the stakeholders that the product works as intended.

2. Avoidable defects leaked to the end user/customer without proper testing adds a bad reputation to the development company.

3. Defects detected the earlier phase of SDLC results into the lesser cost and resource utilization of correction.

4. Saves development time by detecting issues in an earlier phase of development.

5. The testing team adds another dimension to the software development by providing a different viewpoint to the product development process.

When should we stop testing?

Testing can be stopped when one or more of the following conditions are met-

1. After test case execution - Testing phase can be stopped when one complete cycle of test cases is executed after the last known bug fix with agreed upon value of pass-percentage.

2. Once the testing deadline is met - Testing can be stopped after deadlines get met with no high priority issues left in system.

3. Based on Mean Time Between failure (MTBF)- MTBF is the time interval between two inherent failures. Based on stakeholders decisions, if the MTBF is quite large one can stop the testing phase.

4. Based on code coverage value - Testing phase can be stopped when the automated code coverage reaches a specific threshold value with sufficient pass-percentage and no critical bug.

What is Quality Assurance?

Quality assurance is a process driven approach, which checks if the process of developing the product is correct and conforming to all the standards. It is considered as a preventive measure as it identifies the weakness in the process to build software. It involves activities like document review, test cases review, walkthroughs, inspection etc.

What is Quality Control?

Quality control is product driven approach, which checks that the developed product conforms to all the specified requirements. It is considered as a corrective measure as it tests the built product to find the defects. It involves different types of testing like functional testing, performance testing, usability testing etc.

What is SDLC?

SDLC stands for Software Development Life Cycle. It refers to all the activities performed during software development - requirement gathering, requirement analysis, designing, coding or implementation, testing, deployment and maintenance.

Explain STLC - Software Testing life cycle.

Software testing life cycle refers to all the activities performed during testing of a software product. The phases include-

• Requirement analyses and validation - In this phase the requirements documents are analyzed and validated and scope of testing is defined.

• Test planning - In this phase test plan strategy is defined, estimation of test effort is defined along with automation strategy and tool selection is done.

• Test Design and analysis - In this phase test cases are designed, test data is prepared and automation scripts are implemented.

• Test environment setup - A test environment closely simulating the real world environment is prepared.

• Test execution - The test cases are prepared, bugs are reported and retested once resolved.

• Test closure and reporting - A test closure report is prepared having the final test results summary, leanings and test metrics.

What are the different types of testing?

Testing can broadly be defined into two types-

• Functional testing - Functional testing involves validating the functional specifications of the system.

• Non Functional testing - Non functional testing is a type of testing that involves testing of non-functional requirements of the system such as performance, scalability, security, endurance, portability etc.

• Black box testing - In black box testing, the tester need not have any knowledge of the internal architecture or implementation of the system. The tester interacts with the system through the interface providing input and validating the received output.

• White box testing - In white box testing, the tester analyses the internal architecture of the system as well as the quality of source code on different parameters like code optimization, code coverage, reusability etc.

• Gray box testing - In gray box testing, the tester has partial access to the internal architecture of the system e.g. the tester may have access to the design documents or database structure. This information helps tester to test the application better.

What is a test bed?

A test bed is a test environment used for testing an application. A test bed configuration can consist of the hardware and software requirement of the application under test including - operating system, hardware configurations, software configurations, tomcat, database etc.

What is a test plan?

A test plan is a formal document describing the scope of testing, the approach to be used, resources required and time estimate of carrying out the testing process. It is derived from the requirement documents (Software Requirement Specifications).

What is a test scenario?

A test scenario is derived from a use case. It is used for end to end testing of a feature of an application. A single test scenario can cater to multiple test cases. The scenario testing is particularly useful when there is time constraint while testing.

What is a test case?

A test case is used to test the conformance of an application with its requirement specifications. It is a set of conditions with pre-requisites, input values and expected results in a documented form.

What is some attributes of a test case?

A test case can have following attributes-

1. TestCaseId - A unique identifier of the test case.

2. Test Summary - One-liner summary of the test case.

3. Description - Detailed description of the test case.

4. Prerequisite or pre-condition - A set of prerequisites that must be followed before executing the test steps.

5. Test Steps - Detailed steps for performing the test case.

6. Expected result - The expected result in order to pass the test.

7. Actual result - The actual result after executing the test steps.

8. Test Result - Pass/Fail status of the test execution.

9. Automation Status - Identifier of automation - whether the application is automated or not.

10. Date - The test execution date.

11. Executed by - Name of the person executing the test case.

What is a test script?

A test script is an automated test case written in any programming or scripting languages These are basically a set of instructions to evaluate the functioning of an application.

What is a bug?

A bug is a fault in a software product detected at the time of testing, causing it to function in an unanticipated manner.

What is a defect?

A defect is non-conformance with the requirement of the product detected in production (after the product goes live).

What are some of the bug or defect management tools?

Some of the most widely used Defect Management tools are - Jira, Bugzilla, Redmine, Mantis, and Quality Center etc.

What are some defect reporting attributes?

Some of the attributes of a Defect report are-

• DefectId - A unique identifier of the defect.

• Defect Summary - A one-line summary of the defect, more like a defect title.

• Defect Description - A detailed description of the defect.

• Steps to reproduce - The steps to reproduce the defect.

• Expected Result - The expected behavior from which the application is deviating because of the defect.

• Actual Result- The current erroneous state of the application w.r.t. the defect.

• Defect Severity - Based on the criticality of the defect, this field can be set to minor, medium, major or show stopper.

• Priority - Based on the urgency of the defect, this field can be set on a scale of P0 to P3.

What is defect density?

Defect density is the measure of density of the defects in the system. It can be calculated by dividing number of defect identified by the total number of line of code (or methods or classes) in the application or program.

What is defect priority?

A defect priority is an urgency of fixing the defect. Normally the defect priority is set on a scale of P0 to P3 with P0 defect having the most urgency to fix.

What is defect severity?

Defect severity is the severity of the defect impacting the functionality. Based on the organization, we can have different levels of defect severity ranging from minor to critical or show stopper.

Give an example of Low priority-Low severity, Low priority-High severity, High priority-Low severity, High priority-High severity defects.

1. Low priority-Low severity - A spelling mistake in a page not frequently navigated by users.

2. Low priority-High severity - Application crashing in some very corner case.

3. High priority-Low severity - Slight change in logo color or spelling mistake in company name.

4. High priority-High severity - Issue with login functionality.

What is a blocker?

A blocker is a bug of high priority and high severity. It prevents or blocks testing of some other major portion of the application as well.

What is a critical bug?

A critical bug is a bug that impacts a major functionality of the application and the application cannot be delivered without fixing the bug. It is different from blocker bug as it doesn't affect or blocks the testing of another part of the application.

What is automation testing?

Process of automating the manual process of test cases is called automation testing. 

What are the benefits of Automation Testing ?

1. Mainly helps in Regression Testing 

2. Lessen down human generated errors

3. Save time and money

What types of tests have you automated ?

Regression testing , Smoke testing , Sanity testing , Functional testing , And depend on the requirements End to End testing 

Why should Selenium be selected as a test tools ?

1. Used for UI automation of web applications 

2. Free and open source 

3. Cross browser compatibility ( Firefox , Chrome , IE , Safari etc )

4. Supports multiple programming languages ( java , Ruby , C# , Python ) 

What is selenium?

Selenium is one of the most popular open source  automated testing suits . Selenium is designed in a way to support automation testing of functional aspects of web-based applications on a wide range of browser. 

Selenium is not just a single tool , rather a package of several testing tools so called suits. 


Selenium has four components , 

1. Selenium IDE ( Integrated Development Environment ) - Record and playback tools 

2. Selenium RC  ( Remote Control ) - RC is a server that allows user to create test scripts in the desired language. 

3. Selenium Webdriver 

4. Grid - Selenium Grid is used to

Types of exceptions in Selenium WebDriver

1. WebDriverException - 

2. TimeOutExcpetion

3. NoAlertPresentException

4. NoSuchWindowException

5. NoSuchElementException

When should I use Selenium IDE ?

Ideal tool for naive user. Used to find element location 

What is selenese?

Selenese is the language which is used to write test scripts in IDE

Locators in Selenium

Locators : An address that identifies a webelement within the webpage. 

1. ID

2. Name 

3. Class Name 

4. Linktext 

5. Partial linktext

6. XPath

7. Css

8. DOM

9. TagName 

What is difference between Assert and verify ?

Both commands check whether the given condition is true or false. 


Assert: Let's say we assert whether the given element is present on the web page or not. If the condition is true then the test scripts will execute to the next step, but if the condition is false execution would stop and no further test would be executed.


Verify: Program execution does not stop weather condition true or not. 

Soft Assert and hard Assert

Soft Assert does not throw an exception when the assert fails and would continue with the next step

Hard Assert : Throws an Assert Exceptions when an assert statement fails 

What is XPath?

XPath is defined as XML path. It is a syntax or language for finding any element on the web page using XML path expression. XPath is used to find the location of any element on a webpage using HTML DOM structure.

What is the difference between “/” single slash and “//” double slash

Single Slash : Is used to create Xpath with absolute path that is the xpath would be created to start selection from the document node/Start node.

Usually absolute xpath starts with single slash. When use absolute xpath , you will be covering whole path to the element. 

Double Slash : Is used to create Xpath with relative path that is “ Start selection from anywhere within the document “

Relative xpath starts with double slash. In that case  , we will be first finding unique parent node and path from there to the element. 

Absolute xpath = /html/body/div[2]/div[1]/div[1]/a

Relative xpath = //div[class="qa-logo"]/a

When should I use selenium Grid ?

The grid can be used to execute test scripts on multiple platform and browser concurrently

Selenium 1 & Selenium 2

Selenium 1 - RC

Selenium 2 - RC + WebDriver

Launch the browser using Web-driver

WebDriver driver = new FirefoxDriver();

WebDriver driver = new ChromeDriver();

WebDriver driver = new InternetExplorerDriver();

Implicit and Explicit waits and Fluent wait - need to write in better way

1. Implicit wait : When you know exact amount of time to visible a webelement.

for example :  

a. Static Wait 

b. Unconditional wait

WebDriver driver = new ChromeDriver();




2. Explicit wait : We provide Time Or Condition 

 When you don't know exact time. We use condition in Explicit wait

a. Dynamic wait

b. Conditional wait a

WebDriver driver = new ChromeDriver();


WEbDriverWait wait = new WebDriverWait(driver , 20);

WebElement aboutme = wait.until ( ExpectedConditionds.visibilityOfElementLocated(By,id("about_me")));


3. Fluent Wait  ( Time , Condition , Frequency )

how to type in a textbox using selenium

using sendkeys(“............”)

WebElement username = drv.findElement("Email");


How can you find an element is displayed on the screen or not ?

WebDriver provides following methods to check the visibility of the web elements

1. isDisplayed(); - boolean return type 

2. isSelected();

3. isEnabled();

How can we get a text of a web element

Get command is used to retrieve the inner text of the specified web element. It is also one of the extensively used commands for verification of message, labels, errors. 
String text = driver.findElement("Text")).getText();

How to select value in dropdown

The value in drop down can be selected using WedDriver’s Select class

 1. selectByValue:

Select selectByValue = newSelect(driver.findElement("SelectID_One")));


        2. selectByVisibleText:

Select selectByVisibleText = new    Select(driver.findElement("SelectID_Two")));


    3. selectByIndex:

Select selectByIndex = newSelect(driver.findElement("SelectID_Three")));


Navigation commands

1.navigate().back() - takes back user to the previous page


      2.   navigate().forward() - takes  user to the next web page


      3.   navigate().refresh() - refresh the next web page


      4.   navigate().to() -launch a new web browser and open specified url 

How to click on hyper link using LinkText


How to handle frame in WebDriver

Iframe is a web page which is embedded in another webpage or an HTML document. IFrame is often used to insert content from another source

Identify the total number of iframes by using below code 

Int size = driver.findElements(By.tagName("iframe")).size();

We can switch over the elements in frames using 3 ways 

1. By index 

2. By Name or Id 

3. By Web Element

1. By Index 

Suppose if there are 100 frames in page , we can switch to iframe by using index



     2. By Name or ID 


driver.switchTo().frame("id of the element");

    3. By WebElement


To move back to Parent Frame 


driver.switchTo().defaultContent(); Very important for handling 

findElement() and findElements()

1. findElement() is used to find the first element in the current web page matching to the specified locator value


WebElement element = driver.findElements(By.xpath("//div[@id='example']//ul//li"));

2.  findElements() is used to find all the elements in the current webpage : Stored in List 

List <WebElement> elementList = driver.findElements(By.xpath("//div[@id='example']//ul//li"));

Can Selenium handle windows based pop up?

selenium does not support windows based pop-ups 


How can we handle windows based pop ups ?

by using third-party tools, AutoIT, Robot class 


How to assert title of the web page ?

assertTrue("The title of the window is incorrect.",driver.getTitle().equals("Title of the page"));

How to mouse hover on a web element using webdriver?

By using advanced user interactions API. It contains Actions and Action classes that are needed when executing events

1. clickAndHold() method : Clicks at current mouse location 

2. contextClick() method : Performs a context click 

3. doubleClick() method : Double click 

4. dragAndDrop( source , target )

5. dragAndDropBy( source , x-offset , y-offset)

6. keyDown(modifier_key)

7. moveToElement(toElement) : Moves the mouse to the middle of the element   

Example : 

     1.Import the Actions and Action Class

     2. Instantiate a new Actions object 

     3. Instantiate an Action using Actions object 

     4. Use the perform method 

WebDriver driver = new ChromeDriver();


Actions actions = new Actions(driver);



How to retrieve css properties of an element ?

using get method  


driver.findElement(“id”)).getCssValue(“name of css attribute”);

How to clear text in the text box?

driver.findElement(By.xpath("xpath_of_element1")).sendKeys("Software Testing Material Website");


How to submit a form using Selenium WebDriver

By submit() method 


Press Enter key on text box In Selenium WebDriver

We need to use Selenium Enum Keys with its constant ENTER 


What is the difference between driver.get(“url”) and“url“) ?

driver.getUrl() : Open Url and it will wait till the whole page gets loaded : Open Url and It will not wait page to load

How to fetch current pageURL


How can we maximize browser window in Selenium


How to delete cookies?


What is the difference between driver.getWindowHandle() and driver.getWindowHandles()

driver.getWindowHandle() : handle of the current page

driver.getWindowHandles() : returns set of handles of the all the pages available

How can we handle web based pop ups

To handle alerts popups we need to do switch to the alert window and call Selenium WebDriver Alert API methods 

How can you find broken links is a page ?

First we need to find all the links on the page using 

List<WebElement> links = driver.findElements(By.tagName("a"));

//To print the total number of links

System.out.println("Total links are "+links.size());

//used for loop to

for(int i=0; i<links.size(); i++) {

WebElement element = links.get(i);

//By using "href" attribute, we could get the url of the requried link

String url=element.getAttribute("href");

//calling verifyLink() method here. Passing the parameter as url which we collected in the above link

//See the detailed functionality of the verifyLink(url) method below



How to upload a file is Selenium

Using the sendkeys method 

WebElement browse =driver.findElement("uploadfile"));

//pass the path of the file to be uploaded using Sendkeys method


//'close' method is used to close the browser window


Explain about Page Object model Framework? BDD framework?

1. Page Object Model: Page Object Model is a design pattern to create an Object Repository for Web UI Elements. 

            Under this model, for each page in the application, there should be a corresponding page class.

This page class will find the WebElements of that web page and also contains page methods which perform operations on those web elements. 

For example : We will try to automate the Gmail login scenario by using the Page Object Model 

1. Now a a days there are a separate screen to provide username and password to login on gmail

           So we will create two classes . userNameClass and passwordClass 

           Then we will create a constructor that accepts driver object. So whenever we create a object of this class in Our test Scripts  So we can hand over our driver object to this class.


Then we can declare a variable of  element location which is textbox of username and submit button. We can also declare a method for submit button which we can call directly from our test script class.

Same process we will follow for password page. 

 2.   BDD framework : 

BDD is a improvement of TDD ( Test Driven Development ) Behavior driven development which improves quality of a software. 

What is your approach on load testing, Mobile testing, and Web service testing? What are the tools have you used?

For Web Services Testing , we can create a stub to call services. In my last project we had legacy service which were written as a Thrift services. We can directly call the API with required parameters through stub and validate the response. 

Nowadays many companies are  user Rest APi pattern. We can use Apache Http client to make calls and validate the response. 

Mobile Testing - We can use Appium tool to automate mobile automation scripts. Appium is open source mobile application UI testing framework We can use Testng framework with Appium.

Load testing : Load Testing is a kind of Performance testing which test the system performance under real life load condition. 

This testing is usually identifies 

• The maximum operating capacity of an application

• Determine whether current infrastructure is sufficient to run the application

• Sustainability of application with respect to peak user load

• Number of concurrent users that an application can support, and scalability to allow more users to access it.

We can use : Jmeter , Load Runner , LoadUi

Are you familiar with continuous integration tool? What are they?

Yes I am familiar with CI tools. In my current project we are using Jenkins and in my last project I was using Teamcity integration tools. By using Jenkins as a CI tools , we execute our test cases on daily basis and also nightly execution based on the schedule. Test results are also sent to other peers by Jenkins. testing scenario.

Basic and P0 ( login and 

1. Verify that facebook login page uploads correctly when user enters url

2. Verify that user can successfully login with valid credentials.

3. Verify that user can create his account.

4. Verify that user can set profile picture uploaded from desktop , mobile and mobile camera. 

5. Verify that user can post images on their timeline.

6. Verify that user can add/edit/update their account information.

7. Verify that user can post text on timeline and the sme gets displayed to their friends.

8. Verify that user can tag their friend on post.

9. Verify that users see all the post in their timeline. 

        Friends and their TimeLine Scenarios :

1. Verify that the user can search for friends in facebook’s ‘Find friends’ search functionality. 

2. Verify that user can send friend request to any user by visiting their page.

3. Verify that the user can accept and reject  friend request. 

There are many more test scenarios depends upon facebook's functionality. I don't use much so I am not aware of many functionality. 

What Is Selenium WebDriver/Selenium 2?

Selenium is a open source automated testing suits for web application across different browser and platforms. Selenium focuses on automating web-based applications. 

Selenium is not just a single tool but suits of softwares.

It has four components 

1. IDE - Integrated development tools 

2. RC - Remote Control 

3. WebDriver 

4. Grid

IDE+RC - Selenium 1

Selenium 1 + Webdriver called - Selenium 2

What are the annotations of Junit & TestNG?

Similar Annotations:

1. Test annotation - @Test - JUnit4 , TestNg

2. @BeforeClass - Run before the first test method in current class is invoked 

3. @AfterClass - Run after all the test method have been run

4. @After - JUnit , @AfterMethod - TestNg -Run after each test method  

5. @Before - Junit , @BeforeMethod - TestNg - Run before each test method. 

6. @Ignore - junit , @test(enable=false) - Ignore test

7. @Test(Timeout=1000)  - In both Junit4 and testNg

8. @AfterGroups - methods describe in groups will run 

9. @DataProvider 

Both testNg and Junit are testing framework used for Unit Testing. TestNG is similar to Junit. Few functionality are added to it that makes TestNg more powerful than JUnit.

Difference between Junit & TestNG?

Both testNg and Junit are testing framework used for Unit Testing. TestNG is similar to Junit. Few functionality are added to it that makes TestNg more powerful than JUnit.

Annotations : 

Both uses annotations and almost all the annotations looks similar.

TestNg uses @BeforeMethod @Aftermethod similar to @Before , @After in Junit4

Both uses @Test(timeout=1000) for timeout. 

Annotation to ignore the test TestNg - @Test (enable=false) , Junit @Ignore

Suits are used to execute multiple test together. Suits can be created using both TestNg and JUnit. However , suits are more powerful in TestNg as it uses very different method of execution of tests. 

Exception Test :

Exception testing is available both in TestNg and JUnit4. It is used to check , which exception is thrown from the test?

JUnit - @Test(expected = ArithmeticException.class)

testNg - @Test(expectedException=ArithmeticException.class) 


This feature is implemented both in TestNg and JUnit. TimeOut is used to terminate a test which takes longer than specified time. 


Group test , Parameterized , Dependency test is not available in JUnit.

How do you read data from excel?

FileInputStream fis = new FileInputStream(“path of excel file”); 

Workbook wb = WorkbookFactory.create(fis); 

Sheet s = wb.getSheet(“sheetName”); 

String value = s.getRow(rowNum).getCell(cellNum).getStringCellValue();

What is the alternate way to click on login button?

1. driver.findElement(By.xpath(“  ”).click();

2. driver.findElement(By.xpath(“ ”).sendKeys(keys.RETURN)

3. driver.findElement(By.xpath(“ ”).sendKeys(Keys.ENTER)

4. We can also use submit();

5. There are some JavaScript Library we can use , but I have never used anywhere in my script. 

How do you verify if the checkbox/radio is checked or not?

By using .isSelected() method , This will returns us a boolean value "True" or "False" ,depending on that you can check the condition and enable or leave the radio button selected. 


How do you handle alert pop-up?

To handle alerts popups we need to do switch to the alert window and call Selenium WebDriver Alert API methods.


Get a handle to the open Alert 

Alert alert = driver.switchTo().alert();


Alert is an Interface : 

alert.accept(); // Click on Ok

alert.dismiss(); // Click on cancel 

alert.gettext(); // will get the text present on the alert


Then after we need to go back to main page


How do you launch Firefox/Chrome/IE browser?

Before launching browser  we need to set the system properly. 

System.setProperty(path of the driver )

In selenium we have different WebDrivers for different browser like FireFoxDriver for FireFox Driver , ChromeDriver for google Chrome ,  InternetExplorerDriver for IE.

WebDriver driver = new FireFoxDriver();

How to perform right click using WebDriver?

We use Action class in selenium WebDriver to work on Mouse and Keyboard Actions. 

Actions action = new Actions(driver).contextClick(element);;

How do perform drag and drop using WebDriver?

Action class has two methods that support Drag and Drop

1. Actions.dragAndDrop ( SourceLocator , DestinationLocator)

          SourceoLcator - Element which we need to drag

          DestinationLocator - Element on which we need to drop


      2. Actions.dragAndDropBy ( SourceLocator , x-axis pixel of Destinationlocator , y-axis pixel   of Destination locator) 


     act.dragAndDrop(From, To).build().perform();

Give the example for method overload in WebDriver.

frame(string), frame(int), frame(WebElement)

How do you simulate browser back and forward?



What are the different exceptions you got when working with WebDriver?

ElementNotVisibleException, ElementNotSelectableException, NoAlertPresentException, NoSuchAttributeException, NoSuchWindowException, TimeoutException, WebDriverException etc.

How do you clear the contents of a textbox in selenium?

river.findElement(By.xpath("xpath of box")).clear();

What is a Selenium Framework?

A framework is set of automation guidelines which help in 

Maintaining consistency of Testing, Improves test structuring, Minimum usage of code, Less Maintenance of code, Improve re-usability, Non Technical testers can be involved in code, Training period of using the tool can be reduced, Involves Data wherever appropriate. 

There are five types of framework used in software automation testing: 

1-Data Driven Automation Framework 

2-Method Driven Automation Framework 

3-Modular Automation Framework 

4-Keyword Driven Automation Framework 

5-Hybrid Automation Framework , its basically combination of different frameworks. (1+2+3)

What are the advantages of selenium webdriver?

a) It supports with most of the browsers like Firefox, IE, Chrome, Safari, Opera etc. 

b) It supports with most of the language like Java, Python, Ruby, C# etc. 

b) Doesn’t require to start server before executing the test script. 

c) It has actual core API which has binding in a range of languages. 

d) It supports of moving mouse cursors. 

e) It support to test iphone/Android applications.

How to invoke an application in webdriver ?

driver.get(“url”); or driver.navigate().to(“url”);

What is Selenium Grid?

Selenium-Grid allows you to run your tests on different machines against different browsers in parallel. That is, running multiple tests at the same time against different machines, different browsers and operating systems.

How to get the number of frames on a page?

List <WebElement> framesList = driver.findElements(By.xpath("//iframe")); 

int numOfFrames = frameList.size();

How do you simulate scroll down action?

We can use javascript to scroll down 

WebDriver driver = new FirefoxDriver(); 


JavascriptExecutor jsx = (JavascriptExecutor)driver; 

jsx.executeScript("window.scrollBy(0,4500)", ""); //scroll down 

jsx.executeScript("window.scrollBy(450,0)", ""); //scroll up 

How to check if an element is visible on the web page?

use isDisplayed() method of WebDriver Interface Which . The return type of the method is boolean. So if it return true then element is visible else not visible.

driver.findElement(By.xpath(" ")).isDisplayed();

How to check if a text is highlighted on the page?

String color = driver.findElement(“ ”)).getCssValue("color"); 

String backcolor = driver.findElement(“ “)).getCssValue("background-color"); 



Here if both color and background color is different then that means that element is in different color.

What is the difference b/w close() and quit()?

close() – This method will close the browser window on which the focus is set.

quit() – it will call dispose() an internal method of webdriver which closes all the open browser window opened by the same driver instance.