I have been starting with the AngularJS Application testing . I need to give multiple Answer to an Questionnaire that come after selecting some Symptoms. Questions are having text or radio button as input fields their are question with 2 radio buttons or 3 radio buttons
//First method Code Giving the same error
// Questionnaire
obj.questionnaire_row.each(function(question) {
question.element(by.model("data.answer")).click().sendKeys(d.Easycirmmail.answers);
});
//Second method for answering the questions
function questions(index) {
obj.questionnaire_row.get(index).element(by.css("span.ng-binding")).getText().then(function(value) {
console.log(value);
});
obj.questionnaire_row.get(index).element(by.model("data.answer")).click().sendKeys(d.Easycirmmail.answers);
}
obj.questionnaire_row.count().then(function(qcount) {
console.log("Question " + qcount);
for (var i = 0; i <= qcount; i++) {
console.log(i);
questions(i);
if (i == qcount - 1) {
break;
}
}
});
These are the question asked in the ng-repeater
//this is the Console output:
Started
Count 14
Master 2
Master 1
Master 11
Master 0
Master 4
Count 15
Symptoms 7
Symptoms 1
Symptoms 6
Symptoms 1
Symptoms 14
Symptoms 3
Symptoms 7
Symptoms 8
Symptoms 12
Symptoms 3
Symptoms 8
Symptoms 11
Symptoms 3
Symptoms 10
Symptoms 10
Question 45
0
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
Q) How long has it been since the pain started?
Q) Did he suffer a traumatism?
[10:55:48] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:49] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Did the patient have alcoholic drinks?
[10:55:49] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:49] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Did he stay too long in the sun or in a very hot place?
[10:55:49] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:49] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Did the patient have any sexual intercourse?
[10:55:50] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:50] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Did he suffer from it in the past?
[10:55:50] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:50] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Is there nausea or vomit?
[10:55:50] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:50] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Is he shivering?
[10:55:50] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:51] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Are there spots, blisters or other lesions on the genitals?
[10:55:51] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:51] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Is there any penis secretion?
[10:55:51] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:51] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Is there any swelling of the glands or pain in the groins region?
[10:55:52] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:52] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Are the internal organs suspected of having been damaged?
[10:55:53] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:53] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Describe the traumatism: bruise, contusion, abrasion, excoriation, superficial wound, deep penetrating wound
Q) Is the patient constipated
[10:55:54] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:54] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Does he have diarrhoea?
[10:55:54] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:54] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Is the urine red?
[10:55:54] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:55] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Is there any blood in the urine?
[10:55:55] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:55] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Does the patient have any trouble passing water?
[10:55:55] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:55] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Is any blood coming from the patient’s mouth?
[10:55:56] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:56] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Was there a loss of consciousness or a feeling of fainting?
[10:55:56] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:56] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Does the patient have acclereted heartbeats and cold perspiration?
[10:55:56] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:56] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Does he have a feeling of nausea or vomit?
[10:55:56] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:57] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Has he got breathing difficulties, a lack of air?
[10:55:57] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:57] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
Q) Take a picture
Q) Are the faeces black (like coffee grounds)?
[10:55:57] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
[10:55:58] W/element - more than one element found for locator by.model("data.answer") - the first result will be used
F
//And the error is as follows:
Failures:
1) Easy Cirm Testing 4.Actions Easy Cirm Mail
Message:
Failed: No element found using locator: By(css selector, span.ng-binding)
Stack:
NoSuchElementError: No element found using locator: By(css selector, span.ng-binding)
at elementArrayFinder.getWebElements.then (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\built\element.js:814:27)
at ManagedPromise.invokeCallback_ (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1376:14)
at TaskQueue.execute_ (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:3084:14)
at TaskQueue.executeNext_ (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:3067:27)
at asyncRun (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2927:27)
at C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:668:7
at process._tickCallback (internal/process/next_tick.js:68:7)Error
at ElementArrayFinder.applyAction_ (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\built\element.js:459:27)
at ElementArrayFinder.(anonymous function).args [as getText] (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\built\element.js:91:29)
at ElementFinder.(anonymous function).args [as getText] (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\built\element.js:831:22)
at questions (C:\Users\3 Cube\Easy-Cirm-Automation\ListCrewPage.js:257:93)
at C:\Users\3 Cube\Easy-Cirm-Automation\ListCrewPage.js:266:29
at ManagedPromise.invokeCallback_ (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1376:14)
at TaskQueue.execute_ (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:3084:14)
at TaskQueue.executeNext_ (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:3067:27)
at asyncRun (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2927:27)
at C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:668:7
From: Task: Run it("4.Actions Easy Cirm Mail") in control flow
at UserContext.<anonymous> (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:94:19)
at C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:64:48
at ControlFlow.emit (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\events.js:62:21)
at ControlFlow.shutdown_ (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2674:10)
at shutdownTask_.MicroTask (C:\Users\3 Cube\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2599:53)
From asynchronous test:
Error
at Suite.<anonymous> (C:\Users\3 Cube\Easy-Cirm-Automation\ListCrewPage.js:150:5)
at Object.<anonymous> (C:\Users\3 Cube\Easy-Cirm-Automation\ListCrewPage.js:132:1)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)