I am facing a challenge while running my angular e2e tests using protractor. In some cases, I have a select element inside a modal. The issue arises when the test fails to locate the select element with the following error message:
NoSuchElementError: No element found using locator: By.cssSelector("div#s2id_items”)
Interestingly, on slower machines, this works consistently, but on faster machines, it tends to fail. My assumption is that the modal might still be in the process of animating when protractor attempts to access the selector, resulting in a failure.
I made an attempt to disable animations without success by incorporating the code below within the onPrepare directive in my protractor configuration file:
var disableNgAnimate = function() {
angular.module('disableNgAnimate', []).run(['$animate', function($animate) {
$animate.enabled(false);
}]);
};
browser.addMockModule('disableNgAnimate',disableNgAnimate);
My setup includes angular 1.4.3, bootstrap 3.3.5, and protractor 2.1.0.
Thank you
Edit:
1 - I'm not utilizing explicit waits and would prefer not to, as they could significantly slow down the tests or still be susceptible to failure under certain circumstances.