Germanium 2.0.8 Release Notes
As usual Germanium gets a driver update, but this time, but here’s the other goodies packaged in:
This is great if you already have a
WebDriver element from another place and
you want to run Germanium Selectors on top of it, just as if Germanium itself
found it. Think of combined checks, or selection with this node as a reference.
For example you could write something similar to:
if StaticElement(element).inside('table').exists(): element_is_in_a_table(...)
or to find a parent container of this element:
parent_container = Css('div.container').containing(element).element()
Let’s assume that you defined custom selectors to match buttons and dialogs such as:
def ModalDialog(): return Css('div.modal-dialog') def CoolButton(text): return Element("div", css_classes="modal-dialog-button", exact_text=text)
Then we use it like regular Germanium code:
This matches fine as long as there is a
div with a
modal-dialog class. In
case the UX team changes this to something different, such as
def ModalDialog(): return Css('div.modal-dialog, div.mdl-dlg')
So our test can run against both the older version of the site, but also the newer version, without changing the original test code, since one of the main features of the Selector API that is in Germanium, is to make the tests resilient to change.
This works great for simple use-cases such as our CSS dialog selector, but if
the button selector must change, the code is now easily fixable with the help
def CoolButton(text): old_style = Element("div", css_classes="modal-dialog-button", exact_text=text) new_style = Element("div", css_classes="mdl-dlg-btn", exact_text=text) return AnyOfSelector(old_style, new_style)
Some bugfixes were done for germanium especially in the land of Unicode and python 2.
Photo by john paul tyrone fernandez from Pexels: https://www.pexels.com/photo/blur-bokeh-bright-burnt-450301/