pythonseleniumselenium-webdriverselenium-chromedriversplinter

Splinter/selenium interprets some characters as escape sequences


I'm using Selenium (3.14.0), with Splinter (0.9.0), with Chrome Webdriver, with XQuartz on Mac to test my code.

When I try entering data into a form, some characters do not arrive in the input. Say, I do some_text_input.type('cats') the input receives just 'cat'.

After some investigation I found that 3 characters get a special treatment (while all the rest pass):

Note that this only occurs on Mac, and works fine in CI environment.

Has anyone bumped into anything like this? Where does the escaping happen?


Solution

  • In case some poor soul bumps into this, the reason this is happening is because:

    Inside Chrome, ui::VKEY_BACK is short-circuited and is never translated to its x key code equivalent. Chrome is not respecting the remote x server’s key code mappings.

    As outlined in this chromedriver bug from 2014. So the culprit is the combination of chromedriver and XQuartz. As of this writing (September 2018) there hasn't been much movement on this bug (please login at chromium.org and vote on it!). My current workaround is to ensure that offending letters are not used in my tests. So far they are: e, r, s, and, 6. There may be more.