• 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 accept Alert in Protractor?

By using accept() method of Alerts class, we accept Alerts in Protractor.

Note: We have to switch the control to the alert using switchTo().alert() before accepting the alert.


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:


element(by.xpath("text box xpath").getAttribute("value")).then(function(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.


element.getText().then(function (text)

How do you verify tooltip text using Protractor?

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

Subscribe to