Failed: stale element reference: element is not attached to the page document (Session info: chrome=54.0.2840.71) (Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30) #179
I have tried almost everything. Tried making browser wait, sleep, isDisplayed without wait function. But just can't get this to be working consistently. I have tried different versions of Chrome as well. Nothing seems to be working. I'd really appreciate any help.
There are two pages in my application where my code fails. But it's very random, sometimes it fails, sometimes it doesn't. Attaching my Code.
I have tried almost everything. Tried making browser wait, sleep, isDisplayed without wait function. But just can't get this to be working consistently. I have tried different versions of Chrome as well. Nothing seems to be working. I'd really appreciate any help.
There are two pages in my application where my code fails. But it's very random, sometimes it fails, sometimes it doesn't. Attaching my Code.
Method 1: browser.driver.wait(function(){ return element(by.id("dobDate")).isDisplayed(); }); element(by.id("dobDate")).sendKeys('mm/dd/yyyy');
Method 2: element(by.id("dobDate")).isDisplayed().then(function(isVisible){ if(isVisible){ element(by.id("dobDate")).sendKeys('mm/dd/yyyy'); } });