I am facing a major issue right now. The stale element reference problem occurs 7 out of 10 times in my application. Once the operation is completed, a confirmation dialog appears momentarily. I need to retrieve the text from this confirmation dialog.
var confDial= element(by.id('dialog'));
browser.wait(EC.visibilityOf(confDial), FIFTY_SECONDS);
confDial.getText().then(function(text1){
expect(text1).toBe(TextExpected);
});
My approach involves waiting for the dialog to be visible after the operation and then extracting the text using getText(). However, it fails at the browser.wait() step with the following error:
Failed: stale element reference: element is not attached to the page document 09:14:52 (Session info: chrome=52.0.2743.116) 09:14:52 (Driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux 4.2.0-42-generic x86_64) (WARNING: The server did not provide any stacktrace information) 09:14:52 Command duration or timeout: 76 milliseconds 09:14:52 For documentation on this error, please visit:
Could anyone advise me on how to resolve this issue?
Appreciate your help in advance.