-
Notifications
You must be signed in to change notification settings - Fork 0
/
DropDowns.js
66 lines (47 loc) · 1.49 KB
/
DropDowns.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
describe('Chain locators demo', function() {
function calc(a, b, c) {
element(by.model("first")).sendKeys(a);
element(by.model("second")).sendKeys(b);
element.all(by.tagName("option")).each(function(item) {
item.getAttribute("value").then(function(values) {
if (values == c) {
item.click();
}
})
});
element(by.id("gobutton")).click();
}
// functions should be inside describe
it('open angular js website', function() {
browser.get('http://juliemr.github.io/protractor-demo/');
calc(3, 5, "ADDITION");
// calc(3, 5, "DIVISION");
// calc(3, 5, "MULTIPLICATION");
// calc(3, 5, "SUBTRACTION");
// calc(3, 5, "MODULO");
//
element.all(by.repeater("result in memory")).each(
function(item) {
item.element(by.css("td:nth-child(3)")).getText().then(
function(text) {
console.log("result is: " + text);
});
});
});
//below chain doesnot work
it('chain for oprationse', function() {
browser.get('http://juliemr.github.io/protractor-demo/');
element(by.model("first")).sendKeys(5);
element(by.model("second")).sendKeys(7);
//BELOW LINE SHOULD CHANGE THE OPERATION
element(by.model("operator")).element(by.css("option:nth-child(3)")).click();
element(by.id("gobutton")).click();
element.all(by.repeater("result in memory")).each(
function(item) {
item.element(by.css("td:nth-child(3)")).getText().then(
function(text) {
console.log("result is: " + text);
});
});
});
});