Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Down arrow key in Synthetics

synthetics-script
developer

#1

Hi ,
Could you please let me know how to use down arrow key in Synthetics(scripted browser) ?
I am trying to select a value after typing the value(not a dropdown/combo box).


#2

Tried this,$browser.findElement($driver.By.id(“object”)).keyDown(Key.ARROW_DOWN); and it dint work.


#3

Hi @Harish.Raj: The function you are looking for is sendKeys. Your function becomes:

$browser.findElement($driver.By.id("object")).sendKeys(Keys.ArrowDown)


5/20/2016 Post of the Week: Mobile, UI, Synthetics and more!
#4

Hi Stefan,
Thanks for your reply,i did try this yesterday but I got ‘ReferenceError: Keys is not defined’ error.
I did define $browser.actions(); in the script but did not work.


#5

The Keys are a property of the webdriver so you need to use:

$browser.findElement($driver.By.id("object")).sendKeys($driver.Key.ARROW_DOWN)


#6

Hi Stefan,
Surprisingly down arrow button isnt working but Key.ENTER seems to work. Still no luck with the item selection from the list.(Auto complete list).


#7

Can you confirm that the script runs correctly but is not selecting the item in the list?

You may need to click or clear the element prior to calling sendKeys.


#8

Hi Stefan,
Yes the script works fine.Its doing the below steps,
1)Click on the edit box
2)Type the object name in the edit box (Autocomplete list)
3)Item appears in the dropdown but i am unable to select the element and the only way to select the element is to clickon the item appearing in the dropdown list.
Pressing ENTER button does not work.


#9

Hi Stefan,
This is resolved now. Used firebug to locate the element from the dropdown list and simple click worked. Thanks a lot for your help.


#10

I am glad you resolved your issue @Harish.Raj. For those that are also experiencing this type of problem there is a sample script to select items from a dropdown list.


#11

i need help here , how did you do it? i am struggling here