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

Commit 95dd3ca

Browse files
viktorpergjokaqiyigg
authored andcommitted
doc(tutorial): added example for element.getAttribute('value') to read text from an input (#4566)
* added example for element.getAttribute('value') in tutorial
1 parent 1aaf1c1 commit 95dd3ca

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/tutorial.md

+7
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,18 @@ describe('Protractor Demo App', function() {
144144
// Fill this in.
145145
expect(latestResult.getText()).toEqual('10');
146146
});
147+
148+
it('should read the value from an input', function() {
149+
firstNumber.sendKeys(1);
150+
expect(firstNumber.getAttribute('value')).toEqual('1');
151+
});
147152
});
148153
```
149154

150155
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.
151156

157+
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.
158+
152159
Step 3 - changing the configuration
153160
-----------------------------------
154161

0 commit comments

Comments
 (0)