An Error for Selenium - Chrome vs Firefox: stale element reference

I faced an selenium error like "stale element reference" when I changed Capybara's driver to Chrome which was not occurred in webkit and firefox. This error occurs when referencing an element which is not in DOM. Chrome gives this but it doesn't appear when I use Firefox because the dynamic object is appear after the Javascript execution finishes which means that Chrome doesn't wait until javascript execution ends

You can escape this error by checking your scenario if there is an element requiring in the DOM which is destructed by an action in the scenario or if you have loop and the DOM is updating for each iteration the object you look for changes. However in my case, scenario is passing with FF but not Chrome which because the Chrome is passing the next step as soon as Javascript execution starts. 

I just call waiting function and then assign the variable. Finally scenario is passing for both browsers. 
    
stale element reference: element is not attached to the page document
        (Session info: chrome=43.0.2357.65)
        (Driver info: chromedriver=2.10.267517,platform=Mac OS X 10.10.3 x86_64) (Selenium::WebDriver::Error::StaleElementReferenceError)


Comments

Popular posts from this blog

Selenium Error "Element is not currently interactable and may not be manipulated"

Change Default Timeout and Wait Time of Capybara

Performance Testing on CI: Locust is running on Jenkins

Selenium Chromedriver Error Message: u'unknown error: unable to discover open pages

Getting the text of elements in Espresso