I am trying to do a simple Protractor test on different browsers and I am encountering that it is failing on IE, but not on Chrome.
I am testing the angularjs application on http://juliemr.github.io/protractor-demo/ which is a simple calculator app.
The test consists on the following code:
describe('Protractor Demo App', function() {
it('should add 2 numbers', function() {
var i,j;
var w=10000;
var t=100;
i=Math.floor((Math.random() * t) + 1);
j=Math.floor((Math.random() * t) + 1);
browser.sleep(w);
browser.get('http://juliemr.github.io/protractor-demo/');
browser.waitForAngular();
element(by.model('first')).sendKeys(i);
element(by.model('second')).sendKeys(j);
element(by.id('gobutton')).click();
console.log('Sent: ' + i.toString() + ' + ' + j.toString());
var x = element.all(by.repeater('result in memory').column('value')).get(0).getText();
expect(x).toEqual((i+j).toString());
And my config file is:
// conf.js
exports.config = {
capabilities: {
'browserName': 'internet explorer',
'platform': 'ANY',
'version': '11',
'nativeEvents': false,
'unexpectedAlertBehaviour': 'accept',
'ignoreProtectedModeSettings': true,
'enablePersistentHover': true,
'disable-popup-blocking': true
},
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js']
}
When I set this last one for Chrome, (ie, commenting the capabilities part), the test runs as a charm and test is OK. I see the chrome window popping up, script puts numbers in, clicks button, result appears, and window closes.
When I set for IE (uncommenting the capabilities part) and launch the script, an IE window pops up with the text "This is the initial start page for the WebDriver server." and stays there for a while. Afterwards I see the script putting numbers in, and it closes straight away, giving a failed test on the log, with the message:
Message:
Failed: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator by.repeater("result in memory").column("value")
Stack:
NoSuchElementError: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator by.repeater("result in memory").column("value")
It seems like the "Go" button is not being clicked, but I do not understand why. Can anyone help me understand what is going on?
Thank you!