Category Archives: Webdriver

python to js

Currently working on / investigating:

Python to JS compilers.

Current framwork in Python. Need to test Angular components, yet still couple our current framework without having to switch heavily to JS (Protractor) but still maintain the Webdriver context.

More to follow

Tri-state (Indeterminate) Checkboxes

What is the Tri-state? NY/NJ/CT. JK. Tri-state or indeterminate checkboxes are something i discovered recently. Here they are:


Ran into some trouble with them automating, as the “Indeterminate” state will somewhat misleadingly return a True with a “is_checked” attribute query via Webdriver. Actually I had no idea the 3rd state even exists (or should exist logically). Nonetheless…

Check out

So there will be 3 states that you should check for in order to determine your state:

First, you need to get a combination of two attributes, “checked” and “indeterminate”

  • [WebElement].get_attribute(‘checked’) –> (True, False)
  • [WebElement].get_attribute(‘indeterminate’) –> (True, None)

From these, you can gather the final state of the 3:

  • Unchecked –> checked == False, indeterminate == None
  • Checked –> checked == True, indeterminate == None
  • Indeterminate –> checked == True, indeterminate == True


Utilizing shift and special characters with send_keys()

Today, had the most surprising blocker today.

Apparently, I’ve been automating for awhile and NEVER have had to send a shift-special-character key (the keys you access by pressing shift + normal keys such as !@#$%^&*() etc.)

[*NOTE — this is NOT the same as Keys characters which are sendable. ]

I found out that you CAN’T send a shift-special character via send_keys. I think this is only a Firefox issue. In any case, after toying around with possible solutions, such as encoding/decoding, etc., here is my workaround.

    "_" : Keys.SUBTRACT,
    "!" : '1',
    '@' : '2',
    '#' : '3',
    '$' : '4',
    '%' : '5',
    '^' : '6',
    '&' : '7',
    '*' : '8',
    '(' : '9'

def send_keys_filtered(driver, value, element):
    for i in range(len(value)):
        character = value[i]
        if character in SHIFT_KEYS:
            a = ActionChains(driver)
            a.key_down(Keys.SHIFT, element)
            a.key_up(Keys.SHIFT, element)


In essence, i ActionChain a shift + key if I encounter a shift character.