samccone / drool

Automated memory leak detection and analysis
1.48k stars 53 forks source link

ElementNotVisibleError: element not visible (but which?) #12

Closed linus-amg closed 9 years ago

linus-amg commented 9 years ago
/Users/lgubenis/projects/paper/node_modules/drool/node_modules/selenium-webdriver/lib/goog/async/nexttick.js:39
  goog.global.setTimeout(function() { throw exception; }, 0);
                                            ^
ElementNotVisibleError: element not visible
  (Session info: chrome=44.0.2403.155)
  (Driver info: chromedriver=2.16.333243 (0bfa1d3575fc1044244f21ddb82bf870944ef961),platform=Mac OS X 10.10.4 x86_64)
  at new bot.Error (/Users/lgubenis/projects/paper/node_modules/drool/node_modules/selenium-webdriver/lib/atoms/error.js:108:18)
  at Object.bot.response.checkResponse (/Users/lgubenis/projects/paper/node_modules/drool/node_modules/selenium-webdriver/lib/atoms/response.js:109:9)
  at /Users/lgubenis/projects/paper/node_modules/drool/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:379:20
  at [object Object].promise.ControlFlow.runInFrame_ (/Users/lgubenis/projects/paper/node_modules/drool/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1857:20)
  at [object Object].goog.defineClass.notify (/Users/lgubenis/projects/paper/node_modules/drool/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2448:25)
  at [object Object].promise.Promise.notify_ (/Users/lgubenis/projects/paper/node_modules/drool/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:564:12)
  at Array.forEach (native)
  at [object Object].promise.Promise.notifyAll_ (/Users/lgubenis/projects/paper/node_modules/drool/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:553:15)
  at goog.async.run.processWorkQueue (/Users/lgubenis/projects/paper/node_modules/drool/node_modules/selenium-webdriver/lib/goog/async/run.js:125:21)
  at runMicrotasksCallback (node.js:337:7)
  at process._tickCallback (node.js:355:11)

From: Task: <anonymous>
  at executeInFlow (/Users/lgubenis/projects/paper/node_modules/drool/lib/index.js:7:24)
  at Object.flow (/Users/lgubenis/projects/paper/node_modules/drool/lib/index.js:37:3)
  at Object.<anonymous> (/Users/lgubenis/projects/paper/test/index.coffee:7:7)
  at Object.<anonymous> (/Users/lgubenis/projects/paper/test/index.coffee:1:1)
  at Module._compile (module.js:460:26)
linus-amg commented 9 years ago

i have 3 findElement, so i dont know which i need to fix, because i dont know which is the one which is not visible

samccone commented 9 years ago

I would start by looking at the stack

  at Object.<anonymous> (/Users/lgubenis/projects/paper/test/index.coffee:7:7)
  at Object.<anonymous> (/Users/lgubenis/projects/paper/test/index.coffee:1:1)

what is on line 1, line 7?

linus-amg commented 9 years ago

seems to be the first findElement in this case, the stack does not help much because line 7 is the drool.flow which contains the 3 findElement, line 1 requires drool

linus-amg commented 9 years ago

i commented the other 2 findElement (which kind of depend on the first one) and the error continues, so im trying to fix it now

samccone commented 9 years ago

sure ok, so when the element is async you will need to do something like this...

driver.wait(function() {
  return driver.findElement(drool.webdriver.By.css('#new-todo')).click()
  .then(function() { return true; })
  .thenCatch(function() {
     return false;
  })
}, 5000);

which will wait until the click works


:sparkles: for more reading: https://github.com/tastejs/todomvc/pull/1371 :sparkles:

linus-amg commented 9 years ago

okay, another question.. if i hide the $el of a Marionette ItemView onRender, should the findElement still find it? (its not finding it and im finding out why)

samccone commented 9 years ago

it should be able to find it, however it will not be able to interact with it since it is not visible.

linus-amg commented 9 years ago

:zap:

linus-amg commented 9 years ago

is there an easy way to access the App scope so i could trigger the request by calling it instead of triggering through a click on the element?

i would like to call App.Document.request('addPage')

linus-amg commented 9 years ago

its because the add button is hidden until you scroll near bottom of the page, i could also live with scrolling down before findElement + click, but i dont know how yet, to scroll with the driver

linus-amg commented 9 years ago

i guess its just another findElement with .scrollTo instead of .click

samccone commented 9 years ago
driver.executeScript("console.log('wow');")
linus-amg commented 9 years ago

thx :+1:

samccone commented 9 years ago

going to close, as this does not seem to be a drool question feel free to join the chat https://gitter.im/samccone/drool