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

StaleElementReferenceError handled poorly in Chrome Accessibility Plugin #2331

Closed
JLLeitschuh opened this issue Jul 10, 2015 · 0 comments
Closed

Comments

@JLLeitschuh
Copy link
Contributor

If the dom changes as the Chrome Accessibility Plugin generates its results then you can get StaleElementReferenceError without any context to tell you where this error came from.

I have spent the past 4 hours debugging this problem and finally have a working solution that at least gives you more useful information than the silent, context lacking failure that is currently returned.

The failure that I was experiencing happened here: https://github.com/angular/protractor/blob/master/plugins/accessibility/index.js#L176

A better way to handle this would be to pass the error back into the failure reporter.

elementPromises.push(
  elem.getOuterHtml().then(function(text) {
    return {
      code: result.rule.code,
      list: trimText(text)
    };
  }, function(reason){
    return {
      code: result.rule.code,
      list: reason
    };
  })
JLLeitschuh added a commit to JLLeitschuh/protractor that referenced this issue Jul 10, 2015
If your tests fail because of StaleElementReferenceError then there is no context about where this is coming from.
By having the failure be handled inside of the plugin then grunt can fail gracefully.
Additionally, this provides context about where the error originated from.

Fixes angular#2331
@sjelin sjelin closed this as completed in 4c9886b Jul 13, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants