goodeggs / chai-webdriver

Build more expressive integration tests with webdriver sugar for chai.js
MIT License
125 stars 28 forks source link

Error with selenium-webdriver 2.40.0 #13

Closed nicolashery closed 9 years ago

nicolashery commented 10 years ago

Upgrading to:

Gave me an error on all my tests:

 Uncaught TypeError: Invalid locator
  at Function.webdriver.Locator.checkLocator (node_modules/selenium-webdriver/lib/webdriver/locators.js:243:9)
  at webdriver.WebDriver.findElement (node_modules/selenium-webdriver/lib/webdriver/webdriver.js:693:33)
  at one (node_modules/chai-webdriver/node_modules/webdriver-sizzle/lib/webdriver_sizzle.js:15:22)
  at assertDisplayed (node_modules/chai-webdriver/lib/index.js:42:16)
  at Assertion.<anonymous> (node_modules/chai-webdriver/lib/index.js:55:16)
  at Assertion.ctx.(anonymous function) [as visible] (node_modules/chai/lib/chai/utils/addMethod.js:34:25)
  at test/e2e/login_scenarios.js:34:45

Downgrading to:

Works fine.

I'm not sure what happened in the latest release of selenium-webdriver, that introduced some breaking change?

Thanks!

NathanielAJohnson commented 10 years ago

I also have this issue. I didn't realize that it was a problem since I was just testing the library and thought I had used it incorrectly.

hazeledmands commented 10 years ago

Hmm, any chance one of you could submit a failing spec? I can't reproduce this.

NathanielAJohnson commented 10 years ago

It failed on the spec provided in the sample docs ("I'm a kitty!"). I just copy and pasted it into a js file and ran it with mocha kitty.js I did not add the BDD describe and it. Let me know if I can help.

/usr/lib/node_modules/selenium-webdriver/lib/webdriver/locators.js:243
  throw new TypeError('Invalid locator');
        ^
TypeError: Invalid locator
    at Function.webdriver.Locator.checkLocator (/usr/lib/node_modules/selenium-webdriver/lib/webdriver/locators.js:243:9)
    at webdriver.WebDriver.findElements (/usr/lib/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:810:31)
    at Function.all (/usr/lib/node_modules/chai-webdriver/node_modules/webdriver-sizzle/lib/webdriver_sizzle.js:22:19)
    at assertElementExists (/usr/lib/node_modules/chai-webdriver/lib/index.js:18:16)
    at Assertion.<anonymous> (/usr/lib/node_modules/chai-webdriver/lib/index.js:75:14)
    at Assertion.ctx.(anonymous function) [as text] (/usr/lib/node_modules/chai/lib/chai/utils/addMethod.js:34:25)
    at Object.<anonymous> (/home/nathaniel/programming/projects/js/tmoi/test/e2e/kitty.js:14:62)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
hazeledmands commented 10 years ago

Sorry, still can't reproduce. Code copied and pasted from the readme works perfectly for me using selenium-webdriver@2.40.0, run either directly with node or through mocha.

If you're still experiencing the problem, please submit a pull request with a failing spec in it. Thanks!

bobzoller commented 9 years ago

I just noticed something that may be related and thought I'd share. If your project depends on selenium-webdriver and chai-webdriver, this error can happen if your top-level version of selenium-webdriver gets out of sync with the chai-webdriver dependency selenium-webdriver.

FWIW I saw this issue with protractor, not chai-webdriver, but I believe the root cause is the same.

asalant commented 9 years ago

You might consider switching the selenium-webdriver dependency for chai-webdriver too a peer dependency. This means that the project using chai-webdriver will explicitly need to depend on selenium-webdriver but will ensure that chai-webdriver uses whatever version of selenium-webdriver the project is using.

http://blog.nodejs.org/2013/02/07/peer-dependencies/

On Sun, Dec 21, 2014 at 10:21 PM, Bob Zoller notifications@github.com wrote:

I just noticed something that may be related and thought I'd share. If your project depends on selenium-webdriver and chai-webdriver, this error can happen if your top-level version of selenium-webdriver gets out of sync with the chai-webdriver dependency selenium-webdriver.

FWIW I saw this issue with protractor, not chai-webdriver, but I believe the root cause is the same.

— Reply to this email directly or view it on GitHub https://github.com/goodeggs/chai-webdriver/issues/13#issuecomment-67805746 .

eat well with good eggs on: twitter http://twitter.com/goodeggs || facebook http://facebook.com/goodeggs || blog http://blog.goodeggs.com/

hazeledmands commented 9 years ago

Oh hey! That would totally explain this issue. :+1: