• 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

What is the difference between getWindowHandles() and getWindowHandle() in Selenium ?

getWindowHandles(): It is used to get the address of all open browsers, and its return data type is Set<String>.

getWindowHandle(): It is used to get the address of the current browser where the control is, and its return type is a string data type.

How will you use Selenium to upload a file?

If the file is on the same machine or in a mapped network drive, it is really straightforward: We need to type the ‘path’ of the file in the FileUpload control. For example:

//Locate file selection input field 
WebElement uploadElement = driver.findElement(By.id("l"));

// enter the file path onto the file-selection input field
uploadElement.sendKeys("C:\\myfile.txt");

// click the "UploadFile" button
 driver.findElement(By.name("send")).click();

 

What are data-driven framework and keyword-driven framework?

Data Driven Framework: A data-driven framework in Selenium is an approach of separating a 'dataset' from the actual 'test case' (code). This framework is completely dependent on the input test data. The test data is inserted from external sources such as an excel file, CSV file, or any database.

It also allows us to easily control how much data needs to be tested. We can easily increase the number of test parameters by adding more username and password fields to the excel file (or other sources).

What are the different types of annotations used in Selenium? Explain the JUnit Annotation linked with Selenium.

In Java, a special form of syntactic metadata can be added to Java source code, which is known as Annotations. Variables, parameters, packages, methods, and classes are annotated. Some of the JUnit Annotations are:

Why Java Strings are immutable in nature?

In Java, string objects are immutable in nature which simply means once the String object is created its state cannot be modified.

Whenever you try to update the value of that object instead of updating the values of that particular object, Java creates a new string object.

Java String objects are immutable as String objects are generally cached in the String pool. Since String literals are usually shared between multiple clients, action from one client might affect the rest. It enhances security, caching, synchronization, and performance of the application.

What is constructor chaining in Java?

In Java, constructor chaining is the process of calling one constructor from another with respect to the current object. Constructor chaining is possible only through legacy where a subclass constructor is responsible for invoking the superclass' constructor first. There could be any number of classes in the constructor chain. Constructor chaining can be achieved in two ways:

Within the same class using this()
From base class using super()

Subscribe to