Selenium WebdriverIO issue when typing numbers

I ran into an issue where my WebdriverIO script would just crash, not leaving any logs, no clues as to why it stopped running.

As I realised it stopped when I called client.keys(foobar) – and foobar was a variable that was a number that is passed into my Node.js script via yargs (yaaaaaarrrrgggg) – which mind you, is an awesome Node module to use if you like passing in parameters via the CLI.

It turns out that because the type of this variable was a number – Selenium didn’t like it. I guess the number type could be reserved for the keyboard number codes or something like that?

Anyway, I’ve had to turn it into a string for it to work properly :

Hope this helps someone!

Write a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.