Skip to content

Press Key dosen't work #198

Closed
Closed

Description

@luislu

I want to use keyword "Press Key" to simulate pressing "enter" function, but it dosen't work

*** Settings ***
Library Selenium2Library

*** Test Cases ***
T1
Open Browser http://baidu.com chrome
Input Text id=kw test
Sleep 5s
Press Key id=kw \13

Activity

  1. ombre42 commented on May 7, 2013

    @ombre42
    Contributor

    The documentation for Press Key shows using a backslash for the key
    argument. In order to send the backslash correctly, you must escape the
    backslash with another backslash due to RF's syntax (see
    http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html?r=2.7.7#escaping
    ).
    I think this has tripped up just about everyone, including me.

    Your suite file should look like this:

    *** Settings ***
    Library           Selenium2Library
    
    *** Test Cases ***
    T1
        Open Browser    http://baidu.com    chrome
        Input Text    id=kw    test
        Sleep    5s
        Press Key    id=kw    \\13
    

    This test performed the search for me.

  2. luislu commented on May 9, 2013

    @luislu
    Author

    Thanks for your replying.
    I just follow the press key introduction in keyword document.

  3. WillDev10 commented on Dec 4, 2013

    @WillDev10

    Thanks to poster who created this. Saved me a lot of time and hassle. Can't believe it's still open though. :-(

  4. ombre42 commented on Feb 14, 2014

    @ombre42
    Contributor

    #200 describes the fix for what this issue was about

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions