Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
doc(tutorial): added example for element.getAttribute('value') to rea…
Browse files Browse the repository at this point in the history
…d text from an input (#4566)

* added example for element.getAttribute('value') in tutorial
  • Loading branch information
viktorpergjoka authored and qiyigg committed Oct 31, 2017
1 parent 1aaf1c1 commit 95dd3ca
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,18 @@ describe('Protractor Demo App', function() {
// Fill this in.
expect(latestResult.getText()).toEqual('10');
});

it('should read the value from an input', function() {
firstNumber.sendKeys(1);
expect(firstNumber.getAttribute('value')).toEqual('1');
});
});
```

Here, we've pulled the navigation out into a `beforeEach` function which is run before every `it` block. We've also stored the ElementFinders for the first and second input in nice variables that can be reused. Fill out the second test using those variables, and run the tests again to ensure they pass.

In the last assertion we read the value from the input field with `firstNumber.getAttribute('value')` and compare it with the value we have set before.

Step 3 - changing the configuration
-----------------------------------

Expand Down

0 comments on commit 95dd3ca

Please sign in to comment.