I enter the value with this code:

var FirstName = element(by.name('firstName'));

The code updates the profile of the user correctly.

Now I am trying to read that value or expecting that value in Protractor Visual Studio Code with this code:


I have also tried this:


but it returns a null value

How do I read the value of the First Name field?

The app code is below. r

  • 1
    Please, reformat your question so it is clear what is the problem. meta.stackexchange.com/help/how-to-ask Aug 9, 2019 at 10:42
  • Try to formulate like this: 1- Context: What type of application you are dealing with. 2 - Goal: What do you want to accomplish. 3 - What you have tried. 4 - The problem that you experienced with your attempt. Aug 9, 2019 at 11:03

1 Answer 1


Protractors getAttribute('firstName') gets the value of the attribute firstName, not the value of the input. Your example element does not have an attribute "firstName". It has attributes id, pattern, name, placeholder, aria-*, etc..

I think you want to use the (in your case hidden) attribute 'value' instead:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.