2

I am using selenium webdriver under python on a Debian jessie machine. The browser I am currently testing is Chrome (version 55) with chromedriver (version 2.27).

If I send the string 1/2/3 to a textarea input with send_keyswhat gets inserted is 321.

Note that when I use the Firefox geckodriver, I do not see this behavior.

UPDATE: After some more investigation, I believe my problems lies with my Windows/X-windows communication. Some detail: for testing I normally open a Cygwin X-Windows session on my Windows desktop, ssh into a Linux server inside that X-windows session, and run the Selenium tests on that Linux server. This is where I see the strange problem with the forward slashes. However, when I run the tests directly on the Linux server with its own X-Windows session, the problem goes away. But I really want this testing to work with the Windows environment, so I still need a solution.

2 Answers 2

3

This might be because of race conditions in asynchronous test code.

It is always better to escape non-alphanumerical characters.

If that doesn't work you could always put delays/timeouts between typing characters.

Another useful hint might be found here

1

Probably unrelated to your problem since that seems environment related and the actual binary and the dependencies used by the driver.

However, many people may land on this question about characters getting mangled using send keys (like yours did).

What I have found is that some websites use Javascript to format text input.

For example a date field may automatically add "/" forward slash when you have typed the month.

So sendKeys("02/25/2017") ends up being "02//2/5/2017"

in this case, take that into account, and now I send

sendKeys("02252017") ends up being "02/25/2017"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.