Pytest Selenium elem.send_keys() causing TypeError: object of type 'NoneType' has no len() Pytest Selenium elem.send_keys() causing TypeError: object of type 'NoneType' has no len() selenium selenium

Pytest Selenium elem.send_keys() causing TypeError: object of type 'NoneType' has no len()


This error message...

elem.send_keys(userid) ..\selenium\webdriver\remote\webelement.py:478: in send_keys {'text': "".join(keys_to_typing(value)), value = (None,)TypeError: object of type 'NoneType' has no len()

...implies that send_keys() method encountered an error when sending the contents of the variable userid.

Though you have tried to use the variable userid, I don't see the variable userid being declared anywhere within your code block. Hence you see the error:

TypeError: object of type 'NoneType' has no len()


Solution

Initialize the userid variable as:

userid = "Austin"

Now, execute your test.