Robot Framework using Python, Key Press without selecting any button or element in the page
Question: I am automating one application using robot framework using Python. In a
certain situation I need to press enter without selecting any button or
element of the page once the page is loaded.

I have tried with the below example but it didn't work as I don't want to
select any specific button or element of the page before press enter on the
page.

Examples:

    
    
    Press Key    text_field     q   
    Press Key    login_button   \\\13   # ASCII code for enter key
    

Below Keyword is not recognized by the IDE, most probably because of version:

    
    
    Press Key Native
    

So can anyone give me a solution to get rid of this problem ?

Thanks in advance :)


Answer: Robot Framework Selenium library can only send keypresses to an element. If
you want to send actual keypresses, you need to write your own library that
does it. In Windows this can be done using SendKeys module.

Here is a library that defines "Send Enter Key" keyword for Robot Framework. I
tested it quickly on Chrome, it might have problems with PhantomJS.

    
    
    import SendKeys
    
    def send_enter_key():
        """
        Sends ENTER key to application
        Works only in Windows
        """
        SendKeys.SendKeys("{ENTER}")
    

