• Slider Banner

    Prepare for

    Technical Interview

    Over .1 Million+ Interview Questions for different profiles

    Read More
  • Slider Banner

    Join the

    Programming World

    Learn about top programming languages, tools and frameworks.

    Read More
  • Slider Banner

    Prepare with

    Certification MCQ

    Practice for certification from 1000+ multiple choice questions.

    Read More

What is browser.refresh in Protractor?

browser.refresh makes a full reload of the current page and loads mock modules before Angular. Assumes that the page being loaded uses Angular. If you need to access a page which does not have Angular on load, use the wrapped webdriver directly.

driver.navigate().refresh();

How many ways you can create an Object in Java?

There are the five ways to create the object or get the object in java:

1. By using the new operator

Test t = new Test();

2.  By using the newInstance() Method

Test t = (Test)class.forName("Test").newInstance();

3. By using the factory Method

Runtime r = Runtime.getRuntime();
DateFormat d = Dateformat.getInstance();

4. By using the clone() Method

Test t = new Test();
Test t1= (Test)t.clone();

5. Bu using the deserialization

FileInputStream fis = new FileInputStream("Vinay");
ObjectInputStream obj = new ObjectInputStream(fis);
Dog d = (Dog)obj.readObject();

Not:- There is another way to create the object in Java but this is not standard, it is applicable only for the String

String s = "Vinay";

What will be the output of below Java code?

Example Code: 

public class Test
{
    int i =10;

    public static void main(String[] args)
    {
        System.out.println(i);
    }
}

Output: Error, Cannot make a static reference to the non-static field i.

What is an ElementArrayFinder?

ElementArrayFinder is used for operations on an array of elements. The ElementArrayFinder is used to set up a chain of conditions that identify an array of elements. In particular, you can call all (locator) and filter (filterFn) to return a new ElementArrayFinder modified by the conditions, and you can call get (index) to return a single ElementFinder at position ‘index’.

Similar to JQuery, ElementArrayFinder will search all branches of the DOM to find the elements that satisfy the conditions (i.e. all, filter, get). However, an ElementArrayFinder will not actually retrieve the elements until an action is called, which means it can be set up in helper files (i.e. page objects) before the page is available, and reused as the page changes.

What is ElementFinder in Protractor?

The ElementFinder simply represents a single element of an ElementArrayFinder (and is more like a convenience object). As a result, anything that can be done with an ElementFinder, can also be done using an ElementArrayFinder.

The ElementFinder can be treated as a WebElement for most purposes, in particular, you may perform actions (i.e. click, getText) on them as you would a WebElement. Once an action is performed on an ElementFinder, the latest result from the chain can be accessed using the then method. Unlike a WebElement, an ElementFinder will wait for angular to settle before performing finds or actions.

ElementFinder can be used to build a chain of locators that is used to find an element. An ElementFinder does not actually attempt to find the element until an action is called, which means they can be set up in helper files before the page is available.
element(by.locator(“locator value”))

How we calculate Defect Leakage in Software Testing?

Assume,

CD = No. of Defects raise by customer after release
DR = No. of Defects raised by Tester before release
ID =  No. of invalid Defects from Defects raised by tester before release(Eg. Duplicate, CannotFix, error in test environment etc.)

Formula to calculate Defect Leakage:

Defect Leakage = [CD / (DR - ID)] * 100

For Example:

If after release client found 9 defects, during the test, tester reported 201 defects and from these 20 defects were invalid, Then,

Defect Leakage = [ 9 / 201 - 20] * 100 = 4.9%

What is Defect Leakage?

After the delivery of application or product or after the release, if end user or Customer find any defect by using that application then it is called defect leakage, it is also called bug leakage.

In short, defect leakage is a metric that measures the percentage of defects leaked from the current testing stage to the subsequent stage as well as proves the effectiveness of testing executed by software testers.

How to add custom locator for Protractor?

By using addLocator method. Add a locator to this instance of ProtractorBy. This locator can then be used with element(by.locatorName(args)).

Example:

// Add the custom locator.
by.addLocator('buttonTxt', function(buttonTxt, opt_parent, opt_rootSelector) {
});

What are the locators in Protractor?

Protractor supports all the element location strategies given by Selenium and it also has unique set of locators particularly to identify elements based on AngularJS attributes.

Selenium locators:

  • className
  • css
  • id
  • linkText
  • name
  • partialLinkText
  • tagName
  • xpath

Angular Specific Locators:

  • binding
  • exactBinding
  • model
  • repeater
  • exactRepeater
  • options

Other element locator’s introduced in Protractor:

  • buttonText
  • paritalButtonText
  • cssContainingText
  • deepCss
Subscribe to