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

stalenessOf with browser.wait throws StaleElementReferenceError #3622

Closed
kacpe-r opened this issue Oct 6, 2016 · 1 comment
Closed

stalenessOf with browser.wait throws StaleElementReferenceError #3622

kacpe-r opened this issue Oct 6, 2016 · 1 comment

Comments

@kacpe-r
Copy link

kacpe-r commented Oct 6, 2016

Hi there. I've just discovered an unexpected behaviour.
Here you've sample of my code:

var elementToFind = this.pages.assignments.getAssignmentRowByAssignee(assignedTo);
browser.wait(protractor.ExpectedConditions.stalenessOf(elementToFind), 5000);
return this.expect(elementToFind.isPresent()).to.eventually.equal(false);

I'm recieving such output:

   Message:
     StaleElementReferenceError: stale element reference: element is not attached to the page document
       (Session info: chrome=53.0.2785.143)
       (Driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux 4.7.3-100.fc23.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
     Command duration or timeout: 38 milliseconds
     For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html
     Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
     System info: host: 'localhost.localdomain', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.7.3-100.fc23.x86_64', java.version: '1.8.0_102'
     Driver info: org.openqa.selenium.chrome.ChromeDriver
     Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a), userDataDir=/tmp/.com.google.Chrome.fZQcQD}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=53.0.2785.143, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
     Session ID: 91f2c138da9b27c58f2264a5f39b12f7
         at WebDriverError (/var/www/protractor-poc/node_modules/selenium-webdriver/error.js:26:26)
         at StaleElementReferenceError (/var/www/protractor-poc/node_modules/selenium-webdriver/error.js:313:26)
         at Object.checkLegacyResponse (/var/www/protractor-poc/node_modules/selenium-webdriver/error.js:580:13)
         at /var/www/protractor-poc/node_modules/selenium-webdriver/lib/webdriver.js:360:15
         at Promise.invokeCallback_ (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:1329:14)
         at TaskQueue.execute_ (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:2790:14)
         at TaskQueue.executeNext_ (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:2773:21)
         at /var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:2652:27
         at /var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:639:7
         at process._tickCallback (internal/process/next_tick.js:103:7)
     From: Task: WebDriver.call(function)
         at WebDriver.call (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/webdriver.js:610:17)
         at WebDriver.findElementsInternal_ (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/webdriver.js:915:17)
         at WebDriver.findElements (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/webdriver.js:892:19)
         at Object.findElementsOverride (/var/www/protractor-poc/node_modules/protractor/built/locators.js:121:31)
         at /var/www/protractor-poc/node_modules/protractor/built/element.js:152:37
         at Array.map (native)
         at /var/www/protractor-poc/node_modules/protractor/built/element.js:150:65
         at Promise.invokeCallback_ (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:1329:14)
         at TaskQueue.execute_ (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:2790:14)
         at TaskQueue.executeNext_ (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:2773:21)
         at /var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:2652:27
         at /var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:639:7
         at process._tickCallback (internal/process/next_tick.js:103:7)
     Error
         at ElementArrayFinder.applyAction_ (/var/www/protractor-poc/node_modules/protractor/built/element.js:371:27)
         at ElementArrayFinder._this.(anonymous function) [as getText] (/var/www/protractor-poc/node_modules/protractor/built/element.js:83:30)
         at ElementFinder._this.(anonymous function) [as getText] (/var/www/protractor-poc/node_modules/protractor/built/element.js:685:22)
         at /var/www/protractor-poc/pages/assignments.js:41:69
         at /var/www/protractor-poc/node_modules/protractor/built/element.js:204:28
         at Array.map (native)
         at /var/www/protractor-poc/node_modules/protractor/built/element.js:202:46
         at Promise.invokeCallback_ (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:1329:14)
         at TaskQueue.execute_ (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:2790:14)
         at TaskQueue.executeNext_ (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:2773:21)
         at /var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:2652:27
         at /var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:639:7
         at process._tickCallback (internal/process/next_tick.js:103:7)
     From: Task: <anonymous>
         at Timeout.pollCondition [as _onTimeout] (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:2236:16)
         at tryOnTimeout (timers.js:224:11)
         at Timer.listOnTimeout (timers.js:198:5)
     From: Task: <anonymous wait>
         at ControlFlow.wait (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/promise.js:2229:17)
         at WebDriver.wait (/var/www/protractor-poc/node_modules/selenium-webdriver/lib/webdriver.js:688:29)
         at Protractor.to.(anonymous function) [as wait] (/var/www/protractor-poc/node_modules/protractor/built/protractor.js:55:29)
         at [object Object].<anonymous> (/var/www/protractor-poc/e2e/steps/assignmentsSteps.js:33:21)
         at _combinedTickCallback (internal/process/next_tick.js:67:7)
         at process._tickCallback (internal/process/next_tick.js:98:9)

Right now I'm using a dirty workaround (browser.sleep(3500); instead of browser.wait(...);), but it's definitely not what I am looking for.
Currently I'm using node 5.10.1 and Protractor 3.3.0 (update to 4.x.x is blocked by #3608), so I was not able to verify is it working with Protractor 4.x.x.

@NickTomlin
Copy link
Contributor

NickTomlin commented Oct 6, 2016

Hi there!

Because this could be any number of things connected to your implementation / application, your question is better suited for StackOverflow or Gitter. Please ask a question there with the 'protractor' tag or post in the Gitter Channel to get help.

If this turns out to e an issue with protractor can you please provide a small reproducible example and follow the issue template?

From the the getting help section of the README:

Please ask usage and debugging questions on StackOverflow (use the "protractor" tag) or in the Angular discussion group. (Please do not ask support questions here on Github.)

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants