Question: I am writing unit testcases for a UI Framework using **Mocha**, **Chai** and **Karma**. I have analysed before whether to use selenium webdriver to do testing, but since most of the test cases involve working with DOMElement I have found it difficult to be working with selenium though javascript version( **WebDriverJS** ) is available.

Even when I checked other UI Frameworks like **jquery ui**, **kendo**, **semantic**, **foundation** etc.. they have used javascript frameworks like **jasmine**, **qunit** etc.. for testing rather than selenium. 

What could be the reason that UI Framework developers do not prefer Selenium?

Answer: 
**TL;DR**: Selenium is just to slow, compared to for example [Karma](https://karma-runner.github.io/2.0/index.html).

---

I guess most UI Frameworks manipulate the DOM. So verifying that the manipulation was correct is also done in the DOM. Most UI Frameworks seem to use Karma for cross-browser testing the DOM. By running plain JavaScript in the browser and using the plain JavaScript API to get back the results.

Checking all the functionality with Selenium would be slow, hard to maintain and unnecessary as you can test it faster with for example Karma and plain JavaScript.

Jasmine and qUnit are more alternative test runners than tools to verify the DOM. You can also build Selenium or Karma tests with them.

For building UI Frameworks I would expect you need something to run-tests against an actual DOM and check it does what you expect, preferable cross all supported browsers and bloody fast.

UI Frameworks are building blocks for building web-based workflows. Testing the building blocks is relatively easy with the browser JavaScript API. Where testing full workflows is not, here Selenium would be better suited.
You can use this approach - "**VISUAL REGRESSION TESTING USING JEST, CHROMELESS AND AWS LAMBDA**" <https://novemberfive.co/blog/visual-regression-testing-jest-chromeless-lambda>