• 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

How to get text from a textbox in Protractor?

By using getAttribute method by passing argument as value. getAttribute() method returns a promise which contains String:

Example

element(by.xpath("text box xpath").getAttribute("value")).then(function(textValue)
{
    console.log(textValue)
});

Why getText() method returns Object instead of String in Protractor?

When using Java, getText() method returns the corresponding text from the element. However in Protractor, getText() method returns Object something like [objectObject].

In Protractor, the getText() method returns a Promise. We need to resolve this in order to get the text.

Syntax:

element.getText().then(function (text)
{ 
    console.log(text); 
});

How do you verify tooltip text using Protractor?

We can verify tooltip text using protractor by fetching the value of ‘title’ attribute.

element(by.id("some")).getAttribute("title").then(function(tooltip)
{
    console.log(tooltip);
}

Are inheritance and overriding concept applicable for the constructor in Java?

In java, inheritance and the overriding concept are not applicable for constructors. In other words, if we inherit a class then the constructor of the parent class is not available in child class.

Constructor Overriding is never possible in Java. This is because, Constructor looks like a method but name should be as class name and no return value. Overriding means what we have declared in Super class, that exactly we have to declare in Sub class it is called Overriding.

What is the difference between GET and NAVIGATE in Protractor?

Get: Get method is used to navigate to the given destination.

browser.get("https://www.programsbuzz.com");

Navigate: Navigate method is used to navigate to the given destination.

browser.navigate()

if we want to load a previous page or next page in a browser we can use back and forward.

browser.navigate().back();
browser.navigate().forward();
Subscribe to