History
Minium was created in 2011 by Rui Figueira as a Java library on top of selenium WebDriver with two purposes:
- Mimic jQuery API using Selenium WebDriver API, allowing method chaining when filtering / transversing the page DOM
- Avoid tipical exceptions that occur with Selenium, like
StaleElementReferenceException
Back in those days, WebDriver support for CSS selector was very poor under most browsers, and XPath was not an
option whatsoever (c'mon, XPath on the Web, really?!), and after trying to replicate jQuery API using WebDriver
API calls (which were very inefficient, because each method needed to communicate with the browser to get the
corresponding elements), we found out that we could use WebDriver JavascriptExecutor
to send javascript
instructions to the browser and get both data and element references. That gave us an idea: why not sending
jQuery to the browser and then use it to access web elements instead?
That was what we did, and that gave Minium a huge power:
- Almost all jQuery-supported CSS selectors and methods are now supported by Minium
- Allowing method chaining was as easy as make Minium API lazy, and every method would just concatenate the equivalent jQuery instruction
- By only evaluating a Minium instruction when it was needed (when we needed to click something or get a value),
the probability of getting a
StaleElementReferenceException
was almost 0. Besides, Minium instructions are not binded toWebElement
elements, so you can evaluate the same instruction two different times and get different values if the page has changed