Selenium Java Interview Questions And Answers – Part 10

Selenium Java Interview Questions And Answers – Part 10

Selenium Java Interview Questions and Answers Part-10

1) Can Selenium automate Client Server applications?

No Selenium cannot automate Client Server applications but there are other tools like Winium and AutoIt which can be used
to automate desktop applications.

2) What are the limitations of Selenium WebDriver?

– It supports Web based applications only
– Limited reporting capabilities
– Handling captcha

3) Tell me about the Selenium WebDriver architecture?

WebDriver is made of following components:
– Language Bindings
– JSON Wire Protocol
– Browser Drivers
– Real Browsers

When a test script is executed with the help of WebDriver, the following tasks are performed in the background:

– An HTTP request is generated and it is delivered to the browser driver for every Selenium Command.
– The HTTP request is received by the driver through an HTTP server.
– All the steps/instructions to be executed on the browser is decided by an HTTP server.
– The HTTP server then receives the execution status and in turn sends it back to the automation scripts.

Read more about this topic: Click here

4) How to identify the web elements?

In order to identify WebElements accurately and precisely, Selenium makes use of following locators:

5) When do you go for an XPath?

Although XPath can be used as a locator for any webelement, it is particularly useful when elements are dynamically changing or
don’t have any unique properties.

6) How to execute the tests on Firefox Browser in Selenium?

WebDriver driver = new FirefoxDriver(); //Creating an object of FirefoxDriver


7) What is the difference between id and name?

id is used to identify the HTML eleemnt through the DOM and is expected to unique within the page
name correspons to the form element and identified what is posted back to server

8) How to handle dynamic web elements in Selenium?

Dynamic web elements can be handled in the following ways:
– By starting text
– containing text
– By index
– By following-sibling
– By preceding text

9) What is the default timeout of Selenium WebDriver?

Default timeout is 30 seconds

10) When do we use implicit and explicit waits in Selenium?

– The implicit wait will tell to the web driver to wait for certain amount of time before it throws a “No Such Element Exception”.
Once we set the time, web driver will wait for that time before throwing an exception.
– The explicit wait is used to tell the Web Driver to wait for certain conditions (Expected Conditions) or the maximum time exceeded
before throwing an “ElementNotVisibleException” exception.

11) How to select a date in a Calendar on a web page using Selenium?

public class DatePicker
public static void main(String[] args) throws InterruptedException
String dot="9/October/2018";
String date,month,year;
String caldt,calmonth,calyear;
* Split the String into String Array
String dateArray[]= dot.split("/");

ChromeDriver driver=new ChromeDriver();

WebElement cal;
* Select the year
while (!calyear.equals(year))
System.out.println("Displayed Year::" + calyear);

* Select the Month
while (!calmonth.equalsIgnoreCase(month))
driver.findElement(By.className("nextMonth ")).click();

* Select the Date
List<WebElement> rows,cols;
for (int i = 1; i < rows.size(); i++)
for (int j = 0; j < cols.size(); j++)
if (caldt.equals(date))


12) Can I navigate back and forth in a browser using Selenium WebDriver?

Yes. We can use Navigate method to move back and forth in a browser.



13) How to execute the Selenium scripts on different browsers?

We can use a framework like TestNg or Junit and configure them to run Selenium Scripts on multiple browsers.

14) What is the purpose of isDisplayed() function in Selenium WebDriver?

The isDisplayed method in Selenium verifies if a certain element is present and displayed.
If the element is displayed, then the value returned is true.If not, then the value returned is false.

15) What is the difference between isDisplayed() and isEnabled() functions in Selenium WebDriver?

isDisplayed() is capable to check for the presence of all kinds of web elements available.
isEnabled() is the method used to verify if the web element is enabled or disabled within the webpage.

16) Can you test flash images in Selenium?

You can also automate the flash using Selenium web driver through the Flashwebdriver object and
then call a method to operate flash object. You need to download flashwebdriver jar files

17) What is a Framework?

A framework defines a set of rules or best practices which we can follow in a systematic way to achieve the desired results.

Read more about this topic : Click here

18) How to select a third value from a drop-down field?

Select select = new Select(listFrameworks);


19) How to get columns from a table?

WebElement table = driver.findElement(By.xpath("WebTableXPath"));
List<WebElement> totalRows = table.findElements(By.tagName("tr"));
for(int i=0;i<totalRows.size-1;i++){
List<WebElement> totalColumns = totalRows[i].findElements(By.tagName("td"));


20) How many scripts are you writing and executing per a day?

It is all dependent on the automation framework and the application under test.

21) Which driver implementation will allow headless mode?

HtmlUnit driver can be used to run tests in headless mode.

22) Which reporting mechanism you have used in your Selenium projects?

We used the Maven Cucumber Reporting plugin to generate detailed html reports.

23) Why did you choose Selenium in your project, when there are so many tools?

We chose Selenium because of the following reasons:
– It is open source and free
– It is easy to learn and setup
– It is the most widely used and popular automation tool
– All the web applications in our project are compatible with Selenium
– Multi-browser and parallel testing is possible with Selenium

24) How do you make use of JSON files in Selenium Grid?

We can configure our hub and nodes using Json file in Selenium Grid.

25) How to pause a test execution for 5 seconds at a specific point ?

We can put a breakpoint on the line where we want to pause the test execution.

Next Steps:

> More interview questions and answers on Selenium Java, continue to the next post (Click on Next Post link below)

> Check complete Selenium Java interview questions and answers here (Click here)

Please leave your questions/comments/feedback below.

Happy Learning ?

About Me > Bijan Patel

Connect to me on Linked In (Click here)

On a mission to contribute to the Software Testing Community in all possible ways.


Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

For FREE Testing Tutorials & Videos

Open chat
Contact Us on Whatsapp