• Slider Banner

    The Programming World

    Learn about top programming languages, tools and frameworks.

    Read more
  • Slider Banner

    Certification MCQ

    Practice for certification from 1000+ multiple choice questions.

    Read more
  • Slider Banner

    Prepare for Technical Interview

    Over 1 Million+ interview questions for different technical profiles.

    Read more

Write a Selenium code to wait for a particular element to be visible on a page.

We can write a code such that we specify the XPath of the web element that needs to be visible on the page and then ask the WebDriver to wait for a specified time. Look at the sample piece of code below:

WebDriverWait wait = new WebDriverWait(driver, 20);
Element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(""));


How do you achieve synchronization in WebDriver?

You can achieve synchronization using waits in Selenium. There are basically 3 types of wait statements: Implicit Wait, Explicit Wait and Fluent Wait.

Implicit wait: instructs the WebDriver to wait for some time by polling the DOM. Once you have declared implicit wait, it will be available for the entire life of the WebDriver instance. By default, the value will be 0. If you set a longer default, then the behavior will poll the DOM on a periodic basis depending on the browser/ driver implementation.

What is Page Factory?

Page Factory gives an optimised way to implement Page Object Model. When we say it is optimised, it refers to the fact that the memory utilisation is very good and also the implementation is done in an object oriented manner.

Page Factory is used to initialise the elements of the Page Object or instantiate the Page Objects itself. Annotations for elements can also be created (and recommended) as the describing properties may not always be descriptive enough to differentiate one object from the other.

How can you redirect browsing from a browser through some proxy?

Selenium provides a PROXY class to redirect browsing from a proxy. Look at the example below:

String PROXY = "";
org.openqa.selenium.Proxy proxy = new.org.openqa.selenium.Proxy();

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver = new FirefoxDriver(cap);


Why and how will you use an Excel Sheet in your Selenium Automation project?

The reason we use Excel sheets is because it can be used as data source for tests. An excel sheet can also be used to store the data set while performing DataDriven Testing. These are the two main reasons for using Excel sheets.

When you use the excel sheet as data source, you can store the following:

Application URL for all environments: You can specify the URL of the environment in which you want to do the testing like: development environment or testing environment or QA environment or staging environment or production/ pre-production environment.

What is exception test in Selenium?

TestNG @Test Annotation provides an attribute "expectedExceptions" allowing the user to specify the type of exceptions that are expected to be thrown by a test method during execution.

An exception test is an exception that you expect will be thrown inside a test class. If you have written a test case in such way that it should throw an exception, then you can use the @Test annotation and specify which exception you will be expecting by mentioning it in the parameters. Take a look at the example below: @Test(expectedException=NoSuchElementException.class)

What are different types of waits in Selenium with Python ?

Selenium WebDriver provide 2 types of waits:

1. Implicit Wait

2. Explicit Wait

Implicit Wait: An implicit wait tells WebDriver to poll the DOM for a certain amount of time when trying to find any element (or elements) not immediately available. The default setting is 0. Once set, the implicit wait is set for the life of the WebDriver object. Example:

Subscribe to