Differences from Watir

The goal of this project is to be as close to Watir as possible. In terms of functionality, it is equivalent; however, there are some syntax differences due to the nature of Python.


The following containers cannot be used because either the singular or plural version is reserved by Python.

Watir Nerodia
a link
as links
del delete
dels deletes
i ital
is itals


The following locators cannot be used because they are reserved by Python.

Watir Nerodia
class class_name
for N/A*

*This locator is only possible via the below options.

Alternatively, if you are only using one locator you can pass them as individual arguments:

browser.div('class', 'spam')

A third option is to use a dictionary and unpack into the container:

locator = {'class': 'spam', 'index': 1}


Since Python does not have blocks, alternate methods are required.


For cases where we want to perform some actions inside of a different browser context without completely switching to that context, we use the context manager.

Consider the following Window switching Watir code:

browser.window(title: 'Spam and Ham!').use do
  browser.button(id: 'close').click

In Nerodia, the equivalent would be:

with browser.window(title='Spam and Ham!'):

The same would go for frames.


For waits, we need to use lambdas or closures.

Consider the following wait Watir code:

btn = browser.button(id: 'btn')
btn.wait_until(timeout: 2, interval: 0.5) { btn.enabled }

In Nerodia, the equivalent would be:

btn = browser.button(id='btn')
btn.wait_until(timeout=2, interval=0.5 method=lambda e: e.enabled)

Also, while is reserved in Python. Therefore, the Nerodia equivalent of Watir’s Wait.while is Wait.until_not