Splinter/selenium 将某些字符解释为转义序列

Splinter/selenium interprets some characters as escape sequences

我正在使用 Selenium (3.14.0)、Splinter (0.9.0)、Chrome Webdriver 和 Mac 上的 XQuartz 来测试我的代码。

当我尝试将数据输入表单时,某些字符未到达 input。说,我做 some_text_input.type('cats') 输入只收到 'cat'。

经过一些调查,我发现有 3 个字符得到了特殊处理(而其余的都通过了):

请注意,这仅发生在 Mac 上,并且在 CI 环境中工作正常。

有人遇到过这样的事情吗?转义发生在哪里?

如果有可怜的人碰到这个,发生这种情况的原因是:

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.

如 2014 年 chromedriver bug 中所述。所以罪魁祸首是 chromedriver 和 XQuartz 的组合。截至撰写本文时(2018 年 9 月),此错误还没有太多进展(请登录 chromium.org 并对其进行投票!)。我目前的解决方法是确保在我的测试中不使用违规字母。到目前为止它们是:e, r, s, and, 6。可能还有更多。