1
votes

I am trying to do press down-arrow key in the address search box after entering the address in Robot Framework

I'm using the Press Key keyword, but it's not working (it enters the key value in the text box) and I tried other methods, but the library is not added to red.

*** Settings ***
Documentation         Test the Web site
Library               Selenium2Library
Library               pyautogui
Library               OperatingSystem
Library               ImageHorizonLibrary
 *** Keywords ***
 search the address
    Open Browser    http://localhost.com:4000     chrome
    Maximize Browser Window
    Input Text    //*[@id=\"homepage\"]/section[1]/div[1]/div/div/div/app-address-search-bar/div/input    newyork
    press key    //*[@id=\"homepage\"]/section[1]/div[1]/div/div/div/app-address-search-bar/div/input   //25

I excepted that after I type the address in the text box, and I want to press the down-arrow key to select the address (from the drop-down-list).

2
What is the error that you're facing? - demouser123

2 Answers

3
votes

You used an incorrect code for the key - it has to be prefixed with a backslash, not a slash:

press key    //*[@id=\"homepage\"]/section[1]/div[1]/div/div/div/app-address-search-bar/div/input   \\25

And a personal recommendation - you'd been even better to use the "\u" codes. This one's is \ue015.

The full list of the codes can be found in Selenium's source.

0
votes

You can simply use

press keys  your_locator  ARROW_DOWN

As 'press key' is deprecated in the latest version of seleniumLibrary.