50 Most Popularly Asked Selenium Interview Questions and Answers – Selenium Tutorial #33

In this tutorial, we have listed the 50 most popularly asked Selenium interview questions including Selenium WebDriver interview questions.

A quick note about this Selenium article series before we move to this last tutorial:

This is the last tutorial in our Selenium online training series of 30+ comprehensive tutorials. I hope you all enjoyed these tutorials and started learning from it. If you are new here please head over to this very first tutorial in this training series.

Top 50 Selenium Interview Questions and Answers:

Selenium Interview Preparation

Q #1) What is Automation Testing?

Automation testing or Test Automation is a process of automating the manual process to test the application/system under test. Automation testing involves use to a separate testing tool which lets you create test scripts which can be executed repeatedly and doesn’t require any manual intervention.

Q #2) What are the benefits of Automation Testing?

Benefits of Automation testing are:

  1. Supports execution of repeated test cases
  2. Aids in testing a large test matrix
  3. Enables parallel execution
  4. Encourages unattended execution
  5. Improves accuracy thereby reducing human generated errors
  6. Saves time and money

Q #3) Why should Selenium be selected as a test tool?

Selenium

  1. is free and open source
  2. have a large user base and helping communities
  3. have cross Browser compatibility (Firefox, chrome, Internet Explorer, Safari etc.)
  4. have great platform compatibility (Windows, Mac OS, Linux etc.)
  5. supports multiple programming languages (Java, C#, Ruby, Python, Pearl etc.)
  6. has fresh and regular repository developments
  7. supports distributed testing

Q #4) What is Selenium? What are the different Selenium components?

Selenium is one of the most popular automated testing suites. Selenium is designed in a way to support and encourage automation testing of functional aspects of web based applications and a wide range of browsers and platforms. Due to its existence in the open source community, it has become one of the most accepted tools amongst the testing professionals.

Selenium is not just a single tool or a utility, rather a package of several testing tools and for the same reason it is referred to as a Suite. Each of these tools is designed to cater different testing and test environment requirements.

The suite package constitutes of the following sets of tools:

  • Selenium Integrated Development Environment (IDE) – Selenium IDE is a record and playback tool. It is distributed as a Firefox Plugin.
  • Selenium Remote Control (RC) – Selenium RC is a server that allows user to create test scripts in a desired programming language. It also allows executing test scripts within the large spectrum of browsers.
  • Selenium WebDriver – WebDriver is a different tool altogether that has various advantages over Selenium RC. WebDriver directly communicates with the web browser and uses its native compatibility to automate.
  • Selenium Grid – Selenium Grid is used to distribute your test execution on multiple platforms and environments concurrently.

Q #5) What are the testing types that can be supported by Selenium?

Selenium supports the following types of testing:

  1. Functional Testing
  2. Regression Testing

Q #6) What are the limitations of Selenium?

Following are the limitations of Selenium:

  • Selenium supports testing of only web based applications
  • Mobile applications cannot be tested using Selenium
  • Captcha and Bar code readers cannot be tested using Selenium
  • Reports can only be generated using third party tools like TestNG or Junit.
  • As Selenium is a free tool, thus there is no ready vendor support though the user can find numerous helping communities.
  • User is expected to possess prior programming language knowledge.

Q #7) What is the difference between Selenium IDE, Selenium RC and WebDriver?

FeatureSelenium IDESelenium RCWebDriver
Browser CompatibilitySelenium IDE comes as a Firefox plugin, thus it supports only FirefoxSelenium RC supports a varied range of versions of Mozilla Firefox, Google Chrome, Internet Explorer and OperaWebDriver supports a varied range of versions of Mozilla Firefox, Google Chrome, Internet Explorer and Opera.
Also supports HtmlUnitDriver which is a GUI less or headless browser.
Record and PlaybackSelenium IDE supports record and playback featureSelenium RC doesn't supports record and playback featureWebDriver doesn't support record and playback feature
Server RequirementSelenium IDE doesn't require any server to be started before executing the test scriptsSelenium RC requires server to be started before executing the test scriptsWebDriver doesn't require any server to be started before executing the test scripts
ArchitectureSelenium IDE is a Javascript based frameworkSelenium RC is a JavaScript based FrameworkWebDriver uses the browser's native compatibility to automation
Object OrientedSelenium IDE is not an object oriented toolSelenium RC is semi object oriented toolWebDriver is a purely object oriented tool
Dynamic Finders
(for locating web elements on a webpage)
Selenium IDE doesn't support dynamic findersSelenium RC doesn't support dynamic findersWebDriver supports dynamic finders
Handling Alerts, Navigations, DropdownsSelenium IDE doesn't explicitly provides aids to handle alerts, navigations, dropdownsSelenium RC doesn't explicitly provides aids to handle alerts, navigations, dropdownsWebDriver offers a wide range of utilities and classes that helps in handling alerts, navigations, and dropdowns efficiently and effectively.
WAP (iPhone/Android) TestingSelenium IDE doesn't support testing of iPhone/Andriod applicationsSelenium RC doesn't support testing of iPhone/Andriod applicationsWebDriver is designed in a way to efficiently support testing of iPhone/Android applications. The tool comes with a large range of drivers for WAP based testing.
For example, AndroidDriver, iPhoneDriver
Listener SupportSelenium IDE doesn't support listenersSelenium RC doesn't support listenersWebDriver supports the implementation of Listeners
SpeedSelenium IDE is fast as it is plugged in with the web-browser that launches the test. Thus, the IDE and browser communicates directlySelenium RC is slower than WebDriver as it doesn't communicates directly with the browser; rather it sends selenese commands over to Selenium Core which in turn communicates with the browser.WebDriver communicates directly with the web browsers. Thus making it much faster.

Q #8) When should I use Selenium IDE?

Selenium IDE is the simplest and easiest of all the tools within the Selenium Package. Its record and playback feature makes it exceptionally easy to learn with minimal acquaintances to any programming language. Selenium IDE is an ideal tool for a naïve user.

Q #9) What is Selenese?

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

Q #10) What are the different types of locators in Selenium?

Locator can be termed as an address that identifies a web element uniquely within the webpage. Thus, to identify web elements accurately and precisely we have different types of locators in Selenium:

  • ID
  • ClassName
  • Name
  • TagName
  • LinkText
  • PartialLinkText
  • Xpath
  • CSS Selector
  • DOM

Q #11) What is difference between assert and verify commands?

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

Verify: Verify command also checks whether the given condition is true or false. Irrespective of the condition being true or false, the program execution doesn’t halts i.e. any failure during verification would not stop the execution and all the test steps would be executed.

Q #12) What is an Xpath?

Xpath is used to locate a web element based on its XML path. XML stands for Extensible Markup Language and is used to store, organize and transport arbitrary data. It stores data in a key-value pair which is very much similar to HTML tags. Both being markup languages and since they fall under the same umbrella, Xpath can be used to locate HTML elements.

The fundamental behind locating elements using Xpath is the traversing between various elements across the entire page and thus enabling a user to find an element with the reference of another element.

Q #13) What is the difference between “/” and “//” in Xpath?

Single Slash “/” – Single slash is used to create Xpath with absolute path i.e. the xpath would be created to start selection from the document node/start node.

Double Slash “//” – Double slash is used to create Xpath with relative path i.e. the xpath would be created to start selection from anywhere within the document.

Q #14) What is Same origin policy and how it can be handled?

The problem of same origin policy disallows to access the DOM of a document from an origin that is different from the origin we are trying to access the document.

Origin is a sequential combination of scheme, host and port of the URL. For example, for a URL http:// http://www.softwaretestinghelp.com/resources/, the origin is a combination of http, softwaretestinghelp.com, 80 correspondingly.

Thus the Selenium Core (JavaScript Program) cannot access the elements from an origin that is different from where it was launched. For Example, if I have launched the JavaScript Program from “http://www.softwaretestinghelp.com”, then I would be able to access the pages within the same domain such as “http://www.softwaretestinghelp.com/resources” or “http://www.softwaretestinghelp.com/istqb-free-updates/”. The other domains like google.com, seleniumhq.org would no more be accessible.

So, In order to handle same origin policy, Selenium Remote Control was introduced.

Q #15) When should I use Selenium Grid?

Selenium Grid can be used to execute same or different test scripts on multiple platforms and browsers concurrently so as to achieve distributed test execution, testing under different environments and saving execution time remarkably.

Q #16) What do we mean by Selenium 1 and Selenium 2?

Selenium RC and WebDriver, in a combination are popularly known as Selenium 2. Selenium RC alone is also referred as Selenium 1.

Q #17) Which is the latest Selenium tool?

WebDriver

Q #18) How do I launch the browser using WebDriver?

The following syntax can be used to launch Browser:
WebDriver driver = new FirefoxDriver();
WebDriver driver = new ChromeDriver();
WebDriver driver = new InternetExplorerDriver();

Q #19) What are the different types of Drivers available in WebDriver?

The different drivers available in WebDriver are:

  • FirefoxDriver
  • InternetExplorerDriver
  • ChromeDriver
  • SafariDriver
  • OperaDriver
  • AndroidDriver
  • IPhoneDriver
  • HtmlUnitDriver

Q #20) What are the different types of waits available in WebDriver?

There are two types of waits available in WebDriver:

  1. Implicit Wait
  2. Explicit Wait

Implicit Wait: Implicit waits are used to provide a default waiting time (say 30 seconds) between each consecutive test step/command across the entire test script. Thus, subsequent test step would only execute when the 30 seconds have elapsed after executing the previous test step/command.

Explicit Wait: Explicit waits are used to halt the execution till the time a particular condition is met or the maximum time has elapsed. Unlike Implicit waits, explicit waits are applied for a particular instance only.

Q #21) How to type in a textbox using Selenium?

User can use sendKeys(“String to be entered”) to enter the string in the textbox.

Syntax:
WebElement username = drv.findElement(By.id(“Email”));
// entering username
username.sendKeys(“sth”);

Q #22) How can you find if an element in displayed on the screen?

WebDriver facilitates the user with the following methods to check the visibility of the web elements. These web elements can be buttons, drop boxes, checkboxes, radio buttons, labels etc.

  1. isDisplayed()
  2. isSelected()
  3. isEnabled()

Syntax:

isDisplayed():
boolean buttonPresence = driver.findElement(By.id(“gbqfba”)).isDisplayed();

isSelected():
boolean buttonSelected = driver.findElement(By.id(“gbqfba”)).isDisplayed();

isEnabled():
boolean searchIconEnabled = driver.findElement(By.id(“gbqfb”)).isEnabled();

Q #23) How can we get a text of a web element?

Get command is used to retrieve the inner text of the specified web element. The command doesn’t require any parameter but returns a string value. It is also one of the extensively used commands for verification of messages, labels, errors etc displayed on the web pages.

Syntax:
String Text = driver.findElement(By.id(“Text”)).getText();

Q #24) How to select value in a dropdown?

Value in the drop down can be selected using WebDriver’s Select class.

Syntax:

selectByValue:
Select selectByValue = new Select(driver.findElement(By.id(“SelectID_One”)));
selectByValue.selectByValue(“greenvalue”);

selectByVisibleText:
Select selectByVisibleText = new Select (driver.findElement(By.id(“SelectID_Two”)));
selectByVisibleText.selectByVisibleText(“Lime”);

selectByIndex:
Select selectByIndex = new Select(driver.findElement(By.id(“SelectID_Three”)));
selectByIndex.selectByIndex(2);

Q #25) What are the different types of navigation commands?

Following are the navigation commands:
navigate().back() – The above command requires no parameters and takes back the user to the previous webpage in the web browser’s history.

Sample code:
driver.navigate().back();

navigate().forward() – This command lets the user to navigate to the next web page with reference to the browser’s history.

Sample code:
driver.navigate().forward();

navigate().refresh() – This command lets the user to refresh the current web page there by reloading all the web elements.

Sample code:
driver.navigate().refresh();

navigate().to() – This command lets the user to launch a new web browser window and navigate to the specified URL.

Sample code:
driver.navigate().to(“https://google.com”);

Q #26) How to click on a hyper link using linkText?

driver.findElement(By.linkText(“Google”)).click();

The command finds the element using link text and then click on that element and thus the user would be re-directed to the corresponding page.

The above mentioned link can also be accessed by using the following command.


driver.findElement(By.partialLinkText(“Goo”)).click();

The above command find the element based on the substring of the link provided in the parenthesis and thus partialLinkText() finds the web element with the specified substring and then clicks on it.

Q #27) How to handle frame in WebDriver?

An inline frame acronym as iframe is used to insert another document with in the current HTML document or simply a web page into a web page by enabling nesting.

Select iframe by id
driver.switchTo().frame(ID of the frame);

Locating iframe using tagName
driver.switchTo().frame(driver.findElements(By.tagName(“iframe”).get(0));

Locating iframe using index

frame(index)
driver.switchTo().frame(0);

frame(Name of Frame)
driver.switchTo().frame(“name of the frame”);

frame(WebElement element)
Select Parent Window
driver.switchTo().defaultContent();

Q #28) When do we use findElement() and findElements()?

findElement(): findElement() is used to find the first element in the current web page matching to the specified locator value. Take a note that only first matching element would be fetched.

Syntax:

WebElement element = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));
findElements(): findElements() is used to find all the elements in the current web page matching to the specified locator value. Take a note that all the matching elements would be fetched and stored in the list of WebElements.

Syntax:
List <WebElement> elementList = driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));

Q #29) How to find more than one web element in the list?

At times, we may come across elements of same type like multiple hyperlinks, images etc arranged in an ordered or unordered list. Thus, it makes absolute sense to deal with such elements by a single piece of code and this can be done using WebElement List.

Sample Code

// Storing the list
List <WebElement> elementList = driver.findElements(By.xpath("//div[@id='example']//ul//li"));
// Fetching the size of the list
int listSize = elementList.size();
for (int i=0; i<listSize; i++)
{
// Clicking on each service provider link
serviceProviderLinks.get(i).click();
// Navigating back to the previous page that stores link to service providers
driver.navigate().back();
}

Q #30) What is the difference between driver.close() and driver.quit command?

close(): WebDriver’s close() method closes the web browser window that the user is currently working on or we can also say the window that is being currently accessed by the WebDriver. The command neither requires any parameter nor does is return any value.

quit(): Unlike close() method, quit() method closes down all the windows that the program has opened. Same as close() method, the command neither requires any parameter nor does is return any value.

Q #31) Can Selenium handle windows based pop up?

Selenium is an automation testing tool which supports only web application testing. Therefore, windows pop up cannot be handled using Selenium.

Q #32) How can we handle web based pop up?

WebDriver offers the users with a very efficient way to handle these pop ups using Alert interface. There are the four methods that we would be using along with the Alert interface.

  • void dismiss() – The accept() method clicks on the “Cancel” button as soon as the pop up window appears.
  • void accept() – The accept() method clicks on the “Ok” button as soon as the pop up window appears.
  • String getText() – The getText() method returns the text displayed on the alert box.
  • void sendKeys(String stringToSend) – The sendKeys() method enters the specified string pattern into the alert box.

Syntax:
// accepting javascript alert
                Alert alert = driver.switchTo().alert();
alert.accept();

Q #33) How can we handle windows based pop up?

Selenium is an automation testing tool which supports only web application testing, that means, it doesn’t support testing of windows based applications. However Selenium alone can’t help the situation but along with some third party intervention, this problem can be overcome. There are several third party tools available for handling window based pop ups along with the selenium like AutoIT, Robot class etc.

Q #34) How to assert title of the web page?

//verify the title of the web page
assertTrue(“The title of the window is incorrect.”,driver.getTitle().equals(“Title of the page”));

Q #35) How to mouse hover on a web element using WebDriver?

WebDriver offers a wide range of interaction utilities that the user can exploit to automate mouse and keyboard events. Action Interface is one such utility which simulates the single user interactions.

Thus, In the following scenario, we have used Action Interface to mouse hover on a drop down which then opens a list of options.

Sample Code:

// Instantiating Action Interface
Actions actions=new Actions(driver);
// howering on the dropdown
actions.moveToElement(driver.findElement(By.id("id of the dropdown"))).perform();
// Clicking on one of the items in the list options
WebElement subLinkOption=driver.findElement(By.id("id of the sub link"));
subLinkOption.click();

Q #36) How to retrieve css properties of an element?

The values of the css properties can be retrieved using a get() method:

Syntax:
driver.findElement(By.id(“id“)).getCssValue(“name of css attribute”);
driver.findElement(By.id(“id“)).getCssValue(“font-size”);

Q #37) How to capture screenshot in WebDriver?

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class CaptureScreenshot {
       WebDriver driver;
       @Before
       public void setUp() throws Exception {
            driver = new FirefoxDriver();
            driver.get("https://google.com");
     }
     @After
     public void tearDown() throws Exception {
            driver.quit();
     }

     @Test
     public void test() throws IOException {
            // Code to capture the screenshot
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
            // Code to copy the screenshot in the desired location
FileUtils.copyFile(scrFile, new File("C:\\CaptureScreenshot\\google.jpg"));                  
     }
}

Q #38) What is Junit?

Junit is a unit testing framework introduced by Apache. Junit is based on Java.

Q #39) What are Junit annotations?

Following are the Junit Annotations:

  • @Test: Annotation lets the system know that the method annotated as @Test is a test method. There can be multiple test methods in a single test script.
  • @Before: Method annotated as @Before lets the system know that this method shall be executed every time before each of the test method.
  • @After: Method annotated as @After lets the system know that this method shall be executed every time after each of the test method.
  • @BeforeClass: Method annotated as @BeforeClass lets the system know that this method shall be executed once before any of the test method.
  • @AfterClass: Method annotated as @AfterClass lets the system know that this method shall be executed once after any of the test method.
  • @Ignore: Method annotated as @Ignore lets the system know that this method shall not be executed.

Q #40) What is TestNG and how is it better than Junit?

TestNG is an advance framework designed in a way to leverage the benefits by both the developers and testers. With the commencement of the frameworks, JUnit gained an enormous popularity across the Java applications, Java developers and Java testers with remarkably increasing the code quality. Despite being easy to use and straightforward, JUnit has its own limitations which give rise to the need of bringing TestNG into the picture. TestNG is an open source framework which is distributed under the Apache software License and is readily available for download.

TestNG with WebDriver provides an efficient and effective test result format that can in turn be shared with the stake holders to have a glimpse on the product’s/application’s health thereby eliminating the drawback of WebDriver’s incapability to generate test reports. TestNG has an inbuilt exception handling mechanism which lets the program to run without terminating unexpectedly.

There are various advantages that make TestNG superior to JUnit. Some of them are:

  • Added advance and easy annotations
  • Execution patterns can set
  • Concurrent execution of test scripts
  • Test case dependencies can be set

Q #41) How to set test case priority in TestNG?

Setting Priority in TestNG

Code Snippet

package TestNG;
import org.testng.annotations.*;
public class SettingPriority {
      @Test(priority=0)
      public void method1() {   
      }
      @Test(priority=1)
      public void method2() {  
      }
      @Test(priority=2)
      public void method3() {   
      }
}

Test Execution Sequence:

  1. Method1
  2. Method2
  3. Method3

Q #42) What is a framework?

Framework is a constructive blend of various guidelines, coding standards, concepts, processes, practices, project hierarchies, modularity, reporting mechanism, test data injections etc. to pillar automation testing.

Q #43) What are the advantages of Automation framework?

Advantage of Test Automation framework

  • Reusability of code
  • Maximum coverage
  • Recovery scenario
  • Low cost maintenance
  • Minimal manual intervention
  • Easy Reporting

Q #44) What are the different types of frameworks?

Below are the different types of frameworks:

  1. Module Based Testing Framework: The framework divides the entire “Application Under Test” into number of logical and isolated modules. For each module, we create a separate and independent test script. Thus, when these test scripts taken together builds a larger test script representing more than one module.
  2. Library Architecture Testing Framework: The basic fundamental behind the framework is to determine the common steps and group them into functions under a library and call those functions in the test scripts whenever required.
  3. Data Driven Testing Framework: Data Driven Testing Framework helps the user segregate the test script logic and the test data from each other. It lets the user store the test data into an external database. The data is conventionally stored in “Key-Value” pairs. Thus, the key can be used to access and populate the data within the test scripts.
  4. Keyword Driven Testing Framework: The Keyword driven testing framework is an extension to Data driven Testing Framework in a sense that it not only segregates the test data from the scripts, it also keeps the certain set of code belonging to the test script into an external data file.
  5. Hybrid Testing Framework: Hybrid Testing Framework is a combination of more than one above mentioned frameworks. The best thing about such a setup is that it leverages the benefits of all kinds of associated frameworks.
  6. Behavior Driven Development Framework: Behavior Driven Development framework allows automation of functional validations in easily readable and understandable format to Business Analysts, Developers, Testers, etc.

Q #45) How can I read test data from excels?

Test data can efficiently be read from excel using JXL or POI API. See detailed tutorial here.

Q #46) What is the difference between POI and jxl jar?

#JXL jarPOI jar
1JXL supports “.xls” format i.e. binary based format. JXL doesn’t support Excel 2007 and “.xlsx” format i.e. XML based formatPOI jar supports all of these formats
2JXL API was last updated in the year 2009POI is regularly updated and released
3The JXL documentation is not as comprehensive as that of POIPOI has a well prepared and highly comprehensive documentation
4JXL API doesn’t support rich text formattingPOI API supports rich text formatting
5JXL API is faster than POI APIPOI API is slower than JXL API

Q #47) What is the difference between Selenium and QTP?

FeatureSeleniumQuick Test Professional (QTP)
Browser CompatibilitySelenium supports almost all the popular browsers like Firefox, Chrome, Safari, Internet Explorer, Opera etcQTP supports Internet Explorer, Firefox and Chrome. QTP only supports Windows Operating System
DistributionSelenium is distributed as an open source tool and is freely availableQTP is distributed as a licensed tool and is commercialized
Application under TestSelenium supports testing of only web based applicationsQTP supports testing of both the web based application and windows based application
Object RepositoryObject Repository needs to be created as a separate entityQTP automatically creates and maintains Object Repository
Language SupportSelenium supports multiple programming languages like Java, C#, Ruby, Python, Perl etcQTP supports only VB Script
Vendor SupportAs Selenium is a free tool, user would not get the vendor’s support in troubleshooting issuesUsers can easily get the vendor’s support in case of any issue

Q #48) Can WebDriver test Mobile applications?

WebDriver cannot test Mobile applications. WebDriver is a web based testing tool, therefore applications on the mobile browsers can be tested.

Q #49) Can captcha be automated?

No, captcha and bar code reader cannot be automated.

Q #50) What is Object Repository? How can we create Object Repository in Selenium?

Object Repository is a term used to refer to the collection of web elements belonging to Application Under Test (AUT) along with their locator values. Thus, whenever the element is required within the script, the locator value can be populated from the Object Repository. Object Repository is used to store locators in a centralized location instead of hard coding them within the scripts.

In Selenium, objects can be stored in an excel sheet which can be populated inside the script whenever required.

That’s all for now.

Hope in this article you will find answers to most frequently asked Selenium and WebDriver Interview questions. The answers provided here are also helpful for understanding the Selenium basics and advanced WebDriver topics.

Do you have any Selenium Interview questions that are not answered here? Please let us know in comments below and we will try to answer all.

=> This finishes not just this article but our complete Selenium training series. Check list of ALL 30+ tutorials listed on this page. Please let us know your comments and questions.




Recommended reading

287 comments ↓

#1 dwarika

Awesome post

#2 rushsun

Excellent blog for selenium learners.

#3 Jack

Awesome q&A

#4 Shruti Shrivastava

@Dwarika @Rushsun @Jack

Thank you for the appreciation..

#5 Test

V. gud articles.
A lot can be gained from these artices.

#6 Supriya

Excellent and detailed answers. I will be referring all these tutorials for learning Selenium.

#7 Nikesh

Ans to Q#49 is wrong.

#8 Roopesh

Excellent Articles…..

#9 Sweta

Nice and Helpful .

Keep doing such things to help us

#10 Shruti Shrivastava

@Test @Supriya @Roopesh @Sweta

Thank you for the appreciative words.

#11 Roman

Hi,

It’s a very good post. I think adding Q&A about page object could be great. It’s a widely used pattern nowadays.

#12 Charan

Thanks very much!!!
Very Useful and Informative.

#13 krishna

good questions and answers for selenium

#14 Brij

Could you please make a video for how to read the excel file. Also, when you call TestNG a framework than what is the difference between TestNG framework and regular framework.

Could you please give example of implicit and explicit wait.

#15 Shwetank

Wonderful collection with amazing explanation.

#16 Tai Le

Great collection.
Thank you so much for your course :)

#17 Thiru

good post

#18 Jamuna

Informative One..

#19 Shakun

Good and helpful article.
Thanks..!!

#20 HanumanReddy

Thank you very much for helping US

We hope this year you will have happiness

#21 chiranjeevi

i want to knw how to test multiple tests in multiple browsers at time using grid.do u have any code.pls post in ur website.

#22 Ank Gupta

Nice post.. can find all important question of Selenium

#23 hari

Good collection.

#24 Ashim

Really excellent.It helped me a lot.

#25 vehla

Katal bai ji katal…..
wah…sirra jma he sirra la ti
.

#26 sandeep chopra

Awesome note.. Super se bhi upar…. :)

#27 Deepak Rawat

It’s a very good collection and helpful for all.

#28 Sibaram

Awesome Post Shruti. Thanks for sharing :)

#29 Naveen

Thanks for putting together such wonderful post. This is going to help a lot of us.

Just to add some information for
Q48: ” Can WebDriver test Mobile applications?”
a) Mobile applications cannot be automated with WebDriver alone, However with help of third party toold like “appium” mobile application can be automated.

#30 Arun

Thanks a lot :)

#31 Abhijeet Shitole

Very nice

#32 Chaitanya

Excellent post. May be you can also porvide some info on how are the DB connectivities made from the tool.

#33 Heshan

There is a conflict in Q48.

it should be as:
“WebDriver cannot test Mobile applications. WebDriver is a web based testing tool, therefore applications on the mobile browsers can not be tested.”

And Nice article

#34 Mahidhar Ch

Its nice collection

#35 N Kiran Kumar

Very much helpful. Thanks a lot. :)

#36 DCS

Very Helpful, Thanks for sharing…

#37 Niti Patel

thank you very much for writing such a detailed article. It is very helpful:)

#38 Anand

Thank you for this article, it was very informative.
Recently i had attended an interview on selenium where they had asked me to write a webdriver program to count the number of hyperlinks in a webpage. It is also most frequent question now a days. so pls add this question to the list it might be useful for someone else.

#39 Rajani

Excellent Artical to gain selenium knowledge. Thank you.

#40 Santosh

Please correct the syntax for question 28.
Instead of findElement it is mentioned as findElements.

#41 Anand

Thank you somuch..

#42 prasad

Good

#43 Nirmala Tajne

Hello,

Very good collection of questions and answers. Really helpful…

#44 prakash

very nice article, i want connect in ur circle so plz send ur linkden id

#45 surekha

Thank you

#46 Jitendra

Very helpful. Thanks a lot.

#47 MATS

A very descriptive tutorial .That help beginners gain expertise .Thank you!!

#48 Asheesh

Thanks for putting together such wonderful post. This is going to help a lot of us.

#49 sathya

Thank you. Very informative.

#50 hari

Thanks for the info. Very useful.

#51 Kuban

Thanks very much!!!
Very Useful and Informative.

#52 Vipin

Thank you..It is very useful for selenium Learners

#53 Sunil

Gr8 job….wonderful post….Thanks for sharing knowledge.

Keep posting and updating new questions too

Thank a lot :-)

#54 venkateswarlu

exlent

#55 Rajagopal

very good….Thanks

#56 VIKRANT

keep posting such helpful data . Really very good set of questions.

#57 Archana Singh

very good post ….

#58 Sram

I appreciated you

#59 shailesh

I have one problem after lunching web browser ,i am not getting my “URL ” i have written right code only..???

#60 yerriswamy

yes really its very usefull to all …and also easy to understand ……great work

#61 Divyanshu Rawat

very good post….very helpful..keep posting such kind of informative post.

#62 Jitendra

good questions and answers for selenium

#63 Jitendra kumar pal

Excellent Artical to gain selenium knowledge. Thank you.

#64 Lyn T

Very good compilation! Thanks!

#65 TPR

excellent…it is very helpful…for everyone

Thanks lot

#66 Farid

Wonderful …..collection with amazing explanation. Thank you.

#67 Pratik Chirkute

Really good article. Keep it up.

#68 Vikram

Really good and informative article. Thanks for sharing!!

#69 Kiran

Thank you!

#70 yugandhar

very good

#71 VijayaLakhsmi

Good Explanation

#72 chitra

very good and helpful

#73 Akshay

Very helpful series of Selenium. I would request “SoftwareTestingHelp” team to make a mobile app so anytime, anywhere we can use it..

Thank you for making this series available for us.

I wish all the best for future articles.

#74 Nisha

Its very useful. Very good post

#75 Prasanna

thanks sir

#76 shashank

Covered all the basic level selenium questions asked in interviews. Helps in quick revision. Good Job Team. Keep updating!

#77 Ranjith

Very Helpful information…thank you

#78 Anil Alluri

Hi,
This is helpful for selenium students. In Q22 have some wrong statement. please check this as a report.

this isSelected():
boolean buttonSelected = driver.findElement(By.id(“gbqfba”)).isSelected();

#79 Rohit

Too much useful & sharp answers with a valid point !!

Thank You.

#80 Andy

Concise and to the point, just what I needed to get my mojo to study selenium :)

#81 Bharath Urs

A very good article/references on selenium.
Thank you:)

#82 sandip

a very nice artical like it
Thank you

#83 Shahrukh khan

Nice tutorial

#84 Nirmala

WebDriver driver = new ChromeDriver();
WebDriver driver = new InternetExplorerDriver(); we cannot launch InternetExplorer and Chrome driver directly usinh instance.we need set systemproperty

#85 Nirmala

Q #31) Can Selenium handle windows based pop up?

We can handle the window popup using AUTOIT

#86 ASIF Alberto

Thanks :)
So much helpful :)
keep posting..

#87 shivappa

very good one more on basics

#88 Bhawna

Good One !!

#89 Prakash Kerlekar

Very good article.

Please keep sharing Testing knowledge.

Thank u……………

#90 zubita

Mobile Testing is possible and can done using sele,,

#91 Robin

Very helpful and appreciate your work
thank you

#92 Yatin

Very helpful ….
Thank you …

#93 Keshav Narayan Dhakane

Best ,Well described

#94 JustPassingBy

Great article for beginners like me!
Thanks

#95 Sumanth

I just have read this article and attending an interview for automation.. Truly wonderful article…

#96 Anish

“selenium-server-standalone” jar contains all the library files to run automation scripts then why do we need to use “selenium-java” jars?

#97 radhakrishna

Very helpful-Thanks!!

#98 Sinhala

Very informative article , Thanks

#99 Amrita Gautam

Thanks It was a very helpful article

#100 TCK

Q 32) Instead of dismiss in the explanation you’ve written accept() for both accept() as well as dismiss(). Apart from this, the Article is superb.
void dismiss() – The accept() method clicks on the “Cancel” button as soon as the pop up window appears.

#101 sridhar

very nice and informative article

#102 Senthil Kumar Devaraj

Really Good Post Team..! Worth visiting the Page.!

#103 Mình Nguyen

Useful article. Keep going!

#104 Minh Nguyen

Nice article. I really appreciate with it!

#105 vishwa

superb

#106 anusha

Thank you very much sir

#107 Muthupondi

Very useful post.Thank u so much

#108 Murtaza Mansoor

simply awesome

#109 Murtaza Mansoor

extremely useful post. Thanks

#110 sivaram

Hey ,
you guys need a standing ovation for providing awesome stuff for free of cost. Thanks buddies :)

#111 Mani

Thank you very much…Really very useful :)

#112 DilRice

It is very helpful and good article.. Thank u so much

#113 Suresh

It’s good article

#114 Basant

Hi Team,

Thanks for your efforts.
I had a query which i faced during an interview, he asked me that if a web element is not having any locators or many of web elements are having same attributes. Then how to retrieve the information of a particular element.

#115 Yugi

Explanation is super and easy to understand…. tq

#116 Ganesh

Selenium version and date of release it will help to know about selenium from begning.

#117 hari

very helpful and good article..

Thank u so much :)

#118 Savitri

Hi,

The above article is very useful to know the important questions asked in the interviews.But If you can explain more about object repository then it will be a great help.

Thanks,
Savitri

#119 shivsagar

Hi,

That was a excellent collection of questions.Great :)

#120 kiran

Hi,

Good Explanation and easy to learn. thank uuuuu soo much.
Regards,
kiran

#121 Ashok Kumar Verma

Hi,
I want to use WebDriver driver object in two or more class without opening more browser open.Also any body provide the format of TestNG code as per above mention.
::
more class use same driver same browser with testng annotation

#122 Amit

Above questions are very helpful and I think you should add some advanced level questions. I have been asked questions in interview like:
– What are the problems you have faced while scripting in selenium and how did you resolve them.
– What are disadvantage of POM.
– what is desiredCapabilities
– Questions from TestNG.

#123 RAVI

I have a question.

Question.
Suppose you have automated all the 1000 test cases. If client asked to run two test cases suppose those are 576 and 598. Then how will it performed ?

#124 Jagan

Hello,
This is very helpful for us to rush into interview. Thanks for posting such a wonderful notes and making the interviews easy…thanku.

#125 Mahesh

Hello team,

You’ve mistakenly mentioned selenium RC is introduced to overcome Same origin policy in question no.14.

But, Same origin policy is the only reason to avoid using Selenium RC and because of that they introduced WebDriver to overcome this problem.

Please update the same, if I am not wrong.

#126 dheeraj saurabh

this is very helpful for us..

#127 suraj_pp

Excellent article. Thanks a million. Its been very helpful.

#128 sirishakumari

How to explain automation life cycle? and
what is actual automation process (selenium)in practical ?
plz mail me

#129 VIKASH

How to handle scroll up and scroll down in selenium webdriver?

Plz advice.

#130 Naresh Kumar Davuluri

Thanks a ton for these questions. They really help.

You could also please include these as well:

51. What is the difference between driver.get() and driver.navigate().to() commands?

52. Can’t we use

FirefoxDriver() driver = new FirefoxDriver(); instead of
WenbDriver driver = new FirefoxDriver();

#131 SHIVAKUMAR

Really Great work carried by software testing help team !!!!! keep it up the good work!!!
Articles were really helpful.

Thank you very much :)

#132 Naresh Gajula

Very good questions (with ans). Thank you so much for helping many!!

#133 Raj

Using Appium we can automate Mobile applications with Selenium.

#134 Dipesh Jain

Very nice explanation.

#135 nagabhushanam

Very good questions (with ans). Thank you so much for helping many!!

#136 Smitha

How to automate/test for the banners (advertisements that keep rolling on the webpage)? Is this possible?

#137 Smitha

How to test/automate the banners on the webpage?

#138 Deepali

Really very much informative…..

#139 A

Little unclear on 48th answer

#140 Deepu

In Selenium IDE I am writting an program to generate the order number. So the next time when I run it throws an error because it has the same Order number. How to handle this

#141 Tejeshwar Jaiswal

Hi, I want to know data driven testing using web driver through excel sheet and CSV file.
Could you please help it out.

#142 pavan

Awesome introduction to basics of selenium, if possible post some more real time challenging interview questions.

Like Comparing the logo on web page, To cross verify the web page opened is correct or not, to check how many advertisement windows opened in 1 web page, counting number of elements present on web page with 1 line of code.

#143 Nagappan

Thank you So Much!!!

#144 Navaneetha

I have read somewhere that Selenium WebDriver could be used to test Mobile applications as well. Is that true?

#145 Jain

Awesome knowledge on Selenium, very crisp and point to point.

#146 Archit Jain

Awesome Post. Thanks a lot!

#147 chandrashekar.k

Hi,

This is wonderful post but can you please let me know what all concepts are must for me to crack any interview for Selenium. Thanks in advance for your response.

#148 Neha

Very precise and accurate. Thankyou for posting it :)

#149 sourabh p

great

#150 Samps

what is the major difference in between relative vs absolute xpath..
For example:
……………………….
1st time my xpath is—->.//*[@spellcheck=’false’]
this case it will be shown 2matching nodes..and second time i’m filtering this xpath to—>
.//*[@spellcheck=’false’][@id=’Email’]…this time i have only one matching node so i can say this is absolute…!

#151 Suresh k

Do now the POM framework….Supriya

#152 amy

Very nice QNA

#153 Vivek

Awesome Post!!!
Very good for selenium leaner..

#154 Santanu

Mobile apps can be tested as we had done it for Andriod, HTML5, Windows, Blackberry and to some extent iOS too way back in 2011 to 2013.
Really surprising answer.

#155 Sam

Hi,

Nice post, I would also like to add few interview questions which i have faced in recent times

– Cross browsing
– Connections to Database
– Window Handling’s
– About Framework
– About Cont Integration tool and build tools
– challenges

#156 Kannan

On Q#32,

void dismiss() – The accept() method clicks on the “Cancel” button as soon as the pop up window appears.

– In the above sentence, the word “accept()” should be replaced with “dismiss()”.

#157 Megha

Good Post, helpfull

#158 Manikanta

Excellent article

#159 SDP

Good and Helpful post

#160 Piyush Kulkarni

Nice article !!
But there is one major part is missing that is data driven testing in detail :
1. Using .csv file
2. Data provider
3. Using excel file

#161 Testing Goddess

You are amazing! But, you need to read the above comments and make necessary changes in the article.

#162 Navnit Mishra

Please check your browser version with respect to the Driver version and then run the program.

#163 Rajat Trikha

I realy like the post and since I have some basic understanding of selenium. So i was able to link every answer with my understanding.
Look forward for more such articles.

#164 khushbu

Thanks for sharing . It was very useful .

#165 Swetha M

Awesome information about Selenium…It is very useful for Selenium learners…

#166 Shiv

Many Answers are wrong…. e.g difference b/w implicit wait and explicit wait

#167 Abhishek Bhandary

Actually my problem is that i have used javascriptexecutor to find the element by id but id of that element has to change everytime so i know in that case dynamic xpath should be used but result is coming with some error so can you help me how to write dynamic xpath in javascriptexecutor.

#168 R

Excellent, thank you for the information

#169 Ashu

Can you explain Import org.openqa.selenium.Webdriver as Webdriver is Interface and org openqa selenium what are they?

#170 anil kanpan

it really wonder full interview Q/A for fresher

#171 Davinder Singh

Thanks for explaining all questions however i just wanted to ask you about Jenkins if possible for you.

#172 online selenium training

thanks for listing important questions and answers

#173 Shwetha

Thank you very much for this information. Everything was precise. It was very helpful!

#174 sudha

Really good and Helpfull… Try to give the basic code for some questions like data reading Excel sheet etc…
Thanks a lot …

#175 Guru

Awesome article! Thanks a lot for the share.

I would only request the author to keep it up to date from time to time. Will be really helpful !

#176 sachin duve

Hi, how do we create batch file(.bat) to execute selenium test suite when we are adding jar/library files using Maven dependencies.

#177 Manisha sah

your Q #48) Can WebDriver test Mobile applications?
answer is wrong…we can use appiup with webdriver to test mobile apps.

#178 Mehul Mistry

Very Good Artical , Keep Doing this …

#179 A.Sivaprasad

this information is very use full for me

#180 Dirk

Your answers for Waits is wrong.

#181 Excellent Info and ver y easy to get

Thank you

#182 paril shah

hi @shruti….how r u?

#183 paril shah

hi manisha, neha , smitha, deepali…
how r u all?

#184 Rajani reddy

very nice
but add few more questions and answers

#185 Yuvaraj

Which test case should not be automated?

#186 Akash saini

This is a great post. good for getting a quick revision.

#187 Anbarasu

Hi Shruthi, This is really helpful to new learner and they can be easily able to understood about selenium.

Thanks for this post..

Have a great future….

#188 Sharad Jadhav

Really nice and helping to the new learners as Anbarasu M said above.

I appreciate and request you to post more questions with easy answers.

I hope you will post.

#189 suresh

how to count no of check boxes are checked or unchecked

#190 Ajay Lanjewar

This is very good article for beginners.

#191 Ajay Lanjewar

This is very good article for beginners. Thank you so much.

Regards,
Ajay

#192 Darren Broklyn

Q

Write your gherkin format and run it to create your Step definition. How do you know your test has passed?

#193 Yogesh

Thanks for sharing your knowledge.
In the types of framework I could not see Page object model which is used extensively across the market, please include materials regarding POM framework.

#194 Pouli

Thanks very much!believe me answered all my interview question from this blog as far as selenium concerened!

Keep it up admin!

#195 Anuradha

Very helpful.

#196 Manju

Good one!!!!!!!

#197 Sandy

Good Article liked it…

#198 Anoop

How to handle versions of tests in Selenium?

#199 Sachin Chorghe

This is really helpful for beginners.Thank you for sharing knowledge.

#200 K Ravi

Hello Sir,
One clarification testers are required for big companies or small companies?
Any need of testers in a company,if if how for…..what is our preference
Why all are asking experience and offers low salary.
Please give ans.
Thank you

#201 Mukesh Singh Rajput

Awesome!!
This is a great post. good for getting a quick revision in detail.

#202 Rumpa

Awesome post.. Thank you

#203 mahendra

please any one explaining frameworks and how to implement framework,jar files and testng files in project

please explaining

thanking you..

#204 Santosh Kumar

There is one correction in a part of Q.No. 25. It says that “navigate().to() – This command lets the user to launch a new web browser window and navigate to the specified URL.”

Correction: navigate().to() doesn’t always open a new window. If browser is already opened, it just navigate to the specified URL in the same open window.

#205 eaccmk

Nicely articulated in the form of QA.
Best part is Code Snippet with comments, thnx !

#206 Bhaskar

I like this article, very good

#207 Lalitha

Thank you, it was neat and clear

#208 Shaifali

how to find x-path of a child element if webpage dont have any id,name or any other locator?

#209 Udhay

good collection.

#210 arjun

hi sir

how to handle captcha and barcode please reply sir

#211 Nikhil

Very informative article and really helpful for beginners
THANK YOU

#212 Rubal

selenium 200 plz help me how to use aaa

#213 Sharmila Kulkarni

Awesome Article, thankyou!

#214 pritee banerjee

please please answer to this question …i need this to night bcoz i hv interview tomorrow..
Qus: how reporting done in automation??
Qus2:what are the build in tools use in automation??

#215 Khanh Do

Thanks for your article. It helps me a lot.

#216 rakesh

At Q #22) How can you find if an element in displayed on the screen?

Is the below method explanation is typo error or what?
isSelected():
boolean buttonSelected = driver.findElement(By.id(“gbqfba”)).isDisplayed();

I guess it should be :
boolean buttonSelected = driver.findElement(By.id(“gbqfba”)).isSelected();

Please correct me if I am wrong.

#217 sreenivas

Really very good information, thank you so much.. :)

#218 khosruz zaman

I am not Clear about FrameWork Question?

#219 priyanka

how to automate scroll down using selenium web driver?

#220 Rohit Sinha Shrivastava

I started learning selenium some 1 months back and believe me whatever you have posted have helped me lot to acquire proficiency in selenium.
I think your post is phenomenal for interview purpose and its also a synopsis of selenium overall.
Keep it up and kudos to you for your efforts.
Cheers Shruti!!!..:)

#221 Aditya Barbadikar

Excellent Article

#222 Priya Shanthi Jandla

Good Article. Very informative

#223 R.ashok

How do you handle the Frameworks?.
explain the Hybrid Architecture?

#224 Malika

Great collection of questions and answers. Thanks for putting them all together.
Thanks again for your time and hard work.

#225 Manmohan Singh

Your post is mostly useless !

The testng vs junit question does not tell us how the two are different. Instead there are a lot of unrelated points like open source in that answer. Looks like you get paid by the word.

#226 lakshmi narayana

guys i have a question that i got from interview . The interviewer was asking me
li a
li a
a
a
he gave me Dom Stracture and asked me what is the xpath for value a ?
i was totally confused and i inspected the elements and given value of xpath to a as = //@magicdom#@!/*&/
can any one solve my problem

#227 STTA

Interviewer can ask below given question on core java points. Prepare these thing before interview
1. Interface
2. Inheritance
3. String
4. Collection framework

#228 Swapnil

Which installation required for selenium web driver using C# In visual studio, Please give me the detail list of installations step by step.

#229 Punith TS

Thanks a lot buddy.. Great help for those who just want to quickly look up some questions..

#230 Nagendra

Nice easy to remberred thnq

#231 Rishikesh

Excellent, Really awesome article!

#232 Nasara

Very simple questions..normally the standard of questions in interview is greater t han the one mentioned here

#233 vikas reddy

good explanation…good job

#234 Kanna

awesome article

#235 Vishwajeet

Salute!

#236 Bibhishan

What a great article it’s!! terrific!!

#237 Premkumar

Write a script to check the username field which should only accept 4 digit or charecter

#238 Sabrine

Perfect! thank you

#239 Madhu

Thanks..very useful..

#240 divs

Useful article. Got interest in learning selenium on my own after reading this

#241 Raman

Thanks! Very Helpful.

#242 Ambika

Very good information.

I want to know is get() in webdriver is ThreadSafe and Synchronised.

#243 Pradeep Rout

Really…..very needful….

#244 Anand Joshi

Very nice and organised article. Thank you so much.

#245 Manmohan

Windows pop up can be handle using windows Handler

#246 nasarath

please can u give me a answar
i was went a interview last 5 days back that time intervier asked
can u tell me any 3 real time exceptions in selenium

#247 dhruva

about popups interview questions
and different frame works where it will be used and type of questions in read excel and write excel questions

#248 vamsi

#246.nasarath
1.No such Element Exception
2.Element is Not Clickable
3.Stale Element Exception

#249 vimal krishna

very good post, this is very useful for us.

#250 Snehal

Q #3) Why should Selenium be selected as a test tool?
we should also add the customer demand is web based software interface which is also a trend in software industry now days. And selenium supports web based applications.

#251 Rajkumar

question no 22 is 2nd statement should have isSelected instead of IsDisplayed

#252 Renuka

Thank you so muchh….It is very helpfull for me..:-)

#253 Simy

Great! Very useful.
Thank you.

#254 Aneesh

Fantastic. Very useful and we’ll explained. Thank you so much.

#255 Jones

Hello Sir,
As a fresher these interview questions helps me a lot to know about the subject and also gave me more confident to attend my interview perfectly.

#256 Rajendra Samal

Please correct the ans of Q #22) How can you find if an element in displayed on the screen?

isDisplayed()
isSelected()
isEnabled()

Syntax error please use isSelected() in the place of isDisplayed() :
isSelected():
boolean buttonSelected = driver.findElement(By.id(“gbqfba”)).isSelected();

#257 Madhav Yadav

Awesome post nice.

#258 Manasi Pradhan

I am new to selenium n i have comleted my course please help me in frame work concept with real time code.

#259 Manasi Pradhan

I am new to selenium n i have comleted my course please help me in frame work concept with real time code.

#260 Sathish

Every one clearly understand

#261 vikash kumar

what is cross browser Testing? wright code for that

#262 Vladimir Rybalko

Thanks a mil for your time, great tutorial!

#263 Raj

Realy useful and thaks……

#264 Selva

Thanks. We need topics about TestNG

#265 Ritesh Sulakhe

Very good article on Automation.thankss!

#266 santhi

Great Information..thank you

#267 Amjath Khan

Good Info..Thx

#268 vinay kumar

as we can work with the parameters instead of writing the script in the tool. So can you please assest me on this issue

#269 swati

Good Post

#270 sam

In this tutorial i am getting good knowledge
thanks you for share

#271 Suresh Babu

Very good and useful information on various concepts.
Please do the corrections as per the suggestions related to question 48 and others (if appropriate). The answer should be “….therefore applications on the mobile browsers cannot be tested.” Thanks.

#272 Deenavali.ss

it is very useful for a fresher student…
u done vary good work
awsome Q&A

#273 indraw

you explained in very easy language..

#274 Akshatha shetty

good and understandable documents..

Thank you..

#275 keerthika

Excellent. It is very good for beginners.

#276 Anooha

Really helpful

#277 sun

package one;

import java.util.Iterator;
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;

public class Wells {

public static void main(String[] args) {

//1 verify credit cards present in Banking if not continue

//locate banking block

System.setProperty(“webdriver.chrome.driver”, “chromedriver.exe”);
WebDriver driver = new ChromeDriver();
driver.get(“https://www.wellsfargo.com/sitemap”);

String searchingText = “Credit Cards”;
boolean flag=false;
WebElement creditCardLink;

// 1. Finding Credit cards in Banking

List banking =driver.findElements(By.xpath(“//*[@id=’contentBody’]/div[1]//a”));

WebElement CreditCardBanking = searchLink(banking,searchingText);
if (CreditCardBanking != null){
System.out.println(“Credit Cards is present “);
}

flag = false;

// 2. Verify Credit card is present in or not in the Loans and Credit

List LoadnandCredit = driver.findElements(By.xpath(“//*[@id=’contentBody’]/div[2]//a”));

WebElement creditCardLoan = searchLink(LoadnandCredit ,searchingText);

Assert.assertNotNull(creditCardLoan);

System.out.println(“tested”);

// 3 click on credit card link in Loans and credit

creditCardLoan.click();

// 4 Get URL of the Browser

System.out.println(driver.getCurrentUrl());

// 5 verify Title of the window is “Credit Cards – Apply for a Credit Card Online – Wells Fargo”

Assert.assertEquals(driver.getTitle(),”Credit Cards – Apply for a Credit Card Online – Wells Fargo”);;

driver.close();
}

public static WebElement searchLink(List locator, String searchingText) {
boolean flag = true;
;
WebElement link,ccLink=null;
String linkText;

Iterator itr = locator.iterator();

while(itr.hasNext()){
link = itr.next();
linkText = link.getText();
if (linkText.equals(searchingText)){
flag = true ;
ccLink = link;
}
}

return ccLink;
}

}

#278 satheesh

excelent….

#279 SATISH

Nice article add PDF file for download

#280 achini mahawaththa

Very useful.Really appreciate

#281 Akash Jadhav

This article helps me a lot. Thank you

#282 Sharad Lakade

Very useful information.

Thanks and much appreciated.

Could you please reply back on below comment #.
#7 Nikesh
Ans to Q#49 is wrong.

Thanks.

#283 dev

Thank you… It is very easy to understand and face interview confidenlty.

#284 Igor

isSelected():
boolean buttonSelected = driver.findElement(By.id(“gbqfba”)).*isDisplayed*();

should be
isSelected():
boolean buttonSelected = driver.findElement(By.id(“gbqfba”)).isSelected();

#285 Sapna

Very Nice Collection………..

#286 raghavendra sagar

given above information is fabulous

#287 iragond

selenium is a suite of tool or selenium is a suite of APIs

Leave a Comment