intern
intern copied to clipboard
findByClassName(), findAllByClassName() throws "invalid locator" error
Expected behavior
findAllByClassName() should return a list of elements.
Current behavior
It returns an "Invalid argument" error:
InvalidArgument: [POST http://.../elements / {"using":"class name","value":"usernameInput"}] invalid argument: invalid locator
Possible solution
I thought this was a bug in Edgium's driver, but after reading https://www.w3.org/TR/webdriver/#find-element and then https://www.w3.org/TR/webdriver/#dfn-table-of-location-strategies, it seems that "class name" is not a valid strategy.
You could easily convert a call of getAllByClassName("foo") to getAllByCssSelector(".foo").
Environment
Intern version: 4.5.0 Node version: 10.15.3 NPM version: 6.13.7 Browser version: MS Edge Chromium 80
Coincidentally, this came up for someone else yesterday with chromedriver. He's working on a pure webdriver tunnel (no Selenium), and findByClassName was failing there since chromedriver (mostly) follows strict W3C semantics. It seems that Selenium provides a fallback implementation for chromedriver to handle findByClassName, but apparently not for Edge Chromium driver.
This is related to #1105