sendKeys ${KEY_ENTER} not giving me expected results


#1

Here is what my web site does when I manually browse and record my macro:
I fill in a search box. As I type, the list of possible choices below the search box is filtered to only matching entries. If only one choice remains and I press enter in the search box I am sent to the details page matching the one remaining item.

The behavior I see when replaying the macro I am taken back to the previous page rather than the details page…

I noticed the recording did not capturing the data I entered into the search box. I think this is because I never moved the focus from the field. I added a type command into the macro for entering the data. The type command does not allow ${KEY_ENTER}. I added a sendKeys command to the macro with just a ${KEY_ENTER} value.

Here is the macro
{
“CreationDate”: “2018-7-18”,
“Commands”: [
{
“Command”: “open”,
“Target”: “https://login.fakepath.com/admin”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “/html/body”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “link=Practice List”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “id=practice_search_text”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=practice_search_text”,
“Value”: “01041”
},
{
“Command”: “sendKeys”,
“Target”: “id=practice_search_text”,
“Value”: “${KEY_ENTER}”
},
{
“Command”: “click”,
“Target”: “//*[@id=“header”]/div/div/div[2]/div/div[2]/a/i”,
“Value”: “”
},
{
“Command”: “clickAndWait”,
“Target”: “link=Preferences”,
“Value”: “”
},
{
“Command”: “clickAndWait”,
“Target”: “link=Misc.”,
“Value”: “”
}
]
}

I was able to get this to work in SeeShell with this macro. Notice it took two “type {ENTER}” commands to get it to work. If I used only one “type {ENTER}”, it would not advance to the details page.
{
“CreationDate”: “2018-07-18”,
“Commands”: [
{
“Type”: “Navigate”,
“Url”: “https://login.fakepath.com/admin
},
{
“Type”: “WindowSize”,
“WindowWidth”: 1599,
“WindowHeight”: 800,
“WindowState”: 0,
“BrowserWidth”: 1256,
“BrowserHeight”: 683
},
{
“Type”: “Image”,
“Mode”: “Click”,
“Image”: “loginsures_20180718_151613125.png”,
“ConfidenceLevel”: 0.5,
“ClickHowMode”: 0
},
{
“Type”: “Image”,
“Mode”: “TypeAndImage”,
“Image”: “loginsures_20180718_151723714.png”,
“ConfidenceLevel”: 0.5,
“Value”: “01041 {ENTER}”
},
{
“Type”: “Image”,
“Mode”: “TypeAndImage”,
“Image”: “loginsures_20180718_151819466.png”,
“ConfidenceLevel”: 0.5,
“Value”: "{ENTER} "
},
{
“Type”: “Image”,
“Mode”: “Click”,
“Image”: “01041sures_20180718_151856274.png”,
“ConfidenceLevel”: 0.5,
“ClickHowMode”: 0
},
{
“Type”: “Image”,
“Mode”: “Click”,
“Image”: “01041sures_20180718_151919754.png”,
“ConfidenceLevel”: 0.5,
“ClickHowMode”: 0
}
]
}


#2

To work around this behavior, I click on the page outside of any input field (this captures the value entered in the text box), then I click on the one remaining entry displayed. I am taken to the details page as expected.